Exemplo n.º 1
0
void brw_aub_gtt_data( struct brw_aubfile *aubfile,
		       unsigned offset,
		       const void *data,
		       unsigned sz,
		       unsigned type,
		       unsigned state_type )
{
   struct aub_block_header bh;

   bh.instruction_type = AUB_BLOCK_HEADER;
   bh.operation = BH_DATA_WRITE;
   bh.type = type;
   bh.address_space = ADDR_GTT;
   bh.pad0 = 0;

   if (type == DW_GENERAL_STATE) {
      bh.general_state_type = state_type;
      bh.surface_state_type = 0;
   }
   else {
      bh.general_state_type = 0;
      bh.surface_state_type = state_type;
   }

   bh.pad1 = 0;
   bh.address = offset;
   bh.length = sz;

   write_block_header(aubfile->file, &bh, data, sz);
}
Exemplo n.º 2
0
static int write_elem_block(snd_tplg_t *tplg,
	struct list_head *base, int size, int tplg_type, const char *obj_name)
{
	struct list_head *pos, *npos;
	struct tplg_elem *elem;
	int ret, wsize = 0, count = 0;

	/* count number of elements */
	list_for_each_safe(pos, npos, base)
		count++;

	/* write the header for this block */
	ret = write_block_header(tplg, tplg_type, 0,
		SND_SOC_TPLG_ABI_VERSION, 0, size, count);
	if (ret < 0) {
		fprintf(stderr, "error: failed to write %s block %d\n",
			obj_name, ret);
		return ret;
	}

	/* write each elem to block */
	list_for_each_safe(pos, npos, base) {

		elem = list_entry(pos, struct tplg_elem, list);

		/* compound elems have already been copied to other elems */
		if (elem->compound_elem)
			continue;

		if (elem->type != PARSER_TYPE_DAPM_GRAPH)
			verbose(tplg, " %s '%s': write %d bytes\n",
				obj_name, elem->id, elem->size);
		else
			verbose(tplg, " %s '%s': write %d bytes\n",
				obj_name, elem->route->source, elem->size);

		count = write(tplg->out_fd, elem->obj, elem->size);
		if (count < 0) {		
			fprintf(stderr, "error: failed to write %s %d\n",
				obj_name, ret);
			return ret;		
		}

		wsize += count;
	}
Exemplo n.º 3
0
void brw_aub_gtt_cmds( struct brw_aubfile *aubfile,
		       unsigned offset,
		       const void *data,
		       unsigned sz )
{
   struct aub_block_header bh;   
   unsigned type = CW_PRIMARY_RING_A;
   

   bh.instruction_type = AUB_BLOCK_HEADER;
   bh.operation = BH_COMMAND_WRITE;
   bh.type = type;
   bh.address_space = ADDR_GTT;
   bh.pad0 = 0;
   bh.general_state_type = 0;
   bh.surface_state_type = 0;
   bh.pad1 = 0;
   bh.address = offset;
   bh.length = sz;

   write_block_header(aubfile->file, &bh, data, sz);
}
Exemplo n.º 4
0
const char * Nes_File_Writer::write_block( nes_tag_t tag, void const* data, long size )
{
	RETURN_ERR( write_block_header( tag, size ) );
	return write( data, size );
}