00001 #ifndef MOC_INTERNAL_DATA_TRANSFER_PPU_H_ 00002 #define MOC_INTERNAL_DATA_TRANSFER_PPU_H_ 00003 00004 00005 #include <stdint.h> 00006 00007 #include "../../moc.h" 00008 00009 00010 00011 /** 00012 * \addtogroup internal_p2p_dma 00013 **/ 00014 //@{ 00015 /** 00016 * @name PPU-only 00017 **/ 00018 //@{ 00019 00020 00021 /** 00022 * Internal wrapper-function for a blocking DMA-get operation. 00023 * Data can be of any size, constraints of low-level DMA-functions 00024 * are dealt by this function. 00025 * However data-addresses have to be at least 16-byte aligned. 00026 * 00027 * This function actually always reads a multiple of 16 from the source, 00028 * but copies only size bytes of it to target. This means however that up 00029 * to 15 bytes are read from an invalid location. As it is never written to 00030 * them this should always be safe. 00031 * 00032 * On the ppu the system for tag reservation is not present, so a hardcoded tag is used. 00033 * It has also to be noted that the dma calls are actually initiated on the spu by the ppu. 00034 * 00035 * @param target \b in local-address of buffer 00036 * @param source \b in ea-address of data 00037 * @param size \b in size of data in byte 00038 * @param dest \b in id of source spe 00039 * @return 0 when success otherwise error-code 00040 **/ 00041 int IMOC_get_data(void* target, uint64_t source, uint32_t size, int dest); 00042 00043 /** 00044 * Internal wrapper-function for a blocking DMA-put operation. 00045 * Data-size should be a multiple of 16 because of low-level constraints, but 00046 * there is no upper limit of transfer-size. 00047 * Data-addresses have to be at least 16-byte aligned. 00048 * 00049 * This function actually always reads a multiple of 16 from the source, and copies 00050 * it to target. This means however that up to 15 bytes are written to and invalid 00051 * location, so if one wants to use it with invalid sizes precautions have to be taken 00052 * in order to make it safe. 00053 * 00054 * On the ppu the system for tag reservation is not present, so a hardcoded tag is used. 00055 * It has also to be noted that the dma calls are actually initiated on the spu by the ppu. 00056 * 00057 * @param source \b in local-address of data 00058 * @param target \b in ea-address of buffer 00059 * @param size \b in size of data in byte 00060 * @param dest \b in id of source spe 00061 * @return 0 when success otherwise error-code 00062 **/ 00063 int IMOC_put_data(void* source, uint64_t target, uint32_t size, int dest); 00064 00065 /** 00066 * Internal wrapper-function for a non-blocking DMA-get operation. 00067 * Data can be of any size, constraints of low-level DMA-functions 00068 * are dealt by this function. 00069 * However data-addresses have to be at least 16-byte aligned. 00070 * 00071 * This function actually always reads a multiple of 16 from the source, 00072 * but copies only size bytes of it to target. This means however that up 00073 * to 15 bytes are read from an invalid location. As it is never written to 00074 * them this should always be safe. 00075 * 00076 * On the ppu the system for tag reservation is not present, so a hardcoded tag is used. 00077 * It has also to be noted that the dma calls are actually initiated on the spu by the ppu. 00078 * 00079 * @param target \b in local-address of buffer 00080 * @param source \b in ea-address of data 00081 * @param size \b in size of data in byte 00082 * @param dest \b in id of source spe 00083 * @param request \b out request-handle 00084 * @return 0 when success otherwise error-code 00085 **/ 00086 int IMOC_iget_data(void* target, uint64_t source, uint32_t size, uint32_t dest, imoc_dma_request* request); 00087 00088 /** 00089 * Internal wrapper-function for a non-blocking DMA-put operation. 00090 * Data-size should be a multiple of 16 because of low-level constraints, but 00091 * there is no upper limit of transfer-size. 00092 * Data-addresses have to be at least 16-byte aligned. 00093 * 00094 * This function actually always reads a multiple of 16 from the source, and copies 00095 * it to target. This means however that up to 15 bytes are written to and invalid 00096 * location, so if one wants to use it with invalid sizes precautions have to be taken 00097 * in order to make it safe. 00098 * 00099 * On the ppu the system for tag reservation is not present, so a hardcoded tag is used. 00100 * It has also to be noted that the dma calls are actually initiated on the spu by the ppu. 00101 * 00102 * @param source \b in local-address of data 00103 * @param target \b in ea-address of buffer 00104 * @param size \b in size of data in byte 00105 * @param dest \b in id of source spe 00106 * @param request \b out request-handle 00107 * @return 0 when success otherwise error-code 00108 **/ 00109 int IMOC_iput_data(void* source, uint64_t target, uint32_t size, uint32_t dest, imoc_dma_request* request); 00110 00111 /** 00112 * Waits till a IMOC_iget_data or IMOC_iput_data is completed. 00113 * 00114 * @param request \b in request-handle 00115 * @return 0 when success otherwise error-code 00116 **/ 00117 int IMOC_wait_dma(imoc_dma_request* request); 00118 00119 /** 00120 * Tests if a IMOC_iget_data or IMOC_iput_data is completed. 00121 * 00122 * @param request \b in request-handle 00123 * @param flag \b out true if operation is completed 00124 * @return 0 when success otherwise error-code 00125 **/ 00126 int IMOC_test_dma(imoc_dma_request* request, int *flag); 00127 00128 /** 00129 * Reserves a tag on the ppu, for communication with a given spu. 00130 * 00131 * @param speid \b id of spu to communicate with 00132 * @return tag (0-14) when success otherwise error code 00133 **/ 00134 int moc_tag_reserve(unsigned int speid); 00135 00136 /** 00137 * Releases a reserved tag. 00138 * 00139 * @param speid \b id of spu for which the tag was reserved 00140 * @param tag \b tag to be released 00141 * @return 0 when success otherwise error-code 00142 **/ 00143 int moc_tag_release(unsigned int speid, int tag); 00144 00145 //@} 00146 //@} 00147 #endif /*MOC_INTERNAL_DATA_TRANSFER_PPU_H_*/ 00148
1.5.6