Annotation of kernel/bsd/dev/ppc/drvUSBCMD/OSUtils.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
        !             7:  * Reserved.  This file contains Original Code and/or Modifications of
        !             8:  * Original Code as defined in and that are subject to the Apple Public
        !             9:  * Source License Version 1.1 (the "License").  You may not use this file
        !            10:  * except in compliance with the License.  Please obtain a copy of the
        !            11:  * License at http://www.apple.com/publicsource and read it before using
        !            12:  * this file.
        !            13:  * 
        !            14:  * The Original Code and all software distributed under the License are
        !            15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            19:  * License for the specific language governing rights and limitations
        !            20:  * under the License.
        !            21:  * 
        !            22:  * @APPLE_LICENSE_HEADER_END@
        !            23:  */
        !            24: 
        !            25: /*
        !            26:        File:           OSUtils.h
        !            27:  
        !            28:        Contains:       OS Utilities Interfaces.
        !            29:  
        !            30:        Version:        Mac OS 8
        !            31:  
        !            32:        DRI:            Jerry Godes
        !            33:  
        !            34:        Copyright:      � 1985-1998 by Apple Computer, Inc., all rights reserved
        !            35:  
        !            36:        Warning:        *** APPLE INTERNAL USE ONLY ***
        !            37:                                This file may contain unreleased API's
        !            38:  
        !            39:        BuildInfo:      Built by:                       Naga Pappireddi
        !            40:                                With Interfacer:        3.0d9 (PowerPC native)
        !            41:                                From:                           OSUtils.i
        !            42:                                        Revision:               63
        !            43:                                        Dated:                  6/19/98
        !            44:                                        Last change by: ngk
        !            45:                                        Last comment:   [2244553]  Add glueIgnore to Read/WriteLocation because they are
        !            46:  
        !            47:        Bugs:           Report bugs to Radar component "System Interfaces", "Latest"
        !            48:                                List the version information (from above) in the Problem Description.
        !            49:  
        !            50: */
        !            51: #ifndef __OSUTILS__
        !            52: #define __OSUTILS__
        !            53: 
        !            54: #ifndef __MACTYPES__
        !            55: //#include <MacTypes.h>
        !            56: #endif
        !            57: #ifndef __MIXEDMODE__
        !            58: //#include <MixedMode.h>
        !            59: #endif
        !            60: /*  HandToHand and other memory utilties were moved to MacMemory.h */
        !            61: #ifndef __MACMEMORY__
        !            62: //#include <MacMemory.h>
        !            63: #endif
        !            64: /*  GetTrapAddress and other trap table utilties were moved to Patches.h */
        !            65: #ifndef __PATCHES__
        !            66: //#include <Patches.h>
        !            67: #endif
        !            68: /*  Date and Time utilties were moved to DateTimeUtils.h */
        !            69: #ifndef __DATETIMEUTILS__
        !            70: //#include <DateTimeUtils.h>
        !            71: #endif
        !            72: #if !TARGET_OS_MAC
        !            73: #ifndef __ENDIAN__
        !            74: //#include <Endian.h>
        !            75: #endif
        !            76: #endif  /* !TARGET_OS_MAC */
        !            77: 
        !            78: 
        !            79: 
        !            80: #if PRAGMA_ONCE
        !            81: #pragma once
        !            82: #endif
        !            83: 
        !            84: #ifdef __cplusplus
        !            85: extern "C" {
        !            86: #endif
        !            87: 
        !            88: #if PRAGMA_IMPORT
        !            89: #pragma import on
        !            90: #endif
        !            91: /*
        !            92: #if PRAGMA_STRUCT_ALIGN
        !            93:        #pragma options align=mac68k
        !            94: #elif PRAGMA_STRUCT_PACKPUSH
        !            95:        #pragma pack(push, 2)
        !            96: #elif PRAGMA_STRUCT_PACK
        !            97:        #pragma pack(2)
        !            98: #endif
        !            99: */
        !           100: 
        !           101: enum {
        !           102:        useFree                                         = 0,
        !           103:        useATalk                                        = 1,
        !           104:        useAsync                                        = 2,
        !           105:        useExtClk                                       = 3,                                                    /*Externally clocked*/
        !           106:        useMIDI                                         = 4
        !           107: };
        !           108: 
        !           109: 
        !           110: enum {
        !           111:        false32b                                        = 0,                                                    /*24 bit addressing error*/
        !           112:        true32b                                         = 1                                                             /*32 bit addressing error*/
        !           113: };
        !           114: 
        !           115: 
        !           116: enum {
        !           117:                                                                                                                                /* result types for RelString Call */
        !           118:        sortsBefore                                     = -1,                                                   /*first string < second string*/
        !           119:        sortsEqual                                      = 0,                                                    /*first string = second string*/
        !           120:        sortsAfter                                      = 1                                                             /*first string > second string*/
        !           121: };
        !           122: 
        !           123: 
        !           124: enum {
        !           125:        dummyType                                       = 0,
        !           126:        vType                                           = 1,
        !           127:        ioQType                                         = 2,
        !           128:        drvQType                                        = 3,
        !           129:        evType                                          = 4,
        !           130:        fsQType                                         = 5,
        !           131:        sIQType                                         = 6,
        !           132:        dtQType                                         = 7,
        !           133:        nmType                                          = 8
        !           134: };
        !           135: 
        !           136: typedef SignedByte                                             QTypes;
        !           137: 
        !           138: struct SysParmType {
        !           139:        UInt8                                                   valid;
        !           140:        UInt8                                                   aTalkA;
        !           141:        UInt8                                                   aTalkB;
        !           142:        UInt8                                                   config;
        !           143:        short                                                   portA;
        !           144:        short                                                   portB;
        !           145:        long                                                    alarm;
        !           146:        short                                                   font;
        !           147:        short                                                   kbdPrint;
        !           148:        short                                                   volClik;
        !           149:        short                                                   misc;
        !           150: };
        !           151: typedef struct SysParmType                             SysParmType;
        !           152: 
        !           153: typedef SysParmType *                                  SysPPtr;
        !           154: 
        !           155: struct QElem {
        !           156:        struct QElem *                                  qLink;
        !           157:        short                                                   qType;
        !           158:        short                                                   qData[1];
        !           159: };
        !           160: typedef struct QElem                                   QElem;
        !           161: typedef QElem *                                                        QElemPtr;
        !           162: #if TARGET_OS_MAC
        !           163: 
        !           164: struct QHdr {
        !           165:        short                                                   qFlags;
        !           166:        QElemPtr                                                qHead;
        !           167:        QElemPtr                                                qTail;
        !           168: };
        !           169: typedef struct QHdr                                            QHdr;
        !           170: typedef QHdr *                                                 QHdrPtr;
        !           171: #else
        !           172: /*
        !           173:    QuickTime 3.0:
        !           174:    this version of QHdr contains the Mutex necessary for
        !           175:    non-mac non-interrupt code
        !           176: */
        !           177: 
        !           178: struct QHdr {
        !           179:        short                                                   qFlags;
        !           180:        short                                                   pad;
        !           181:        long                                                    MutexID;
        !           182:        QElemPtr                                                qHead;
        !           183:        QElemPtr                                                qTail;
        !           184: };
        !           185: typedef struct QHdr                                            QHdr;
        !           186: typedef QHdr *                                                 QHdrPtr;
        !           187: #endif  /* TARGET_OS_MAC */
        !           188: 
        !           189: 
        !           190: 
        !           191: typedef CALLBACK_API( void , DeferredTaskProcPtr )(long dtParam);
        !           192: /*
        !           193:        WARNING: DeferredTaskProcPtr uses register based parameters under classic 68k
        !           194:                         and cannot be written in a high-level language without 
        !           195:                         the help of mixed mode or assembly glue.
        !           196: */
        !           197: //nagatypedef REGISTER_UPP_TYPE(DeferredTaskProcPtr)                                   DeferredTaskUPP;
        !           198: enum { uppDeferredTaskProcInfo = 0x0000B802 };                                         /* register no_return_value Func(4_bytes:A1) */
        !           199: #if MIXEDMODE_CALLS_ARE_FUNCTIONS
        !           200: EXTERN_API(DeferredTaskUPP)
        !           201: NewDeferredTaskProc                       (DeferredTaskProcPtr         userRoutine);
        !           202: EXTERN_API(void)
        !           203: CallDeferredTaskProc              (DeferredTaskUPP                     userRoutine,
        !           204:                                                                long                                    dtParam);
        !           205: #else
        !           206: #define NewDeferredTaskProc(userRoutine)                                               (DeferredTaskUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppDeferredTaskProcInfo, GetCurrentArchitecture())
        !           207: #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           208:        #pragma parameter CallDeferredTaskProc(__A0, __A1)
        !           209:        void CallDeferredTaskProc(DeferredTaskUPP routine, long dtParam) = 0x4E90;
        !           210: #else
        !           211:        #define CallDeferredTaskProc(userRoutine, dtParam)                      CALL_ONE_PARAMETER_UPP((userRoutine), uppDeferredTaskProcInfo, (dtParam))
        !           212: #endif
        !           213: #endif
        !           214: 
        !           215: struct DeferredTask {
        !           216:        QElemPtr                                                qLink;
        !           217:        short                                                   qType;
        !           218:        short                                                   dtFlags;
        !           219:        //naga DeferredTaskUPP                          dtAddr;
        !           220:        long                                                    dtParam;
        !           221:        long                                                    dtReserved;
        !           222: };
        !           223: typedef struct DeferredTask                            DeferredTask;
        !           224: typedef DeferredTask *                                 DeferredTaskPtr;
        !           225: #if TARGET_OS_MAC
        !           226: 
        !           227: struct MachineLocation {
        !           228:        Fract                                                   latitude;
        !           229:        Fract                                                   longitude;
        !           230:        union {
        !           231:                SInt8                                                   dlsDelta;                               /* signed byte; daylight savings delta */
        !           232:                long                                                    gmtDelta;                               /* use low 24-bits only */
        !           233:        }                                                               u;
        !           234: };
        !           235: typedef struct MachineLocation                 MachineLocation;
        !           236: #else
        !           237: /*
        !           238:        QuickTime 3.0:
        !           239:        Alignment of MachineLocation is weird. The union above used for delta
        !           240:        tends not to work on non-Mac compilers.
        !           241: */
        !           242: //naga
        !           243: typedef long BigEndianLong;
        !           244: struct MachineLocation {
        !           245:        Fract                                                   latitude;
        !           246:        Fract                                                   longitude;
        !           247:        BigEndianLong                                   delta;                                          /* high byte is daylight savings delta, low 24-bits is GMT delta */
        !           248: };
        !           249: typedef struct MachineLocation                 MachineLocation;
        !           250: #endif  /* TARGET_OS_MAC */
        !           251: 
        !           252: EXTERN_API( Boolean )
        !           253: IsMetric                                               (void)                                                                                                          THREEWORDINLINE(0x3F3C, 0x0004, 0xA9ED);
        !           254: 
        !           255: EXTERN_API( SysPPtr )
        !           256: GetSysPPtr                                             (void)                                                                                                          THREEWORDINLINE(0x2EBC, 0x0000, 0x01F8);
        !           257: 
        !           258: 
        !           259: /*
        !           260:        NOTE: SysBeep() has been moved to Sound.h.  
        !           261:                  We could not automatically #include Sound.h in this file
        !           262:                  because Sound.h indirectly #include's OSUtils.h which
        !           263:                  would make a circular include.
        !           264: */
        !           265:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           266:                                                                                                                                                                                        #pragma parameter __D0 DTInstall(__A0)
        !           267:                                                                                                                                                                                        #endif
        !           268: EXTERN_API( OSErr )
        !           269: DTInstall                                              (DeferredTaskPtr                dtTaskPtr)                                                      ONEWORDINLINE(0xA082);
        !           270: 
        !           271: 
        !           272: 
        !           273: #if TARGET_CPU_PPC || !TARGET_OS_MAC
        !           274: #define GetMMUMode() ((SInt8)true32b)
        !           275: #define SwapMMUMode(x) (*(SInt8*)(x) = true32b)
        !           276: #else
        !           277: EXTERN_API( SInt8 )
        !           278: GetMMUMode                                             (void)                                                                                                          TWOWORDINLINE(0x1EB8, 0x0CB2);
        !           279: 
        !           280:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           281:                                                                                                                                                                                        #pragma parameter SwapMMUMode(__A0)
        !           282:                                                                                                                                                                                        #endif
        !           283: EXTERN_API( void )
        !           284: SwapMMUMode                                            (SInt8 *                                mode)                                                           THREEWORDINLINE(0x1010, 0xA05D, 0x1080);
        !           285: 
        !           286: #endif
        !           287:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           288:                                                                                                                                                                                        #pragma parameter Delay(__A0, __A1)
        !           289:                                                                                                                                                                                        #endif
        !           290: EXTERN_API( void )
        !           291: Delay                                                  (unsigned long                  numTicks,
        !           292:                                                                 unsigned long *                finalTicks)                                                     TWOWORDINLINE(0xA03B, 0x2280);
        !           293: 
        !           294: 
        !           295: EXTERN_API( OSErr )
        !           296: WriteParam                                             (void);
        !           297: 
        !           298:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           299:                                                                                                                                                                                        #pragma parameter Enqueue(__A0, __A1)
        !           300:                                                                                                                                                                                        #endif
        !           301: EXTERN_API( void )
        !           302: Enqueue                                                        (QElemPtr                               qElement,
        !           303:                                                                 QHdrPtr                                qHeader)                                                        ONEWORDINLINE(0xA96F);
        !           304: 
        !           305:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           306:                                                                                                                                                                                        #pragma parameter __D0 Dequeue(__A0, __A1)
        !           307:                                                                                                                                                                                        #endif
        !           308: EXTERN_API( OSErr )
        !           309: Dequeue                                                        (QElemPtr                               qElement,
        !           310:                                                                 QHdrPtr                                qHeader)                                                        ONEWORDINLINE(0xA96E);
        !           311: 
        !           312:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           313:                                                                                                                                                                                        #pragma parameter __D0 SetCurrentA5
        !           314:                                                                                                                                                                                        #endif
        !           315: EXTERN_API( long )
        !           316: SetCurrentA5                                   (void)                                                                                                          THREEWORDINLINE(0x200D, 0x2A78, 0x0904);
        !           317: 
        !           318:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           319:                                                                                                                                                                                        #pragma parameter __D0 SetA5(__D0)
        !           320:                                                                                                                                                                                        #endif
        !           321: EXTERN_API( long )
        !           322: SetA5                                                  (long                                   newA5)                                                          ONEWORDINLINE(0xC18D);
        !           323: 
        !           324:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           325:                                                                                                                                                                                        #pragma parameter __D0 InitUtil
        !           326:                                                                                                                                                                                        #endif
        !           327: EXTERN_API( OSErr )
        !           328: InitUtil                                               (void)                                                                                                          ONEWORDINLINE(0xA03F);
        !           329: 
        !           330: 
        !           331: #if TARGET_CPU_PPC
        !           332: EXTERN_API( void )
        !           333: MakeDataExecutable                             (void *                                 baseAddress,
        !           334:                                                                 unsigned long                  length);
        !           335: 
        !           336: #endif  /* TARGET_CPU_PPC */
        !           337: 
        !           338: #if TARGET_CPU_68K
        !           339: EXTERN_API( Boolean )
        !           340: SwapInstructionCache                   (Boolean                                cacheEnable);
        !           341: 
        !           342: EXTERN_API( void )
        !           343: FlushInstructionCache                  (void)                                                                                                          TWOWORDINLINE(0x7001, 0xA098);
        !           344: 
        !           345: EXTERN_API( Boolean )
        !           346: SwapDataCache                                  (Boolean                                cacheEnable);
        !           347: 
        !           348: EXTERN_API( void )
        !           349: FlushDataCache                                 (void)                                                                                                          TWOWORDINLINE(0x7003, 0xA098);
        !           350: 
        !           351: EXTERN_API( void )
        !           352: FlushCodeCache                                 (void)                                                                                                          ONEWORDINLINE(0xA0BD);
        !           353: 
        !           354: #endif  /* TARGET_CPU_68K */
        !           355: 
        !           356:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           357:                                                                                                                                                                                        #pragma parameter __D0 FlushCodeCacheRange(__A0, __A1)
        !           358:                                                                                                                                                                                        #endif
        !           359: EXTERN_API( OSErr )
        !           360: FlushCodeCacheRange                            (void *                                 address,
        !           361:                                                                 unsigned long                  count)                                                          TWOWORDINLINE(0x7009, 0xA098);
        !           362: 
        !           363:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           364:                                                                                                                                                                                        #pragma parameter ReadLocation(__A0)
        !           365:                                                                                                                                                                                        #endif
        !           366: EXTERN_API( void )
        !           367: ReadLocation                                   (MachineLocation *              loc)                                                            FOURWORDINLINE(0x203C, 0x000C, 0x00E4, 0xA051);
        !           368: 
        !           369: 
        !           370:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           371:                                                                                                                                                                                        #pragma parameter WriteLocation(__A0)
        !           372:                                                                                                                                                                                        #endif
        !           373: EXTERN_API( void )
        !           374: WriteLocation                                  (const MachineLocation * loc)                                                           FOURWORDINLINE(0x203C, 0x000C, 0x00E4, 0xA052);
        !           375: 
        !           376: 
        !           377: 
        !           378: #if OLDROUTINENAMES
        !           379: #define IUMetric() IsMetric()
        !           380: #endif  /* OLDROUTINENAMES */
        !           381: 
        !           382: /*
        !           383:        NOTE: SysEnvirons is obsolete.  You should be using Gestalt.
        !           384: */
        !           385: /* Environs Equates */
        !           386: 
        !           387: enum {
        !           388:        curSysEnvVers                           = 2                                                             /*Updated to equal latest SysEnvirons version*/
        !           389: };
        !           390: 
        !           391: 
        !           392: struct SysEnvRec {
        !           393:        short                                                   environsVersion;
        !           394:        short                                                   machineType;
        !           395:        short                                                   systemVersion;
        !           396:        short                                                   processor;
        !           397:        Boolean                                                 hasFPU;
        !           398:        Boolean                                                 hasColorQD;
        !           399:        short                                                   keyBoardType;
        !           400:        short                                                   atDrvrVersNum;
        !           401:        short                                                   sysVRefNum;
        !           402: };
        !           403: typedef struct SysEnvRec                               SysEnvRec;
        !           404: 
        !           405: enum {
        !           406:                                                                                                                                /* Machine Types */
        !           407:        envMac                                          = -1,
        !           408:        envXL                                           = -2,
        !           409:        envMachUnknown                          = 0,
        !           410:        env512KE                                        = 1,
        !           411:        envMacPlus                                      = 2,
        !           412:        envSE                                           = 3,
        !           413:        envMacII                                        = 4,
        !           414:        envMacIIx                                       = 5,
        !           415:        envMacIIcx                                      = 6,
        !           416:        envSE30                                         = 7,
        !           417:        envPortable                                     = 8,
        !           418:        envMacIIci                                      = 9,
        !           419:        envMacIIfx                                      = 11
        !           420: };
        !           421: 
        !           422: 
        !           423: enum {
        !           424:                                                                                                                                /* CPU types */
        !           425:        envCPUUnknown                           = 0,
        !           426:        env68000                                        = 1,
        !           427:        env68010                                        = 2,
        !           428:        env68020                                        = 3,
        !           429:        env68030                                        = 4,
        !           430:        env68040                                        = 5
        !           431: };
        !           432: 
        !           433: 
        !           434: enum {
        !           435:                                                                                                                                /* Keyboard types */
        !           436:        envUnknownKbd                           = 0,
        !           437:        envMacKbd                                       = 1,
        !           438:        envMacAndPad                            = 2,
        !           439:        envMacPlusKbd                           = 3,
        !           440:        envAExtendKbd                           = 4,
        !           441:        envStandADBKbd                          = 5,
        !           442:        envPrtblADBKbd                          = 6,
        !           443:        envPrtblISOKbd                          = 7,
        !           444:        envStdISOADBKbd                         = 8,
        !           445:        envExtISOADBKbd                         = 9
        !           446: };
        !           447: 
        !           448:                                                                                                                                                                                        #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
        !           449:                                                                                                                                                                                        #pragma parameter __D0 SysEnvirons(__D0, __A0)
        !           450:                                                                                                                                                                                        #endif
        !           451: EXTERN_API( OSErr )
        !           452: SysEnvirons                                            (short                                  versionRequested,
        !           453:                                                                 SysEnvRec *                    theWorld)                                                       ONEWORDINLINE(0xA090);
        !           454: 
        !           455: 
        !           456: 
        !           457: 
        !           458: 
        !           459: 
        !           460: /*naga
        !           461: #if PRAGMA_STRUCT_ALIGN
        !           462:        #pragma options align=reset
        !           463: #elif PRAGMA_STRUCT_PACKPUSH
        !           464:        #pragma pack(pop)
        !           465: #elif PRAGMA_STRUCT_PACK
        !           466:        #pragma pack()
        !           467: #endif
        !           468: 
        !           469: #ifdef PRAGMA_IMPORT_OFF
        !           470: #pragma import off
        !           471: #elif PRAGMA_IMPORT
        !           472: #pragma import reset
        !           473: #endif
        !           474: 
        !           475: #ifdef __cplusplus
        !           476: }
        !           477: #endif
        !           478: */
        !           479: #endif /* __OSUTILS__ */
        !           480: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.