libspe2 0.9a
Functions
dma.c File Reference
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <sys/poll.h>
#include "create.h"
#include "dma.h"
Include dependency graph for dma.c:

Go to the source code of this file.

Functions

int _base_spe_mfcio_put (spe_context_ptr_t spectx, unsigned int ls, void *ea, unsigned int size, unsigned int tag, unsigned int tid, unsigned int rid)
int _base_spe_mfcio_putb (spe_context_ptr_t spectx, unsigned int ls, void *ea, unsigned int size, unsigned int tag, unsigned int tid, unsigned int rid)
int _base_spe_mfcio_putf (spe_context_ptr_t spectx, unsigned int ls, void *ea, unsigned int size, unsigned int tag, unsigned int tid, unsigned int rid)
int _base_spe_mfcio_get (spe_context_ptr_t spectx, unsigned int ls, void *ea, unsigned int size, unsigned int tag, unsigned int tid, unsigned int rid)
int _base_spe_mfcio_getb (spe_context_ptr_t spectx, unsigned int ls, void *ea, unsigned int size, unsigned int tag, unsigned int tid, unsigned int rid)
int _base_spe_mfcio_getf (spe_context_ptr_t spectx, unsigned int ls, void *ea, unsigned int size, unsigned int tag, unsigned int tid, unsigned int rid)
int _base_spe_mfcio_tag_status_read (spe_context_ptr_t spectx, unsigned int mask, unsigned int behavior, unsigned int *tag_status)
int _base_spe_mssync_start (spe_context_ptr_t spectx)
int _base_spe_mssync_status (spe_context_ptr_t spectx)

Function Documentation

int _base_spe_mfcio_get ( spe_context_ptr_t  spectx,
unsigned int  ls,
void *  ea,
unsigned int  size,
unsigned int  tag,
unsigned int  tid,
unsigned int  rid 
)

The _base_spe_mfcio_get function places a get DMA command on the proxy command queue of the SPE thread specified by speid. The get command transfers size bytes of data starting at the effective address specified by ea to the local store address specified by ls. The DMA is identified by the tag id specified by tag and performed according to the transfer class and replacement class specified by tid and rid respectively.

Parameters:
spectxSpecifies the SPE context
lsSpecifies the starting local store destination address.
eaSpecifies the starting effective address source address.
sizeSpecifies the size, in bytes, to be transferred.
tagSpecifies the tag id used to identify the DMA command.
tidSpecifies the transfer class identifier of the DMA command.
ridSpecifies the replacement class identifier of the DMA command.
Returns:
On success, return 0. On failure, -1 is returned.

Definition at line 160 of file dma.c.

References MFC_CMD_GET.

{
        return spe_do_mfc_get(spectx, ls, ea, size, tag, tid, rid, MFC_CMD_GET);
}
int _base_spe_mfcio_getb ( spe_context_ptr_t  spectx,
unsigned int  ls,
void *  ea,
unsigned int  size,
unsigned int  tag,
unsigned int  tid,
unsigned int  rid 
)

The _base_spe_mfcio_getb function is identical to _base_spe_mfcio_get except that it places a getb (get with barrier) DMA command on the proxy command queue. The barrier form ensures that this command and all sequence commands with the same tag identifier as this command are locally ordered with respect to all previously issued commands with the same tag group and command queue.

Parameters:
spectxSpecifies the SPE context
lsSpecifies the starting local store destination address.
eaSpecifies the starting effective address source address.
sizeSpecifies the size, in bytes, to be transferred.
tagSpecifies the tag id used to identify the DMA command.
tidSpecifies the transfer class identifier of the DMA command.
ridSpecifies the replacement class identifier of the DMA command.
Returns:
On success, return 0. On failure, -1 is returned.

Definition at line 171 of file dma.c.

References MFC_CMD_GETB.

{
        return spe_do_mfc_get(spectx, ls, ea, size, tag, rid, rid, MFC_CMD_GETB);
}
int _base_spe_mfcio_getf ( spe_context_ptr_t  spectx,
unsigned int  ls,
void *  ea,
unsigned int  size,
unsigned int  tag,
unsigned int  tid,
unsigned int  rid 
)

