Exemple #1
0
u32 flash_write_buffer(void *src, void *dst, int cnt, int portwidth)
{
	u32 retval = 0;

	if (portwidth != FLASH_CFI_16BIT) {
		retval = ERR_INVAL;
		goto out;
	}

	memcpy((void*)SOC_RAM_BUFFER_BASE, (void*)src, cnt * portwidth);

	stop_ram();
	__asm__ __volatile__("": : :"memory");

	src = (void*) SOC_RAM_BUFFER_BASE;

	while(cnt-- > 0) {
		copy_one(src, dst);
		src += 2, dst += 2;
		NOP10();
		NOP10();
	}

	__asm__ __volatile__("": : :"memory");
	start_ram();
out:
	return retval;
}
Exemple #2
0
gboolean
exec()
{
    list_iterator_t<fileset_t> iter;
    
    result_ = TRUE;
    ncopied_ = 0;
    
    exp_todir_ = expand(todir_);

    if (file_ != 0)
    {
    	string_var expfile = expand(file_);
    	copy_one(expfile, this);
    }

    /* execute for <fileset> children */
    
    for (iter = filesets_.first() ; iter != 0 ; ++iter)
	(*iter)->apply(project_->properties(), copy_one, this);
    
    exp_todir_ = (char*)0;

    return result_;
}
/** Copy a complete message, not keeping the header chain structure.
 *
 * @retval 0 when successful
 * @retval -1 upon an error
 */
static
int msg_dup_or_copy_all(msg_t *msg,
			msg_t const *original,
			msg_header_t *(*copy_one)(su_home_t *h,
						  msg_header_t const *))
{
  su_home_t *home = msg_home(msg);
  msg_pub_t *dst = msg->m_object;

  msg_pub_t const *src = original->m_object;
  msg_header_t * const *ssh;
  msg_header_t * const *end;
  msg_header_t const *sh;
  msg_header_t **hh;

  msg_header_t *h;

  assert(copy_one);

  end = (msg_header_t**)((char *)src + src->msg_size);

  for (ssh = &src->msg_request; ssh < end; ssh++) {
    sh = *ssh;
    if (!sh)
      continue;

    hh = msg_hclass_offset(msg->m_class, dst, sh->sh_class);
    if (hh == NULL)
	return -1;

    for (; sh; sh = sh->sh_next) {
      h = copy_one(home, sh);
      if (h == NULL)
	return -1;

      if (*hh) {
	/* If there is multiple instances of single headers,
	   put the extra headers into the list of erroneous headers */
	if (msg_is_single(h)) {
	  msg_error_t **e;
	  for (e = &dst->msg_error; *e; e = &(*e)->er_next)
	    ;
	  *e = (msg_error_t *)h;
	  continue;
	}

	while (*hh)
	  hh = &(*hh)->sh_next;
      }
      *hh = h;

      if (msg_is_list(sh))
	/* Copy only first list entry */
	break;
    }
  }

  return 0;
}