Exemple #1
0
int data_transfer(int dev,int block,int size,unsigned char *data,int cmd) { 
  struct device *device;
  int err = -1;
  device = get_dev(dev);
  if(! device ) { 
    printf("device %d not found in function %s,line %d\n",dev,__FUNCTION__,__LINE__);
    goto out;
  }
  err = do_data_transfer(device,block,size,data,cmd);
 out:
  return err;
}
Exemple #2
0
int data_transfer_name(const char *dev_name,int block,int size,unsigned char *data,int cmd) { 
  struct device *device;
  int err = -1;
  device = get_dev_by_name(dev_name);
  if(! device ) {
    printf("device %s not found in Function %s,Line %d\n",dev_name,__FUNCTION__,__LINE__);
    goto out;
  }
  err = do_data_transfer(device,block,size,data,cmd);
 out:
  return err;
}
static int host_request(struct mmc *dev,
			struct mmc_cmd *cmd,
			struct mmc_data *data)
{
	int result;

	if (data)
		result = do_data_transfer(dev, cmd, data);
	else
		result = do_command(dev, cmd);

	return result;
}
Exemple #4
0
static int read_fatsb (struct mountpoint *mp) {
    bpb *bootparam;
    int err = -1;
    int major;
    if(! mp->dev) {
        goto out;
    }
    major = MAJOR(mp->dev->dev);
    bootparam = (void *)slab_alloc (sizeof(bpb), 0);
    do_data_transfer(mp->dev,0,blkdev[major].block_size,(unsigned char *)bootparam, READ);
    printf ("FAT12: SuperBlock read\n");
    mp->fs->fssb.blocksize = bootparam->sec_clu * bootparam->bytes_sec;
    mp->fs->fssb.root_inode = bootparam->no_fats*bootparam->fat_sectors + bootparam->rsvd_sec;
    mp->fs->fssb.root_size = bootparam->no_root;
    mp->fs->fssb.spc_fs = bootparam;
    err = 0;
out:
    return err;
}