The _base_spe_mfcio_getf function is identical to _base_spe_mfcio_get except that it places a getf (get with fence) DMA command on the proxy command queue. The fence form ensure that this command is locally ordered with respect to all previously issued commands with the same tag group and command queue.

Parameters:
spectxSpecifies the SPE context
lsSpecifies the starting local store destination address.
eaSpecifies the starting effective address source address.
sizeSpecifies the size, in bytes, to be transferred.
tagSpecifies the tag id used to identify the DMA command.
tidSpecifies the transfer class identifier of the DMA command.
ridSpecifies the replacement class identifier of the DMA command.
Returns:
On success, return 0. On failure, -1 is returned.

Definition at line 182 of file dma.c.

References MFC_CMD_GETF.

{
        return spe_do_mfc_get(spectx, ls, ea, size, tag, tid, rid, MFC_CMD_GETF);
}
int _base_spe_mfcio_put ( spe_context_ptr_t  spectx,
unsigned int  ls,
void *  ea,
unsigned int  size,
unsigned int  tag,
unsigned int  tid,
unsigned int  rid 
)

The _base_spe_mfcio_put function places a put DMA command on the proxy command queue of the SPE thread specified by speid. The put command transfers size bytes of data starting at the local store address specified by ls to the effective address specified by ea. The DMA is identified by the tag id specified by tag and performed according transfer class and replacement class specified by tid and rid respectively.

Parameters:
spectxSpecifies the SPE context
lsSpecifies the starting local store destination address.
eaSpecifies the starting effective address source address.
sizeSpecifies the size, in bytes, to be transferred.
tagSpecifies the tag id used to identify the DMA command.
tidSpecifies the transfer class identifier of the DMA command.
ridSpecifies the replacement class identifier of the DMA command.
Returns:
On success, return 0. On failure, -1 is returned.

Definition at line 126 of file dma.c.

References MFC_CMD_PUT.

{
        return spe_do_mfc_put(spectx, ls, ea, size, tag, tid, rid, MFC_CMD_PUT);
}
int _base_spe_mfcio_putb ( spe_context_ptr_t  spectx,
unsigned int  ls,
void *  ea,
unsigned int  size,
unsigned int  tag,
unsigned int  tid,
unsigned int  rid 
)

The _base_spe_mfcio_putb function is identical to _base_spe_mfcio_put except that it places a putb (put with barrier) DMA command on the proxy command queue. The barrier form ensures that this command and all sequence commands with the same tag identifier as this command are locally ordered with respect to all previously i ssued commands with the same tag group and command queue.

Parameters:
spectxSpecifies the SPE context
lsSpecifies the starting local store destination address.
eaSpecifies the starting effective address source address.
sizeSpecifies the size, in bytes, to be transferred.
tagSpecifies the tag id used to identify the DMA command.
tidSpecifies the transfer class identifier of the DMA command.
ridSpecifies the replacement class identifier of the DMA command.
Returns:
On success, return 0. On failure, -1 is returned.

Definition at line 137 of file dma.c.

References MFC_CMD_PUTB.

{
        return spe_do_mfc_put(spectx, ls, ea, size, tag, tid, rid, MFC_CMD_PUTB);
}
int _base_spe_mfcio_putf ( spe_context_ptr_t  spectx,
unsigned int  ls,
void *  ea,
unsigned int  size,
unsigned int  tag,
unsigned int  tid,
unsigned int  rid 
)

The _base_spe_mfcio_putf function is identical to _base_spe_mfcio_put except that it places a putf (put with fence) DMA command on the proxy command queue. The fence form ensures that this command is locally ordered with respect to all previously issued commands with the same tag group and command queue.

Parameters:
spectxSpecifies the SPE context
lsSpecifies the starting local store destination address.
eaSpecifies the starting effective address source address.
sizeSpecifies the size, in bytes, to be transferred.
tagSpecifies the tag id used to identify the DMA command.
tidSpecifies the transfer class identifier of the DMA command.
ridSpecifies the replacement class identifier of the DMA command.
Returns:
On success, return 0. On failure, -1 is returned.

