#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"
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) |
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.
spectx | Specifies the SPE context | |
ls | Specifies the starting local store destination address. | |
ea | Specifies the starting effective address source address. | |
size | Specifies the size, in bytes, to be transferred. | |
tag | Specifies the tag id used to identify the DMA command. | |
tid | Specifies the transfer class identifier of the DMA command. | |
rid | Specifies the replacement class identifier of the DMA command. |
Definition at line 160 of file dma.c.
References MFC_CMD_GET.
00167 { 00168 return spe_do_mfc_get(spectx, ls, ea, size, tag, tid, rid, MFC_CMD_GET); 00169 }
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.
spectx | Specifies the SPE context | |
ls | Specifies the starting local store destination address. | |
ea | Specifies the starting effective address source address. | |
size | Specifies the size, in bytes, to be transferred. | |
tag | Specifies the tag id used to identify the DMA command. | |
tid | Specifies the transfer class identifier of the DMA command. | |
rid | Specifies the replacement class identifier of the DMA command. |
Definition at line 171 of file dma.c.
References MFC_CMD_GETB.
00178 { 00179 return spe_do_mfc_get(spectx, ls, ea, size, tag, rid, rid, MFC_CMD_GETB); 00180 }
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.
spectx | Specifies the SPE context | |
ls | Specifies the starting local store destination address. | |
ea | Specifies the starting effective address source address. | |
size | Specifies the size, in bytes, to be transferred. | |
tag | Specifies the tag id used to identify the DMA command. | |
tid | Specifies the transfer class identifier of the DMA command. | |
rid | Specifies the replacement class identifier of the DMA command. |
Definition at line 182 of file dma.c.
References MFC_CMD_GETF.
00189 { 00190 return spe_do_mfc_get(spectx, ls, ea, size, tag, tid, rid, MFC_CMD_GETF); 00191 }
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.
spectx | Specifies the SPE context | |
ls | Specifies the starting local store destination address. | |
ea | Specifies the starting effective address source address. | |
size | Specifies the size, in bytes, to be transferred. | |
tag | Specifies the tag id used to identify the DMA command. | |
tid | Specifies the transfer class identifier of the DMA command. | |
rid | Specifies the replacement class identifier of the DMA command. |
Definition at line 126 of file dma.c.
References MFC_CMD_PUT.
00133 { 00134 return spe_do_mfc_put(spectx, ls, ea, size, tag, tid, rid, MFC_CMD_PUT); 00135 }
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.
spectx | Specifies the SPE context | |
ls | Specifies the starting local store destination address. | |
ea | Specifies the starting effective address source address. | |
size | Specifies the size, in bytes, to be transferred. | |
tag | Specifies the tag id used to identify the DMA command. | |
tid | Specifies the transfer class identifier of the DMA command. | |
rid | Specifies the replacement class identifier of the DMA command. |
Definition at line 137 of file dma.c.
References MFC_CMD_PUTB.
00144 { 00145 return spe_do_mfc_put(spectx, ls, ea, size, tag, tid, rid, MFC_CMD_PUTB); 00146 }
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.
spectx | Specifies the SPE context | |
ls | Specifies the starting local store destination address. | |
ea | Specifies the starting effective address source address. | |
size | Specifies the size, in bytes, to be transferred. | |
tag | Specifies the tag id used to identify the DMA command. | |
tid | Specifies the transfer class identifier of the DMA command. | |
rid | Specifies the replacement class identifier of the DMA command. |
Definition at line 148 of file dma.c.
References MFC_CMD_PUTF.
00155 { 00156 return spe_do_mfc_put(spectx, ls, ea, size, tag, tid, rid, MFC_CMD_PUTF); 00157 }
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.
00308 { 00309 if ( mask != 0 ) { 00310 if (!(spectx->base_private->flags & SPE_MAP_PS)) 00311 mask = 0; 00312 } else { 00313 if ((spectx->base_private->flags & SPE_MAP_PS)) 00314 mask = spectx->base_private->active_tagmask; 00315 } 00316 00317 if (!tag_status) { 00318 errno = EINVAL; 00319 return -1; 00320 } 00321 00322 switch (behavior) { 00323 case SPE_TAG_ALL: 00324 return spe_mfcio_tag_status_read_all(spectx, mask, tag_status); 00325 case SPE_TAG_ANY: 00326 return spe_mfcio_tag_status_read_any(spectx, mask, tag_status); 00327 case SPE_TAG_IMMEDIATE: 00328 return spe_mfcio_tag_status_read_immediate(spectx, mask, tag_status); 00329 default: 00330 errno = EINVAL; 00331 return -1; 00332 } 00333 }
int _base_spe_mssync_start | ( | spe_context_ptr_t | spectx | ) |
_base_spe_mssync_start starts Multisource Synchronisation
spectx | Specifies 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.
00336 { 00337 int ret, fd; 00338 unsigned int data = 1; /* Any value can be written here */ 00339 00340 volatile struct spe_mssync_area *mss_area = 00341 spectx->base_private->mssync_mmap_base; 00342 00343 if (spectx->base_private->flags & SPE_MAP_PS) { 00344 mss_area->MFC_MSSync = data; 00345 return 0; 00346 } else { 00347 fd = _base_spe_open_if_closed(spectx, FD_MSS, 0); 00348 if (fd != -1) { 00349 ret = write(fd, &data, sizeof (data)); 00350 if ((ret < 0) && (errno != EIO)) { 00351 perror("spe_mssync_start: internal error"); 00352 } 00353 return ret < 0 ? -1 : 0; 00354 } else 00355 return -1; 00356 } 00357 }
int _base_spe_mssync_status | ( | spe_context_ptr_t | spectx | ) |
_base_spe_mssync_status retrieves status of Multisource Synchronisation
spectx | Specifies 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.
00360 { 00361 int ret, fd; 00362 unsigned int data; 00363 00364 volatile struct spe_mssync_area *mss_area = 00365 spectx->base_private->mssync_mmap_base; 00366 00367 if (spectx->base_private->flags & SPE_MAP_PS) { 00368 return mss_area->MFC_MSSync; 00369 } else { 00370 fd = _base_spe_open_if_closed(spectx, FD_MSS, 0); 00371 if (fd != -1) { 00372 ret = read(fd, &data, sizeof (data)); 00373 if ((ret < 0) && (errno != EIO)) { 00374 perror("spe_mssync_start: internal error"); 00375 } 00376 return ret < 0 ? -1 : data; 00377 } else 00378 return -1; 00379 } 00380 }