Exemplo n.º 1
0
int omap_transfer_posn_alsa_sound_dma(struct audio_stream *s)
{
	int mode = s->stream_id;
	int ret = 0;
	int fi, ei;

	/* We always ask only one frame to transmit/recieve,
	 * variant is the element num
	 */
	if (mode == SNDRV_PCM_STREAM_CAPTURE) {
		ret = omap2_mcbsp_receiver_index(AUDIO_MCBSP,
						&ei, &fi);
		ret = ei * element_size(twl4030_mcbsp_settings.
			audio_mcbsp_rx_transfer_params.word_length1);
	} else {
		ret = omap2_mcbsp_transmitter_index(AUDIO_MCBSP,
						&ei, &fi);
		ret = ei * element_size(twl4030_mcbsp_settings.
			audio_mcbsp_tx_transfer_params.word_length1);
	}
	if (ret < 0)
		printk(KERN_ERR
		       "twl4030_transfer_posn: Unable to find index of "
		       "transfer\n");
	return ret;
}
Exemplo n.º 2
0
SwigType *SwigType_del_array(SwigType *t) {
  char *c = Char(t);
  int check = strncmp(c, "a(", 2);
  assert(check == 0);
  Delslice(t, 0, element_size(c));
  return t;
}
Exemplo n.º 3
0
element* table_remove(BlockInfo* pRoot, BlockInfo* pBlock) {
  MY_PRINTF("  table remove\n");
  element* pCur = pRoot;
  MY_ASSERT(table_search(pRoot, element_size(pBlock)) != NULL);
  if (pCur == pBlock) {
    //pCur->child
    //pSib
    if (element_child(pCur)) {
      element* pSib = element_sibling(pCur);
      pCur = element_child(pCur);
      element_sibling(pCur) = pSib;
    }
    else {
      pCur = element_sibling(pCur);
    }
  }
  else if (element_size(pCur) == element_size(pBlock)) {
    MY_ASSERT(pCur != pBlock);
    MY_ASSERT(element_child(pCur) != NULL);
    element_child(pCur) = child_remove(element_child(pCur), pBlock);
  }
  else if (element_size(pCur) < element_size(pBlock)) {
    MY_ASSERT(element_sibling(pCur) != NULL);
    element_sibling(pCur) = table_remove(element_sibling(pCur), pBlock);
  }
  else {
    MY_ASSERT(element_size(pCur) > element_size(pBlock));
    MY_ASSERT(0);
  }
  return pCur;
};
Exemplo n.º 4
0
SwigType *SwigType_add_qualifier(SwigType *t, const_String_or_char_ptr qual) {
  String *newq;
  int sz, added = 0;
  char *q, *cqual;

  char *c = Char(t);
  cqual = Char(qual);

  if (!(strncmp(c, "q(", 2) == 0)) {
    String *temp = NewStringf("q(%s).", cqual);
    Insert(t, 0, temp);
    Delete(temp);
    return t;
  }

  /* The type already has a qualifier on it.  In this case, we first check to
     see if the qualifier is already specified.  In that case do nothing.
     If it is a new qualifier, we add it to the qualifier list in alphabetical
     order */

  sz = element_size(c);

  if (strstr(c, cqual)) {
    /* Qualifier already added */
    return t;
  }

  /* Add the qualifier to the existing list. */

  newq = NewString("q(");
  q = c + 2;
  q = strtok(q, " ).");
  while (q) {
    if (strcmp(cqual, q) < 0) {
      /* New qualifier is less that current qualifier.  We need to insert it */
      Append(newq, cqual);
      Append(newq, " ");
      Append(newq, q);
      added = 1;
    } else {
      Append(newq, q);
    }
    q = strtok(NULL, " ).");
    if (q) {
      Append(newq, " ");
    }
  }
  if (!added) {
    Append(newq, " ");
    Append(newq, cqual);
  }
  Append(newq, ").");
  Delslice(t, 0, sz);
  Insert(t, 0, newq);
  Delete(newq);
  return t;
}
Exemplo n.º 5
0
//if found return block,
//else return NULL
element* table_search(element* pRoot, size_t reqSize) {
  element* pCur;
  for (pCur = pRoot; pCur != NULL; pCur = element_sibling(pCur)) {
    if (element_size(pCur) >= reqSize) {
      return pCur;
    }
  }
  return NULL;
};
Exemplo n.º 6
0
SwigType *SwigType_add_qualifier(SwigType *t, const String_or_char *qual) {
  char temp[256], newq[256];
  int sz, added = 0;
  char *q, *cqual;

  char *c = Char(t);
  cqual = Char(qual);

  if (!(strncmp(c, "q(", 2) == 0)) {
    sprintf(temp, "q(%s).", cqual);
    Insert(t, 0, temp);
    return t;
  }

  /* The type already has a qualifier on it.  In this case, we first check to
     see if the qualifier is already specified.  In that case do nothing.
     If it is a new qualifier, we add it to the qualifier list in alphabetical
     order */

  sz = element_size(c);
  strncpy(temp, c, (sz < 256) ? sz : 256);

  if (strstr(temp, cqual)) {
    /* Qualifier already added */
    return t;
  }

  /* Add the qualifier to the existing list. */

  strcpy(newq, "q(");
  q = temp + 2;
  q = strtok(q, " ).");
  while (q) {
    if (strcmp(cqual, q) < 0) {
      /* New qualifier is less that current qualifier.  We need to insert it */
      strcat(newq, cqual);
      strcat(newq, " ");
      strcat(newq, q);
      added = 1;
    } else {
      strcat(newq, q);
    }
    q = strtok(NULL, " ).");
    if (q) {
      strcat(newq, " ");
    }
  }
  if (!added) {
    strcat(newq, " ");
    strcat(newq, cqual);
  }
  strcat(newq, ").");
  Delslice(t, 0, sz);
  Insert(t, 0, newq);
  return t;
}
Exemplo n.º 7
0
Arquivo: axGrid.cpp Projeto: EQ4/axLib
void axGrid::OnPaint()
{
	axGC* gc = GetGC();
	axRect rect(GetRect());
	axRect rect0(axPoint(0, 0), rect.size);

	gc->SetColor(_info.normal, 1.0);
	gc->DrawRectangle(rect0);

	gc->SetColor(_info.contour, 1.0);

	int y = 0;
	glLineWidth(1.0);
	for(int j = 0; j <= _dimension.y; j++)
	{
		int y = (double(j) / _dimension.y) * rect.size.y;
		gc->DrawLine(axPoint(0, y), axPoint(rect.size.x, y));
	}

	int x = 0;
	for(int i = 0; i <= _dimension.x; i++)
	{
		int x = (double(i) / _dimension.x) * rect.size.x;
		gc->DrawLine(axPoint(x, 0), axPoint(x, rect.size.y));
	}

	axSize element_size(1.0 / _dimension.x * rect.size.x - 1, 
						1.0 / _dimension.y * rect.size.y - 1);
	for(int j = 0;j < _dimension.y; j++)
	{
		for(int i = 0; i < _dimension.x; i++)
		{
			if(_gridElements[j][i].on)
			{
				gc->SetColor(_gridElements[j][i].color);

				axSize elem_size(floor((double(i+1)/ _dimension.x * rect.size.x)) - 
								 floor((double(i) / _dimension.x * rect.size.x)) - 1,
								1.0 / _dimension.y * rect.size.y - 1);
				gc->DrawRectangle(axRect(_gridElements[j][i].position, elem_size));
			}
		}
	}



	//_selectedElement
	gc->SetColor(axColor(0.0, 0.0, 1.0));
	//glLineWidth(4.0);
	gc->DrawRectangleContour(axRect(GetPositionOfElement(_selectedElement), element_size), 2);

	// glLineWidth(1.0);

	// gc->DrawCircle(axPoint(50, 50), 10, 500);

}
Exemplo n.º 8
0
element* child_remove(BlockInfo* pFirst, BlockInfo* pBlock) {
  MY_PRINTF("  child remove %p %lx %p %lx\n", pFirst, element_size(pFirst), pBlock, element_size(pBlock));
  BlockInfo* pPrev = NULL;
  BlockInfo* pCur;
  for (pCur = pFirst; pCur != NULL; pCur = element_child(pCur)) {
    if (pCur == pBlock) {
      break;
    }
    pPrev = pCur;
  }
  MY_ASSERT(pCur != NULL);
  if (pPrev != NULL) {
    MY_ASSERT(pBlock != pFirst);
    element_child(pPrev) = element_child(pCur);
    return pFirst;
  }
  MY_ASSERT(pBlock == pFirst);
  return element_child(pCur);
}
Exemplo n.º 9
0
//return new pRoot
element* table_insert(element* pRoot, element* pBlock) {
  element* pCur = pRoot;
  if (element_size(pCur) == element_size(pBlock)) {
    //pCur->pBlock->pChild
    element_child(pBlock) = element_child(pCur);
    element_child(pCur) = pBlock;
  }
  else if (element_size(pCur) > element_size(pBlock)) {
    //pBlock
    //pCur
    element_sibling(pBlock) = pCur;
    pCur = pBlock;
  }
  else {
    //pCur
    //pBlock
    MY_ASSERT(element_size(pCur) < element_size(pBlock));
    if (element_sibling(pCur) != NULL) {
      element_sibling(pCur) = table_insert(element_sibling(pCur), pBlock);
    }
    else {
      element_sibling(pCur) = pBlock;
    }
  }
  return pCur;
};
Exemplo n.º 10
0
        void vbuffer_base::bind()
        {
            if (!opengl_id)
                load();

            if (last_bound_buffer == opengl_id)
                return;

            glBindBuffer(target, opengl_id);                                                                        CHECK_GL_ERRORS();

            // update the video card if the buffer is dirty
            if (buffer_size() != prev_size)
            {
                glBufferData(target, buffer_size() * element_size(), get_ptr(), gl_mode);                                                   CHECK_GL_ERRORS();
                prev_size = buffer_size();
            }
            else if (lowest_dirty_index != INT_MAX || highest_dirty_index != -1)
            {
                if (lowest_dirty_index == INT_MAX)
                    lowest_dirty_index = 0;
                if (highest_dirty_index == -1)
                    highest_dirty_index = buffer_size()-1;

                if (gl_mode == GL_STATIC_DRAW)
                {
                    glBufferData(target, prev_size, get_ptr(), gl_mode);                                                                   CHECK_GL_ERRORS();
                }
                else
                {
                    glBufferSubData(target, 
                                    lowest_dirty_index * element_size(), 
                                    ((highest_dirty_index - lowest_dirty_index)+1) * element_size(), 
                                    ((char *)get_ptr()) + (lowest_dirty_index * element_size()));                                       CHECK_GL_ERRORS();
                }
            }

            highest_dirty_index = -1;
            lowest_dirty_index = INT_MAX;
        } // vbuffer_base::bind()
