• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdeutils
  • Sitemap
  • Contact Us
 

klaptopdaemon

cs.h

Go to the documentation of this file.
00001 /*
00002  * cs.h 1.63 1998/12/09 07:36:24
00003  *
00004  * The contents of this file are subject to the Mozilla Public License
00005  * Version 1.0 (the "License"); you may not use this file except in
00006  * compliance with the License. You may obtain a copy of the License
00007  * at http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS"
00010  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00011  * the License for the specific language governing rights and
00012  * limitations under the License. 
00013  *
00014  * The initial developer of the original code is David A. Hinds
00015  * <dhinds@hyper.stanford.edu>.  Portions created by David A. Hinds
00016  * are Copyright (C) 1998 David A. Hinds.  All Rights Reserved.
00017  */
00018 
00019 #ifndef _LINUX_CS_H
00020 #define _LINUX_CS_H
00021 
00022 /* For AccessConfigurationRegister */
00023 typedef struct conf_reg_t {
00024     u_char  Function;
00025     u_int   Action;
00026     off_t   Offset;
00027     u_int   Value;
00028 } conf_reg_t;
00029 
00030 /* Actions */
00031 #define CS_READ     1
00032 #define CS_WRITE    2
00033 
00034 /* for AdjustResourceInfo */
00035 typedef struct adjust_t {
00036     u_int   Action;
00037     u_int   Resource;
00038     u_int   Attributes;
00039     union {
00040     struct memory {
00041         u_long  Base;
00042         u_long  Size;
00043     } memory;
00044     struct io {
00045         ioaddr_t    BasePort;
00046         ioaddr_t    NumPorts;
00047         u_int   IOAddrLines;
00048     } io;
00049     struct irq {
00050         u_int   IRQ;
00051     } irq;
00052     } resource;
00053 } adjust_t;
00054 
00055 /* Action field */
00056 #define REMOVE_MANAGED_RESOURCE     1
00057 #define ADD_MANAGED_RESOURCE        2
00058 #define GET_FIRST_MANAGED_RESOURCE  3
00059 #define GET_NEXT_MANAGED_RESOURCE   4
00060 /* Resource field */
00061 #define RES_MEMORY_RANGE        1
00062 #define RES_IO_RANGE            2
00063 #define RES_IRQ             3
00064 /* Attribute field */
00065 #define RES_IRQ_TYPE            0x03
00066 #define RES_IRQ_TYPE_EXCLUSIVE      0
00067 #define RES_IRQ_TYPE_TIME       1
00068 #define RES_IRQ_TYPE_DYNAMIC        2
00069 #define RES_IRQ_CSC         0x04
00070 #define RES_SHARED          0x08
00071 #define RES_RESERVED            0x10
00072 #define RES_ALLOCATED           0x20
00073 #define RES_REMOVED         0x40
00074 
00075 typedef struct servinfo_t {
00076     char    Signature[2];
00077     u_int   Count;
00078     u_int   Revision;
00079     u_int   CSLevel;
00080     char    *VendorString;
00081 } servinfo_t;
00082 
00083 typedef struct event_callback_args_t {
00084     client_handle_t client_handle;
00085     void    *info;
00086     void    *mtdrequest;
00087     void    *buffer;
00088     void    *misc;
00089     void    *client_data;
00090 } event_callback_args_t;
00091 
00092 /* for GetConfigurationInfo */
00093 typedef struct config_info_t {
00094     u_char  Function;
00095     u_int   Attributes;
00096     u_int   Vcc, Vpp1, Vpp2;
00097     u_int   IntType;
00098     u_int   ConfigBase;
00099     u_char  Status, Pin, Copy, Option, ExtStatus;
00100     u_int   Present;
00101     u_int   CardValues;
00102     u_int   AssignedIRQ;
00103     u_int   IRQAttributes;
00104     ioaddr_t    BasePort1;
00105     ioaddr_t    NumPorts1;
00106     u_int   Attributes1;
00107     ioaddr_t    BasePort2;
00108     ioaddr_t    NumPorts2;
00109     u_int   Attributes2;
00110     u_int   IOAddrLines;
00111 } config_info_t;
00112 
00113 /* For CardValues field */
00114 #define CV_OPTION_VALUE     0x01
00115 #define CV_STATUS_VALUE     0x02
00116 #define CV_PIN_REPLACEMENT  0x04
00117 #define CV_COPY_VALUE       0x08
00118 #define CV_EXT_STATUS       0x10
00119 
00120 /* For GetFirst/NextClient */
00121 typedef struct client_req_t {
00122     socket_t    Socket;
00123     u_int   Attributes;
00124 } client_req_t;
00125 
00126 #define CLIENT_THIS_SOCKET  0x01
00127 
00128 /* For RegisterClient */
00129 typedef struct client_reg_t {
00130     dev_info_t  *dev_info;
00131     u_int   Attributes;
00132     u_int   EventMask;
00133     int     (*event_handler)(event_t event, int priority,
00134                  event_callback_args_t *);
00135     event_callback_args_t event_callback_args;
00136     u_int   Version;
00137 } client_reg_t;
00138 
00139 /* ModifyConfiguration */
00140 typedef struct modconf_t {
00141     u_int   Attributes;
00142     u_int   Vcc, Vpp1, Vpp2;
00143 } modconf_t;
00144 
00145 /* Attributes for ModifyConfiguration */
00146 #define CONF_IRQ_CHANGE_VALID   0x100
00147 #define CONF_VCC_CHANGE_VALID   0x200
00148 #define CONF_VPP1_CHANGE_VALID  0x400
00149 #define CONF_VPP2_CHANGE_VALID  0x800
00150 
00151 /* For RequestConfiguration */
00152 typedef struct config_req_t {
00153     u_int   Attributes;
00154     u_int   Vcc, Vpp1, Vpp2;
00155     u_int   IntType;
00156     u_int   ConfigBase;
00157     u_char  Status, Pin, Copy, ExtStatus;
00158     u_char  ConfigIndex;
00159     u_int   Present;
00160 } config_req_t;
00161 
00162 /* Attributes for RequestConfiguration */
00163 #define CONF_ENABLE_IRQ     0x01
00164 #define CONF_ENABLE_DMA     0x02
00165 #define CONF_ENABLE_SPKR    0x04
00166 #define CONF_VALID_CLIENT   0x100
00167 
00168 /* IntType field */
00169 #define INT_MEMORY      0x01
00170 #define INT_MEMORY_AND_IO   0x02
00171 #define INT_CARDBUS     0x04
00172 
00173 /* For RequestIO and ReleaseIO */
00174 typedef struct io_req_t {
00175     ioaddr_t    BasePort1;
00176     ioaddr_t    NumPorts1;
00177     u_int   Attributes1;
00178     ioaddr_t    BasePort2;
00179     ioaddr_t    NumPorts2;
00180     u_int   Attributes2;
00181     u_int   IOAddrLines;
00182 } io_req_t;
00183 
00184 /* Attributes for RequestIO and ReleaseIO */
00185 #define IO_SHARED       0x01
00186 #define IO_FIRST_SHARED     0x02
00187 #define IO_FORCE_ALIAS_ACCESS   0x04
00188 #define IO_DATA_PATH_WIDTH  0x18
00189 #define IO_DATA_PATH_WIDTH_8    0x00
00190 #define IO_DATA_PATH_WIDTH_16   0x08
00191 #define IO_DATA_PATH_WIDTH_AUTO 0x10
00192 
00193 /* For RequestIRQ and ReleaseIRQ */
00194 typedef struct irq_req_t {
00195     u_int   Attributes;
00196     u_int   AssignedIRQ;
00197     u_int   IRQInfo1, IRQInfo2;
00198     void    *Handler;
00199     void    *Instance;
00200 } irq_req_t;
00201 
00202 /* Attributes for RequestIRQ and ReleaseIRQ */
00203 #define IRQ_TYPE            0x03
00204 #define IRQ_TYPE_EXCLUSIVE      0x00
00205 #define IRQ_TYPE_TIME           0x01
00206 #define IRQ_TYPE_DYNAMIC_SHARING    0x02
00207 #define IRQ_FORCED_PULSE        0x04
00208 #define IRQ_FIRST_SHARED        0x08
00209 #define IRQ_HANDLE_PRESENT      0x10
00210 #define IRQ_PULSE_ALLOCATED     0x100
00211 
00212 /* Bits in IRQInfo1 field */
00213 #define IRQ_MASK        0x0f
00214 #define IRQ_NMI_ID      0x01
00215 #define IRQ_IOCK_ID     0x02
00216 #define IRQ_BERR_ID     0x04
00217 #define IRQ_VEND_ID     0x08
00218 #define IRQ_INFO2_VALID     0x10
00219 #define IRQ_LEVEL_ID        0x20
00220 #define IRQ_PULSE_ID        0x40
00221 #define IRQ_SHARE_ID        0x80
00222 
00223 typedef struct eventmask_t {
00224     u_int   Attributes;
00225     u_int   EventMask;
00226 } eventmask_t;
00227 
00228 #define CONF_EVENT_MASK_VALID   0x01
00229 
00230 /* Configuration registers present */
00231 #define PRESENT_OPTION      0x001
00232 #define PRESENT_STATUS      0x002
00233 #define PRESENT_PIN_REPLACE 0x004
00234 #define PRESENT_COPY        0x008
00235 #define PRESENT_EXT_STATUS  0x010
00236 #define PRESENT_IOBASE_0    0x020
00237 #define PRESENT_IOBASE_1    0x040
00238 #define PRESENT_IOBASE_2    0x080
00239 #define PRESENT_IOBASE_3    0x100
00240 #define PRESENT_IOSIZE      0x200
00241 
00242 /* Attributes for Request/GetConfiguration */
00243 #define CONF_ENABLE_IRQ     0x01
00244 #define EXCLUSIVE_USE       0x02
00245 #define VALID_CLIENT        0x04
00246 
00247 /* For MapMemPage */
00248 typedef struct memreq_t {
00249     u_int   CardOffset;
00250     page_t  Page;
00251 } memreq_t;
00252 
00253 /* For ModifyWindow */
00254 typedef struct modwin_t {
00255     u_int   Attributes;
00256     u_int   AccessSpeed;
00257 } modwin_t;
00258 
00259 /* For RequestWindow */
00260 typedef struct win_req_t {
00261     u_int   Attributes;
00262     u_long  Base;
00263     u_int   Size;
00264     u_int   AccessSpeed;
00265 } win_req_t;
00266 
00267 /* Attributes for RequestWindow */
00268 #define WIN_ADDR_SPACE      0x0001
00269 #define WIN_ADDR_SPACE_MEM  0x0000
00270 #define WIN_ADDR_SPACE_IO   0x0001
00271 #define WIN_MEMORY_TYPE     0x0002
00272 #define WIN_MEMORY_TYPE_CM  0x0000
00273 #define WIN_MEMORY_TYPE_AM  0x0002
00274 #define WIN_ENABLE      0x0004
00275 #define WIN_DATA_WIDTH      0x0018
00276 #define WIN_DATA_WIDTH_8    0x0000
00277 #define WIN_DATA_WIDTH_16   0x0008
00278 #define WIN_DATA_WIDTH_32   0x0010
00279 #define WIN_PAGED       0x0020
00280 #define WIN_SHARED      0x0040
00281 #define WIN_FIRST_SHARED    0x0080
00282 #define WIN_USE_WAIT        0x0100
00283 #define WIN_MAP_BELOW_1MB   0x0400
00284 #define WIN_PREFETCH        0x0800
00285 #define WIN_CACHEABLE       0x1000
00286 #define WIN_BAR_MASK        0xe000
00287 #define WIN_BAR_SHIFT       13
00288 
00289 /* Attributes for RegisterClient */
00290 #define INFO_MASTER_CLIENT  0x01
00291 #define INFO_IO_CLIENT      0x02
00292 #define INFO_MTD_CLIENT     0x04
00293 #define INFO_MEM_CLIENT     0x08
00294 #define MAX_NUM_CLIENTS     3
00295 
00296 #define INFO_CARD_SHARE     0x10
00297 #define INFO_CARD_EXCL      0x20
00298 
00299 typedef struct cs_status_t {
00300     u_char  Function;
00301     event_t     CardState;
00302     event_t SocketState;
00303 } cs_status_t;
00304 
00305 typedef struct error_info_t {
00306     int     func;
00307     int     retcode;
00308 } error_info_t;
00309 
00310 /* Special stuff for binding drivers to sockets */
00311 typedef struct bind_req_t {
00312     socket_t    Socket;
00313     u_char  Function;
00314     dev_info_t  *dev_info;
00315 } bind_req_t;
00316 
00317 /* Flag to bind to all functions */
00318 #define BIND_FN_ALL 0xff
00319 
00320 typedef struct mtd_bind_t {
00321     socket_t    Socket;
00322     u_int   Attributes;
00323     u_int   CardOffset;
00324     dev_info_t  *dev_info;
00325 } mtd_bind_t;
00326 
00327 /* Events */
00328 #define CS_EVENT_PRI_LOW        0
00329 #define CS_EVENT_PRI_HIGH       1
00330 
00331 #define CS_EVENT_WRITE_PROTECT      0x000001
00332 #define CS_EVENT_CARD_LOCK      0x000002
00333 #define CS_EVENT_CARD_INSERTION     0x000004
00334 #define CS_EVENT_CARD_REMOVAL       0x000008
00335 #define CS_EVENT_BATTERY_DEAD       0x000010
00336 #define CS_EVENT_BATTERY_LOW        0x000020
00337 #define CS_EVENT_READY_CHANGE       0x000040
00338 #define CS_EVENT_CARD_DETECT        0x000080
00339 #define CS_EVENT_RESET_REQUEST      0x000100
00340 #define CS_EVENT_RESET_PHYSICAL     0x000200
00341 #define CS_EVENT_CARD_RESET     0x000400
00342 #define CS_EVENT_REGISTRATION_COMPLETE  0x000800
00343 #define CS_EVENT_RESET_COMPLETE     0x001000
00344 #define CS_EVENT_PM_SUSPEND     0x002000
00345 #define CS_EVENT_PM_RESUME      0x004000
00346 #define CS_EVENT_INSERTION_REQUEST  0x008000
00347 #define CS_EVENT_EJECTION_REQUEST   0x010000
00348 #define CS_EVENT_MTD_REQUEST        0x020000
00349 #define CS_EVENT_ERASE_COMPLETE     0x040000
00350 #define CS_EVENT_REQUEST_ATTENTION  0x080000
00351 #define CS_EVENT_CB_DETECT      0x100000
00352 #define CS_EVENT_3VCARD         0x200000
00353 #define CS_EVENT_XVCARD         0x400000
00354 
00355 /* Return codes */
00356 #define CS_SUCCESS      0x00
00357 #define CS_BAD_ADAPTER      0x01
00358 #define CS_BAD_ATTRIBUTE    0x02
00359 #define CS_BAD_BASE     0x03
00360 #define CS_BAD_EDC      0x04
00361 #define CS_BAD_IRQ      0x06
00362 #define CS_BAD_OFFSET       0x07
00363 #define CS_BAD_PAGE     0x08
00364 #define CS_READ_FAILURE     0x09
00365 #define CS_BAD_SIZE     0x0a
00366 #define CS_BAD_SOCKET       0x0b
00367 #define CS_BAD_TYPE     0x0d
00368 #define CS_BAD_VCC      0x0e
00369 #define CS_BAD_VPP      0x0f
00370 #define CS_BAD_WINDOW       0x11
00371 #define CS_WRITE_FAILURE    0x12
00372 #define CS_NO_CARD      0x14
00373 #define CS_UNSUPPORTED_FUNCTION 0x15
00374 #define CS_UNSUPPORTED_MODE 0x16
00375 #define CS_BAD_SPEED        0x17
00376 #define CS_BUSY         0x18
00377 #define CS_GENERAL_FAILURE  0x19
00378 #define CS_WRITE_PROTECTED  0x1a
00379 #define CS_BAD_ARG_LENGTH   0x1b
00380 #define CS_BAD_ARGS     0x1c
00381 #define CS_CONFIGURATION_LOCKED 0x1d
00382 #define CS_IN_USE       0x1e
00383 #define CS_NO_MORE_ITEMS    0x1f
00384 #define CS_OUT_OF_RESOURCE  0x20
00385 #define CS_BAD_HANDLE       0x21
00386 
00387 #define CS_BAD_TUPLE        0x40
00388 
00389 #ifdef __KERNEL__
00390 
00391 /*
00392  *  Calls to set up low-level "Socket Services" drivers
00393  */
00394 
00395 typedef int (*ss_entry_t)(u_int sock, u_int cmd, void *arg);
00396 extern int register_ss_entry(int nsock, ss_entry_t entry);
00397 extern void unregister_ss_entry(ss_entry_t entry);
00398 
00399 /*
00400  *  The main Card Services entry point
00401  */
00402 
00403 enum service {
00404     AccessConfigurationRegister, AddSocketServices,
00405     AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory,
00406     DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo,
00407     GetClientInfo, GetConfigurationInfo, GetEventMask,
00408     GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple,
00409     GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple,
00410     GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage,
00411     MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow,
00412     OpenMemory, ParseTuple, ReadMemory, RegisterClient,
00413     RegisterEraseQueue, RegisterMTD, RegisterTimer,
00414     ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ,
00415     ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices,
00416     RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ,
00417     RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry,
00418     SetEventMask, SetRegion, ValidateCIS, VendorSpecific,
00419     WriteMemory, BindDevice, BindMTD, ReportError,
00420     SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS
00421 };
00422 
00423 #ifdef IN_CARD_SERVICES
00424 extern int CardServices(int func, void *a1, void *a2, void *a3);
00425 #else
00426 extern int CardServices(int func, ...);
00427 #endif
00428 
00429 #ifdef __BEOS__
00430 #define SS_MODULE_NAME(s)   ("busses/pcmcia/" s "/v1")
00431 #define MTD_MODULE_NAME(s)  ("busses/pcmcia/" s "/v1")
00432 #define CS_CLIENT_MODULE_NAME   "bus_managers/pcmcia_cs/client/v1"
00433 typedef struct cs_client_module_info {
00434     bus_manager_info    binfo;
00435     int (*_CardServices)(int, ...);
00436     int (*_MTDHelperEntry)(int, ...);
00437     void (*_add_timer)(struct timer_list *);
00438     void (*_del_timer)(struct timer_list *);
00439 } cs_client_module_info;
00440 #define CS_SOCKET_MODULE_NAME "bus_managers/pcmcia_cs/socket/v1"
00441 typedef struct cs_socket_module_info {
00442     bus_manager_info    binfo;
00443     int (*_register_ss_entry)(int, ss_entry_t);
00444     void (*_unregister_ss_entry)(ss_entry_t);
00445     void (*_add_timer)(struct timer_list *);
00446     void (*_del_timer)(struct timer_list *);
00447     int (*register_resource)(int, u_long, u_long);
00448     int (*release_resource)(int, u_long, u_long);
00449     int (*check_resource)(int, u_long, u_long);
00450 } cs_socket_module_info;
00451 #endif
00452 
00453 #endif /* __KERNEL__ */
00454 
00455 #endif /* _LINUX_CS_H */

klaptopdaemon

Skip menu "klaptopdaemon"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

kdeutils

Skip menu "kdeutils"
  • ark
  • kcalc
  • kcharselect
  • kdelirc
  • kdessh
  • kdf
  • kfloppy
  • kgpg
  • kjots
  • klaptopdaemon
  • kmilo
  • ksim
  • ktimer
  • kwallet
  • superkaramba
Generated for kdeutils by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal