Ejemplo n.º 1
0
static void setup_erase_request(client_handle_t handle, eraseq_entry_t *erase)
{
    erase_busy_t *busy;
    region_info_t *info;
    
    if (CHECK_REGION(erase->Handle))
	erase->State = ERASE_BAD_SOCKET;
    else {
	info = &erase->Handle->info;
	if ((erase->Offset >= info->RegionSize) ||
	    (erase->Offset & (info->BlockSize-1)))
	    erase->State = ERASE_BAD_OFFSET;
	else if ((erase->Offset+erase->Size > info->RegionSize) ||
		 (erase->Size & (info->BlockSize-1)))
	    erase->State = ERASE_BAD_SIZE;
	else {
	    erase->State = 1;
	    busy = kmalloc(sizeof(erase_busy_t), GFP_KERNEL);
	    busy->erase = erase;
	    busy->client = handle;
	    init_timer(&busy->timeout);
	    busy->timeout.data = (u_long)busy;
	    busy->timeout.function = &handle_erase_timeout;
	    busy->prev = busy->next = NULL;
	    retry_erase(busy, 0);
	}
    }
} /* setup_erase_request */
Ejemplo n.º 2
0
int pcmcia_close_memory(memory_handle_t handle)
{
    DEBUG(1, "cs: close_memory(0x%p)\n", handle);
    if (CHECK_REGION(handle))
	return CS_BAD_HANDLE;
    return CS_SUCCESS;
} /* close_memory */
Ejemplo n.º 3
0
int ipm_control(const int ctl, char *cmd, void *data) 
{
  char *reg;
  
  switch( ctl ) 
    {
    case 1:   /* enter region, IPM1 compatible */
      CHECK_REGION(reg, cmd);
      if(reg) 
	ipm_region(1, reg);
      break;
      
    case -1:  /* exit region, IPM1 compatible */
      if(reg) 
	CHECK_REGION(reg, cmd);
      ipm_region(-1, reg);
      break;
      
      /* general case */
    case 0:
    default:
      if( !strncmp(cmd, "enter", 5) ) {
	CHECK_REGION(reg, data);
	if(reg)
	  ipm_region(1, reg);
      }
      
      if( !strncmp(cmd, "exit", 4) ) {
	CHECK_REGION(reg, data);
	if(reg)
	  ipm_region(-1, reg);
      }  

#ifdef HAVE_POSIXIO_TRACE
      if( !strncmp(cmd, "traceoff", 8) )
	task.tracestate = 0;
      if( !strncmp(cmd, "traceon", 7) )
	task.tracestate = 1;
#endif  
    }
  
  return 0;
}
Ejemplo n.º 4
0
int close_memory(memory_handle_t handle)
{
    DEBUG(1, "cs: close_memory(0x%p)\n", handle);
    if (CHECK_REGION(handle))
	return CS_BAD_HANDLE;
#ifdef __BEOS__
    if (handle->dev_info[0] != '\0') {
	char n[80];
	sprintf(n, MTD_MODULE_NAME("%s"), handle->dev_info);
	put_module(n);
    }
#endif
    return CS_SUCCESS;
} /* close_memory */
Ejemplo n.º 5
0
int write_memory(memory_handle_t handle, mem_op_t *req, caddr_t buf)
{
    mtd_request_t mtd;
    if (CHECK_REGION(handle))
	return CS_BAD_HANDLE;
    if (req->Offset >= handle->info.RegionSize)
	return CS_BAD_OFFSET;
    if (req->Offset+req->Count > handle->info.RegionSize)
	return CS_BAD_SIZE;
    
    mtd.DestCardOffset = req->Offset + handle->info.CardOffset;
    mtd.TransferLength = req->Count;
    mtd.MediaID = handle->MediaID;
    mtd.Function = MTD_REQ_WRITE;
    if (req->Attributes & MEM_OP_BUFFER_KERNEL)
	mtd.Function |= MTD_REQ_KERNEL;
    return do_mtd_request(handle, &mtd, buf);
} /* write_memory */
Ejemplo n.º 6
0
int copy_memory(memory_handle_t handle, copy_op_t *req)
{
    if (CHECK_REGION(handle))
	return CS_BAD_HANDLE;
    return CS_UNSUPPORTED_FUNCTION;
}