Definition at line 148 of file dma.c.

References MFC_CMD_PUTF.

{
        return spe_do_mfc_put(spectx, ls, ea, size, tag, tid, rid, MFC_CMD_PUTF);
}
int _base_spe_mfcio_tag_status_read ( spe_context_ptr_t  spectx,
unsigned int  mask,
unsigned int  behavior,
unsigned int *  tag_status 
)

_base_spe_mfcio_tag_status_read

No Idea

Definition at line 307 of file dma.c.

References spe_context_base_priv::active_tagmask, spe_context::base_private, spe_context_base_priv::flags, SPE_MAP_PS, SPE_TAG_ALL, SPE_TAG_ANY, and SPE_TAG_IMMEDIATE.

{
        if ( mask != 0 ) {
                if (!(spectx->base_private->flags & SPE_MAP_PS)) 
                        mask = 0;
        } else {
                if ((spectx->base_private->flags & SPE_MAP_PS))
                        mask = spectx->base_private->active_tagmask;
        }

        if (!tag_status) {
                errno = EINVAL;
                return -1;
        }

        switch (behavior) {
        case SPE_TAG_ALL:
                return spe_mfcio_tag_status_read_all(spectx, mask, tag_status);
        case SPE_TAG_ANY:
                return spe_mfcio_tag_status_read_any(spectx, mask, tag_status);
        case SPE_TAG_IMMEDIATE:
                return spe_mfcio_tag_status_read_immediate(spectx, mask, tag_status);
        default:
                errno = EINVAL;
                return -1;
        }
}
int _base_spe_mssync_start ( spe_context_ptr_t  spectx)

_base_spe_mssync_start starts Multisource Synchronisation

Parameters:
spectxSpecifies the SPE context

Definition at line 335 of file dma.c.

References _base_spe_open_if_closed(), spe_context::base_private, FD_MSS, spe_context_base_priv::flags, spe_mssync_area::MFC_MSSync, spe_context_base_priv::mssync_mmap_base, and SPE_MAP_PS.

{
        int ret, fd;
        unsigned int data = 1; /* Any value can be written here */

        volatile struct spe_mssync_area *mss_area = 
                spectx->base_private->mssync_mmap_base;

        if (spectx->base_private->flags & SPE_MAP_PS) {
                mss_area->MFC_MSSync = data; 
                return 0;
        } else {
                fd = _base_spe_open_if_closed(spectx, FD_MSS, 0);
                if (fd != -1) {
                        ret = write(fd, &data, sizeof (data));
                        if ((ret < 0) && (errno != EIO)) {
                                perror("spe_mssync_start: internal error");
                        }
                        return ret < 0 ? -1 : 0;
                } else 
                        return -1;
        }
}

Here is the call graph for this function:

int _base_spe_mssync_status ( spe_context_ptr_t  spectx)

_base_spe_mssync_status retrieves status of Multisource Synchronisation

Parameters:
spectxSpecifies the SPE context

Definition at line 359 of file dma.c.

References _base_spe_open_if_closed(), spe_context::base_private, FD_MSS, spe_context_base_priv::flags, spe_mssync_area::MFC_MSSync, spe_context_base_priv::mssync_mmap_base, and SPE_MAP_PS.

{
        int ret, fd;
        unsigned int data;

        volatile struct spe_mssync_area *mss_area = 
                spectx->base_private->mssync_mmap_base;

        if (spectx->base_private->flags & SPE_MAP_PS) {
                return  mss_area->MFC_MSSync;
        } else {
                fd = _base_spe_open_if_closed(spectx, FD_MSS, 0);
                if (fd != -1) {
                        ret = read(fd, &data, sizeof (data));
                        if ((ret < 0) && (errno != EIO)) {
                                perror("spe_mssync_start: internal error");
                        }
                        return ret < 0 ? -1 : data;
                } else 
                        return -1;
        }
}

Here is the call graph for this function: