OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgcc/] [config/] [spu/] [mfc_tag_release.c] - Blame information for rev 734

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 734 jeremybenn
/* Copyright (C) 2007, 2009 Free Software Foundation, Inc.
2
 
3
This file is part of GCC.
4
 
5
GCC is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free
7
Software Foundation; either version 3, or (at your option) any later
8
version.
9
 
10
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11
WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13
for more details.
14
 
15
Under Section 7 of GPL version 3, you are granted additional
16
permissions described in the GCC Runtime Library Exception, version
17
3.1, as published by the Free Software Foundation.
18
 
19
You should have received a copy of the GNU General Public License and
20
a copy of the GCC Runtime Library Exception along with this program;
21
see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
22
<http://www.gnu.org/licenses/>.  */
23
 
24
#include <spu_mfcio.h>
25
extern vector unsigned int __mfc_tag_table;
26
 
27
/* Release the specified DMA tag from exclusive use.  Once released, the
28
   tag is available for future reservation.  Upon sucessful release,
29
   MFC_DMA_TAG_VALID is returned.  If the specified tag is not in the
30
   range 0 to 31, or had not been reserved, no action is taken and
31
   MFC_DMA_TAG_INVALID is returned.  */
32
 
33
unsigned int
34
__mfc_tag_release (unsigned int tag)
35
{
36
  vector unsigned int is_invalid;
37
  vector unsigned int mask = (vector unsigned int)
38
        { 0x80000000, 0x80000000, 0x80000000, 0x80000000 };
39
  vector signed int zero = (vector signed int) { 0, 0, 0, 0 };
40
 
41
  vector signed int has_been_reserved;
42
 
43
  /* Check if the tag is out of range.  */
44
  is_invalid = spu_cmpgt (spu_promote (tag, 0), 31);
45
 
46
  /* Check whether the tag has been reserved, set to all 1 if has not
47
     been reserved, 0 otherwise.  */
48
  has_been_reserved = (vector signed int) spu_rl (__mfc_tag_table, tag);
49
  has_been_reserved = (vector signed int) spu_cmpgt (zero, has_been_reserved);
50
 
51
  /* Set invalid.  */
52
  is_invalid = spu_or ((vector unsigned int) has_been_reserved, is_invalid);
53
 
54
  mask = spu_rlmask (mask, (int)(-tag));
55
  __mfc_tag_table = spu_or (__mfc_tag_table, mask);
56
 
57
  return spu_extract(is_invalid, 0);
58
}
59
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.