Exemplo n.º 11
0
int table_printf(BlockInfo* pRoot)
{
  MY_PRINTF("\n");
  if (pRoot == NULL) return 0;

  BlockInfo* pCur = pRoot;
  int count = 0;
  for (; pCur != NULL; pCur = element_child(pCur)) {
    MY_PRINTF("+%2x(%3lx)   ", element_key(pCur), element_size(pCur));
    count++;
  }
  MY_PRINTF("\n");
  count += table_printf(element_sibling(pRoot));
  return count;
}
Exemplo n.º 12
0
SwigType *SwigType_pop(SwigType *t) {
  SwigType *result;
  char *c;
  int sz;

  c = Char(t);
  if (!*c)
    return 0;

  sz = element_size(c);
  result = NewStringWithSize(c, sz);
  Delslice(t, 0, sz);
  c = Char(t);
  if (*c == '.') {
    Delitem(t, 0);
  }
  return result;
}
Exemplo n.º 13
0
List *SwigType_split(SwigType *t) {
  DOH     *item;
  List    *list;
  char    *c;
  int      len;

  c = Char(t);
  list = NewList();
  while (*c) {
    len = element_size(c);
    item = NewStringWithSize(c,len);
    Append(list,item);
    Delete(item);
    c = c + len;
    if (*c == '.') c++;
  }
  return list;
}
Exemplo n.º 14
0
void
SwigType_del_memberpointer(SwigType *t) {
  char *c = Char(t);
  assert(strncmp(c,"m(",2) == 0);
  Delslice(t,0,element_size(c));
}
Exemplo n.º 15
0
SwigType *SwigType_del_element(SwigType *t) {
  int sz = element_size(Char(t));
  Delslice(t, 0, sz);
  return t;
}
Exemplo n.º 16
0
size_t Attribute::buffer_size(int numverts, int numtris)
{
	return element_size(numverts, numtris)*data_sizeof();
}
Exemplo n.º 17
0
INLINE Real real_element_size(Few<Vector<dim>, dim + 1> p) {
  auto b = simplex_basis<dim, dim>(p);
  return element_size(b);
}
Exemplo n.º 18
0
size_t Attribute::buffer_size(int numverts, int numtris, int numcurves, int numkeys) const
{
	return element_size(numverts, numtris, numcurves, numkeys)*data_sizeof();
}
Exemplo n.º 19
0
 std::size_t size() const { return buffer_size_ / element_size(); }
Exemplo n.º 20
0
size_t Attribute::buffer_size(Mesh *mesh, AttributePrimitive prim) const
{
	return element_size(mesh, prim)*data_sizeof();
}
Exemplo n.º 21
0
int element_cmp(element* left, element *right) {
  size_t rc = element_size(left) - element_size(right);
  return (int)rc;
}
Exemplo n.º 22
0
void
SwigType_del_array(SwigType *t) {
  char *c = Char(t);
  assert(strncmp(c,"a(",2) == 0);
  Delslice(t,0,element_size(c));
}
Exemplo n.º 23
0
void
SwigType_del_qualifier(SwigType *t) {
  char *c = Char(t);
  assert(strncmp(c,"q(",2) == 0);
  Delslice(t,0,element_size(t));
}