gonzui


Format: Advanced Search

tkernel_2/include/device/pcmcia.hbare sourcepermlink (0.03 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T-Kernel 2.0 Software Package
    4:  *
    5:  *    Copyright 2011 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
   10:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   11:  *
   12:  *----------------------------------------------------------------------
   13:  */
   14: 
   15: /*
   16:  *      pcmcia.h     PCMCIA card manager definition
   17:  */
   18: 
   19: #ifndef __DEVICE_PCMCIA_H__
   20: #define __DEVICE_PCMCIA_H__
   21: 
   22: #include <basic.h>
   23: #include <tk/syscall.h>
   24: #include <tk/syslib.h>
   25: 
   26: #ifdef __cplusplus
   27: extern "C" {
   28: #endif
   29: 
   30: /* Event type */
   31: #define CE_INSERT       1             /* Insert the card */
   32: #define CE_EJECT        2              /* Remove the card */
   33: #define CE_BATTERY      3            /* Card battery status change */
   34: 
   35: /* Response code */
   36: #define CR_NONE         0              /* Not an object card       */
   37: #define CR_OWN          1               /* Object card:occupy */
   38: #define CR_SHARE        2              /* Object card:share  */
   39: 
   40: /* Card type:"FUNCID" tuple code */
   41: #define CK_MULTI        0              /* Multifunction */
   42: #define CK_MEMORY       1             /* Memory */
   43: #define CK_SERIAL       2             /* Serial port */
   44: #define CK_PARALLEL     3           /* Parallel port */
   45: #define CK_FIXED        4              /* Fixed disk */
   46: #define CK_VIDEO        5              /* Video */
   47: #define CK_NETWORK      6            /* Network        */
   48: #define CK_AIMS         7              /* AIMS */
   49: #define CK_SCSI         8              /* SCSI */
   50: #define CK_ANY          255             /* Any (illegal) */
   51: #define CK_NONE         (-1)           /* Non (deregistration)  */
   52: 
   53: typedef struct {                        /* Card status */
   54:         UW     kind:8;                     /* Card type */
   55:         UW     battery:2;          /* Battery status: memory card only */
   56:         UW     wprotect:1;         /* Read-only: memory card only */
   57:         UW     power:1;            /* Electric supply status */
   58:         UW     client:1;           /* In-use status */
   59:         UW     rsv:19;                     /* Reserved */
   60: } CardStat;
   61: 
   62: /* Map / Memory attribute */
   63: #define CA_IONOCHK      0x10000              /* There is no resource management of IO space      */
   64: #define CA_IOMAP        0x8000         /* Map the IO space */
   65: #define CA_ATTRMEM      0x4000               /* Attribute memory specification    */
   66: #define CA_WPROTECT     0x2000              /* Read-only */
   67: #define CA_16BIT        0x0800         /* 16 bit access specification */
   68: #define CA_IOCS16       0x0400                /* IOCS16 source */
   69: 
   70: #define CA_WAIT0        0x0100         /* Additional WAIT 0 specification             */
   71: #define CA_WAIT1        0x0101         /* Additional WAIT 1 specification             */
   72: #define CA_WAIT2        0x0102         /* Additional WAIT 2 specification             */
   73: #define CA_WAIT3        (CA_WAIT1 | CA_WAIT2)  /* Additional WAIT 3 specification       */
   74: #define CA_ZWAIT        0x0104         /* Zero WAIT specification             */
   75: #define CA_SPEED        0x00FF         /* Access speed specification in 50 ns unit */
   76: 
   77: /* Power-supply control */
   78: #define CP_POWEROFF     0x00                /* Power-OFF                  */
   79: #define CP_POWERON      0x01         /* Power-ON                    */
   80: #define CP_SUSPEND      0x10         /* Suspend (power-OFF) */
   81: #define CP_RESUME       0x11          /* Resume (power-ON) */
   82: #define CP_SUSRIRES     0x12                /* Suspend (RI resume) */
   83: #define CP_POFFREQ(tm)  (((tm) << 16) + 0x99) /* Power-OFF after the specified time (second) */
   84: 
   85: /* Special card ID */
   86: #define TEST_CARDID     0x12345678  /* Special card ID for test */
   87: 
   88: /* Maximum size of tuple data */
   89: #define MAX_TUPLESZ     (255 + 2)
   90: 
   91: /* Card event */
   92: typedef struct {
   93:         ID             cardid;            /* Card ID         */
   94:         W              evtype;             /* Event type (CE_xxxx) */
   95:         CardStat       cardstat;     /* Card status */
   96: } CardReq;
   97: 
   98: /*
   99:         Definition for interface library automatic creation (mkiflib)
  100: */
  101: /*** DEFINE_IFLIB
  102: [INCLUDE FILE]
  103: <device/pcmcia.h>
  104: 
  105: [PREFIX]
  106: PCM
  107: ***/
  108: 
  109: /*
  110:         Card manager service function
  111: */
  112: /* [BEGIN SYSCALLS] */
  113: IMPORT  ER       pcRegClient(ID portid, W kind);
  114: IMPORT  INT      pcGetTuple(ID cardid, W tuple, W order, UB* buf);
  115: IMPORT  INT      pcMap(ID cardid, W offset, W len, UW attr, void **addr);
  116: IMPORT  ER       pcReMap(ID cardid, ID mapid);
  117: IMPORT  ER       pcUnMap(ID mapid);
  118: IMPORT  ER       pcReadMem(ID cardid, W offset, W len, UW attr, void *buf);
  119: IMPORT  ER       pcWriteMem(ID cardid, W offset, W len, UW attr, void *buf);
  120: IMPORT  INT      pcGetStat(ID cardid);
  121: IMPORT  INT      pcDefInt(ID cardid, T_DINT *dint, INTVEC vec, UW par);
  122: IMPORT  ER       pcPowerCtl(ID cardid, UW power);
  123: /* [END SYSCALLS] */
  124: 
  125: #ifdef __cplusplus
  126: }
  127: #endif
  128: #endif  /* __DEVICE_PCMCIA_H__ */