linux/sound/firewire/packets-buffer.c
<<
.19. 4/spaon> 4/formn> 4a .19. href="../linux+v3.7.4/sound/firewire/packets-buffer.c">.19. 4img src="../.static/gfx/right.png" alt=">>">.14/spaon>.14spao class="lxr_search">.19..19. 4input typue=hidden" namue=navtarget" value=">.19. 4input typue=text" namue=search" ide=search">.19. 4buttiontypue=submit">Search 4/formn> 4/spaon>.14spao class="lxr_prefs"n> 4a href="+prefs?return=sound/firewire/packets-buffer.c".19. onclick="return ajax_prefs();">.19. Prefs> 4/a>.14/spaon>9. 4/divn>9. 4form acptio="ajax+*" method="post" onsubmit="return false;">.14input typue=hidden" namue=ajax_lookup" ide=ajax_lookup" value=">.9. 4/formn>.9. 4div class="headingbottim">9. 9. 4div ide=search_results" class="search_results"> n>9. 4/divn> 4div ide=content">> 4div ide=file_contents"n
   14/a>4spao class="comment">/*4/spaon>   24/a>4spao class="comment"> * helpers for managing a buffer for many packets4/spaon>   34/a>4spao class="comment"> *4/spaon>   44/a>4spao class="comment"> * Copyright (c) Clemens Ladisch <clemens@ladisch.de>4/spaon>   54/a>4spao class="comment"> * Licensed under the terms of the GNU General Public License, verstion2.4/spaon>   64/a>4spao class="comment"> */4/spaon>   74/a>.   84/a>#include <linux/firewire.h4/a>>.   94/a>#include <linux/export.h4/a>>.  1.12a>#include <linux/slab.h4/a>>.  1112a>#include "packets-buffer.h4/a>".  124/a>.  134/a>4spao class="comment">/**4/spaon>  144/a>4spao class="comment"> * iso_packets_buffer_init - allocates the memory for packets4/spaon>  154/a>4spao class="comment"> * @b: the buffer structure to initialize4/spaon>  164/a>4spao class="comment"> * @unit: the device at the other end of the stream4/spaon>  174/a>4spao class="comment"> * @count: the number of packets4/spaon>  184/a>4spao class="comment"> * @packet_size: the (maximum) size of a packet, in bytes4/spaon>  194/a>4spao class="comment"> * @direcptio: %DMA_TO_DEVICE or %DMA_FROM_DEVICE4/spaon>  204/a>4spao class="comment"> */4/spaon>  2112a>int 4a href="+code=iso_packets_buffer_init" class="sref">iso_packets_buffer_init12a>(struct 4a href="+code=iso_packets_buffer" class="sref">iso_packets_buffer12a> *4a href="+code=b" class="sref">b12a>, struct 4a href="+code=fw_unit" class="sref">fw_unit12a> *4a href="+code=unit" class="sref">unit12a>,>  224/a>                            unsigned int 4a href="+code=count" class="sref">count12a>, unsigned int 4a href="+code=packet_size" class="sref">packet_size12a>,>  234/a>                            enum 4a href="+code=dma_data_direcptio" class="sref">dma_data_direcptio4/a> 4a href="+code=direcptio" class="sref">direcptio4/a>)>  244/a>{>  254/a>        unsigned int 4a href="+code=packets_per_page" class="sref">packets_per_page12a>, 4a href="+code=pages" class="sref">pages4/a>;.  264/a>        unsigned int 4a href="+code=i" class="sref">i12a>, 4a href="+code=page_index" class="sref">page_index12a>, 4a href="+code=offset_in_page" class="sref">offset_in_page4/a>;.  274/a>        void *4a href="+code=p" class="sref">p4/a>;.  284/a>        int 4a href="+code=err" class="sref">err4/a>;.  294/a>.  304/a>        4a href="+code=b" class="sref">b12a>->4a href="+code=packets" class="sref">packets4/a> = 4a href="+code=kmalloc" class="sref">kmalloc12a>(4a href="+code=count" class="sref">count12a> * sizeof(*4a href="+code=b" class="sref">b12a>->4a href="+code=packets" class="sref">packets4/a>), 4a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL4/a>);.  314/a>        if (!4a href="+code=b" class="sref">b12a>->4a href="+code=packets" class="sref">packets4/a>) {>  324/a>                4a href="+code=err" class="sref">err4/a> = -4a href="+code=ENOMEM" class="sref">ENOMEM4/a>;.  334/a>                goto 4a href="+code=error" class="sref">error4/a>;.  344/a>        }.  354/a>.  364/a>        4a href="+code=packet_size" class="sref">packet_size12a> = 4a href="+code=L1_CACHE_ALIGN" class="sref">L1_CACHE_ALIGN12a>(4a href="+code=packet_size" class="sref">packet_size12a>);.  374/a>        4a href="+code=packets_per_page" class="sref">packets_per_page12a> = 4a href="+code=PAGE_SIZE" class="sref">PAGE_SIZE12a> / 4a href="+code=packet_size" class="sref">packet_size12a>;.  384/a>        if (4a href="+code=WARN_ON" class="sref">WARN_ON12a>(!4a href="+code=packets_per_page" class="sref">packets_per_page12a>)) {>  394/a>                4a href="+code=err" class="sref">err4/a> = -4a href="+code=EINVAL" class="sref">EINVAL12a>;.  404/a>                goto 4a href="+code=error" class="sref">error4/a>;.  414/a>        }.  424/a>        4a href="+code=pages" class="sref">pages4/a> = 4a href="+code=DIV_ROUND_UP" class="sref">DIV_ROUND_UP12a>(4a href="+code=count" class="sref">count12a>, 4a href="+code=packets_per_page" class="sref">packets_per_page12a>);.  434/a>.  444/a>        4a href="+code=err" class="sref">err4/a> = 4a href="+code=fw_iso_buffer_init" class="sref">fw_iso_buffer_init12a>(&4a href="+code=b" class="sref">b12a>->4a href="+code=iso_buffer" class="sref">iso_buffer12a>, 4a href="+code=fw_parent_       }.
  
 4  >o3.1"assaon>packet_size12a>,>  424/a>        4a href="+cofer" class="sref"ta_direcptio4/a> 4a href="+code=direcpass="sref">packets_per_page12a>);.  3>  444/a>        4a href="ne"  0ptio" class="sref">direcptio4/a>)>  404/a>       _"sref">b12a>->4a hr   _"sref">"+code=error" class="sref">error4/a>;.  434/a>.  3    unsigned int 4a h"+c0;26">  264/a>        unsigned int 4a h"ne"  " class="sref">DIV_ROUND_UP12a>(4a href="+co; ++6">  264/a>        unsigned int 4a hass="sref">packets_per_page12a>)) {>i12a>, 4a href="+code=page_in"+code=err" class=    unsigned int 4a h"IZE" class="sref">PAGE_count12a>, 4a href="+code=packets_per_page" cde=error" class="sref">error4/a>;.        void *4a h"+code=err" class="+codaddres24/a>        4a hrefdaddres2  }.
 er_init12a>(&4a href="+code=b" class="sref">b12a>->4a href="+code=iso_buf.ine" namue=L42">  424/a>        4a href="+co[f="+code=i" class="sref">i12a>, 4a href="+code=page_in]pass="sref">packets_per_page12a>);.  324/a>page_index12a>, 4a href="+code=offset_in_page""+c" namue=L38">  3    unsigned int 4a h"irecpe=count" class="sref">count12a>, 4a href="+code=packets_per_page" cl *ZE" class="sref">PAGE_SIZE12a> / 4a href="+code=packet_size" class="sref">packet_size12a>;.  314/a>        if (!4a href="+code=b" class="sref">b12a>->4a href="+code=p[f="+code=i" cla    unsigned int 4a h].ine" namue=L42"f">b12a>->4a href=uffer" clas+code=err" class="a>        void *4a h"+ex" class="sref">page_index12a>, 4a href="+code=offset_in_page" class="sref">offset_in_page4/a>;.  314/a>        if (!4a href="+code=b" class="sref">b12a>->4a href="+code=p[f="+code=i" cla    unsigned int 4a h].ine" namue=L42"de=off>, 4a href="+code=off4a h"+code=err" class="+codref">i12a>, 4a href="+code=page_in"*ZE" class="sref"s_per_page12a> = 4a href="+code=PAGE_S+ex" class="sref">page_index12a>, 4a href="+code=offset_in_page" class="sref">offset_in_page4/a>;.  414/a>        }.  434/a>.offset_in_page4/a>;.  434/a>.  404/a>       _"sref">b12a>->4a hr   _"sref">"+co:ublic License, verstion2.4/spaon>, 4a href="+cokfrea  }.
 er_init12a>(&4a href="+code=b" class="sref">b12a>->4a href="+code=pa class="sref">offset_in_page4/a>;.  404/a>                goto 4a href="+co:ublic License, verstion2.4/spaon>  284/a>        int 4a href="+code=err" class="sref">err4/a>;.  414/a>        }.  404/a>    EXPORT_SYMBO>err4/a> = -4a hrXPORT_SYMBO>  }.
 L21">  2112a>int 4a href="+code=iso_packets_buffer_init" class="sa class="sref">offset_in_page4/a>;.  354/a>.  134/a>4spao class="comment">/**4/spaon> ckets_buffer_init" destroy - freaset_size4spao clresourcaximum) size of a packet, in bytes4/spaon>  154/a>4spao class="comment"frea  um) size of a packet, in bytes4/spaon>  164/a>4spao class="comment"> * @unit: the device at the other end of the stream4/spaon>  204/a>4spao class="comment"> */4/spaon>
 L21">  2112a>int 4adestroyf="+code=iso_packets_buffer_init" destroy  }.iso_packets_buffer_init12a>(struct 4a href="+code=iso_packets_buffer" class="sref">iso_packets_buffer12a> *4a hr4spao class="comment"> */4/spaon>  222222f="+code=b" class="sref">b12a>, struct 4a href="+code=fw_unit" class="sref">fw_unit12a> *4a href="+ptio" class="sref">direcptio4/a>)>packets_per_page12a>)) {>fw_iso_buffer_init12a>(&4a href="+code=b" class="sref">b12a>->4a href="+code=iso_buffer" class="sref">iso_buffer12a>, 4a href="+code=fw_parent_       }.
  
 4  >o3.1"assaon>offset_in_page4/a>;., 4a href="+cokfrea  }.
 er_init12a>(&4a href="+code=b" class="sref">b12a>->4a href="+code=pa class="sref">offset_in_page4/a>;.  414/a>        }.  404/a>    EXPORT_SYMBO>err4/a> = -4a hrXPORT_SYMBO>  }.
 L21">  2112a>int 4adestroyf="+code=iso_packets_buffer_init" destroy  }.a class="sref">offset_in_page4/a>;.LXR namulx2@lude/.no_buf.
lass="sarch_/packetsubfoot12a>
lx2.lude/.no kindly hosted by:lass="srehttp://www.redpill-ludpro.no">Redpill Ludpro AS_buffeprovidss="coLude/ nansears="co@uniperade=ds ser    s sinass1995.
lass="sea/body"sa/html4d