pcmcia-prog
字号:
CS_BAD_HANDLE The client handle is invalid. CS_NO_MORE_ITEMS No more windows ara configured for this socket. 33..55..55.. MMaappMMeemmPPaaggee,, GGeettMMeemmPPaaggee int CardServices(MapMemPage, window_handle_t handle, memreq_t *req); int CardServices(GetMemPage, window_handle_t handle, memreq_t *req); The memreq_t structure is given by: typedef struct memreq_t { u_int CardOffset; page_t Page; } memreq_t; MapMemPage sets the address of card memory that is mapped to the base of a memory window to CardOffset. The window should have been created by a call to RequestWindow. The Page parameter is not implemented in this version and should be set to 0. In turn GetMemPage retrieves the current card address mapping for a memory window. The GetMemPage service was added in release 3.1.0. Return codes: CS_BAD_HANDLE The window handle is invalid. CS_BAD_PAGE The Page value was non-zero. CS_BAD_OFFSET The requested CardOffset was out of range or did not have proper alignment. 33..66.. BBuullkk MMeemmoorryy SSeerrvviicceess Bulk memory services provide a higher level interface for accessing memory regions than that provided by the memory window services. A client using bulk memory calls does not need to know anything about the underlying memory organization or access methods. The device- specific code is packaged into a special Card Services client called a Memory Technology Driver. 33..66..11.. RReeggiisstteerrMMTTDD int CardServices(RegisterMTD, client_handle_t handle, mtd_reg_t *reg); The mtd_reg_t data structure is given by: typedef union mtd_reg_t { u_int Attributes; u_int Offset; u_long MediaID; } mtd_reg_t; RegisterMTD informs Card Services that this client MTD will handle requests for a specified memory region. The Offset field specifies the starting address of the memory region. The following fields are defined in Attributes: REGION_TYPE Either REGION_TYPE_CM for common memory, or REGION_TYPE_AM for attribute memory. The MediaID field is recorded by Card Services, and will be passed to the MTD as part of any request that references this memory region. Once an MTD is bound to a memory region by a call to RegisterMTD, it will remain bound until the MTD calls DeregisterClient. Return codes: CS_BAD_HANDLE The client handle is invalid. CS_BAD_OFFSET Either the offset does not match a valid memory region for this card, or another MTD has already registered for this region. 33..66..22.. GGeettFFiirrssttRReeggiioonn,, GGeettNNeexxttRReeggiioonn int CardServices(GetFirstRegion, client_handle_t handle, region_info_t *region); int CardServices(GetNextRegion, client_handle_t handle, region_info_t *region); The region_info_t data structure is given by: typedef union region_info_t { u_int Attributes; u_int CardOffset; u_int RegionSize; u_int AccessSpeed; u_int BlockSize; u_int PartMultiple; u_char JedecMfr, JedecInfo; memory_handle_t next; } region_info_t; GetFirstRegion and GetNextRegion summarize the information in a card's CISTPL_DEVICE, CISTPL_JEDEC, and CISTPL_DEVICE_GEO tuples. CardOffset gives the starting address of a region. RegionSize gives the length of the region in bytes. AccessSpeed gives the device's cycle time in nanoseconds. BlockSize gives the erase block size in bytes, and PartMultiple gives the minimum granularity of partitions on this device, in units of BlockSize. JedecMfr and JedecInfo give the JEDEC identification bytes for this region. The following fields are defined in Attributes: REGION_TYPE Either REGION_TYPE_CM for common memory, or REGION_TYPE_AM for attribute memory. When these calls are made by an MTD client, only regions that have been bound to this client through calls to BindMTD will be returned. Return codes: CS_BAD_HANDLE The client handle is invalid. CS_NO_MORE_ITEMS No more memory regions are defined. 33..66..33.. OOppeennMMeemmoorryy int CardServices(OpenMemory, client_handle_t *handle, open_mem_t *req); The open_mem_t structure is given by: typedef struct open_mem_t { u_int Attributes; u_int Offset; } open_mem_t; OpenMemory is used to obtain a handle for accessing a memory region via the other bulk memory services. The Offset field specifies the base address of the region to be accessed. If successful, the client handle argument is replaced by the new memory handle. The following fields are defined in Attributes: MEMORY_TYPE Either MEMORY_TYPE_CM for common memory, or MEMORY_TYPE_AM for attribute memory. MEMORY_EXCLUSIVE Specifies that this client should have exclusive access to this memory region. Return codes: CS_BAD_HANDLE The window handle is invalid. CS_BAD_OFFSET Either the offset does not specify a valid region, or the region does not have an associated MTD to service bulk memory requests. 33..66..44.. CClloosseeMMeemmoorryy int CardServices(CloseMemory, memory_handle_t handle); CloseMemory releases a memory handle returned by a previous call to OpenMemory. A client should release all memory handles before calling DeregisterClient. Return codes: CS_BAD_HANDLE The memory handle is invalid. 33..66..55.. RReeaaddMMeemmoorryy,, WWrriitteeMMeemmoorryy int CardServices(ReadMemory, memory_handle_t handle mem_op_t *req, caddr_t buf); int CardServices(WriteMemory, memory_handle_t handle, mem_op_t *req, caddr_t buf); The mem_io_t structure is given by: typedef struct mem_op_t { u_int Attributes; u_int Offset; u_int Count; } mem_op_t; ReadMemory and WriteMemory read from and write to a card memory area defined by the specified memory handle, returned by a previous call to OpenMemory. The Offset field gives the offset of the operation from the start of the card memory region. The Count field gives the number of bytes to be transferred. The buf field points to a host memory buffer to be the destination for a ReadMemory operation, or the source for a WriteMemory operation. The following fields are defined in Attributes: MEM_OP_BUFFER Either MEM_OP_BUFFER_USER if the host buffer is in a user memory segment, or MEM_OP_BUFFER_KERNEL if the host buffer is in kernel memory. MEM_OP_DISABLE_ERASE Specifies that a card area should not be erased before it is written. MEM_OP_VERIFY Specifies verification of write operations. Return codes: CS_BAD_HANDLE The window handle is invalid. CS_BAD_OFFSET The specified card offset is beyond the end of the memory region. CS_BAD_SIZE The specified transfer size extends past the end of the memory region. 33..66..66.. RReeggiisstteerrEErraasseeQQuueeuuee int CardServices(RegisterEraseQueue, client_handle_t *handle, eraseq_hdr_t *header); The eraseq_hdr_t structure is given by: typedef struct erase_queue_header_t { int QueueEntryCount; eraseq_entry_t *QueueEntryArray; } eraseq_hdr_t; This call registers a queue of erase requests with Card Services. An eraseq_handle_t handle will be returned in *handle. When this client calls CheckEraseQueue, Card Services will scan the queue and begin asynchronous processing of any new requests. The eraseq_entry_t structure is given by: typedef struct eraseq_entry_t { memory_handle_t Handle; u_char State; u_int Size; u_int Offset; void *Optional; } eraseq_entry_t; In an erase queue entry, the Header field should be a memory handle returned by a previous call to OpenMemory. The State field indicates the state of the erase request. The following values are defined: ERASE_QUEUED Set by the client to indicate that this is a new request. ERASE_IDLE Set by the client to indicate that this entry is not active. ERASE_PASSED Set by the MTD to indicate successful completion. ERASE_FAILED Set by the MTD to indicate that the erase failed. ERASE_MEDIA_WRPROT Indicates that the region is write protected. ERASE_NOT_ERASABLE Indicates that this region does not support erase operations. ERASE_BAD_OFFSET Indicates that the erase does not start on an erase block boundary. ERASE_BAD_SIZE Indicates that the requested erase size is not a multiple of the erase block size. ERASE_BAD_SOCKET Set by the MTD to indicate that there is no card present. Additionally, the macro ERASE_IN_PROGRESS() will return a true condition for values of State that indicate an erase is being processed. The Size field gives the size of the erase request in bytes. The Offset field gives the offset from the start of the region. The size and offset should be aligned to erase block boundaries. The Optional field is not used by Card Services and may be used by the client driver. Return codes: CS_BAD_HANDLE The client handle is invalid. 33..66..77.. DDeerreeggiisstteerrEErraasseeQQuueeuuee int CardServices(DeregisterEraseQueue, eraseq_handle_t handle); DeregisterEraseQueue frees a queue previously registered by a call to RegisterEraseQueue. If there are any pending requests in the specified queue, the call will fail. Return codes: CS_BAD_HANDLE The erase queue handle is invalid. CS_BUSY The erase queue has erase requests pending. 33..66..88.. CChheecckkEErraasseeQQuueeuuee int CardServices(CheckEraseQueue, eraseq_handle_t handle); This call notifies Card Services that there are new erase requests in a queue previously registered with RegisterEraseQueue. Typically, a client will initially assign each erase queue entry the state value ERASE_IDLE. When new requests are added to the queue, the client will set their states to ERASE_QUEUED, and call CheckEraseQueue. When the client is notified of an erase completion event, it will check the state field to determine whether the request was successful. Return codes: CS_BAD_HANDLE The erase queue handle is invalid. 33..77.. MMiisscceellllaanneeoouuss ccaallllss 33..77..11.. GGeettCCaarrddSSeerrvviicceessIInnffoo int CardServices(GetCardServicesInfo, servinfo_t *info); The servinfo_t structure is given by: typedef struct servinfo_t { char Signature[2]; u_int Count; u_int Revision; u_int CSLevel; char *VendorString; } servinfo_t; GetCardServicesInfo returns revision information about this version of Card Services. Signature is set to ``CS''. Count is set to the number of sockets currently configured. Revision is set to the revision level of the Card Services package, and CSLevel is set to the level of compliance with the PC Card standard. These are encod
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -