int etna_semaphore(struct etna_ctx *ctx, uint32_t from, uint32_t to) { int status; if(ctx == NULL) return ETNA_INVALID_ADDR; if((status = etna_reserve(ctx, 2)) != ETNA_OK) return status; ETNA_EMIT_LOAD_STATE(ctx, VIVS_GL_SEMAPHORE_TOKEN>>2, 1, 0); ETNA_EMIT(ctx, VIVS_GL_SEMAPHORE_TOKEN_FROM(from) | VIVS_GL_SEMAPHORE_TOKEN_TO(to)); return ETNA_OK; }
void etna_stall(struct etna_cmd_stream *stream, uint32_t from, uint32_t to) { etna_cmd_stream_reserve(stream, 4); etna_emit_load_state(stream, VIVS_GL_SEMAPHORE_TOKEN >> 2, 1, 0); etna_cmd_stream_emit(stream, VIVS_GL_SEMAPHORE_TOKEN_FROM(from) | VIVS_GL_SEMAPHORE_TOKEN_TO(to)); if (from == SYNC_RECIPIENT_FE) { /* if the frontend is to be stalled, queue a STALL frontend command */ CMD_STALL(stream, from, to); } else { /* otherwise, load the STALL token state */ etna_emit_load_state(stream, VIVS_GL_STALL_TOKEN >> 2, 1, 0); etna_cmd_stream_emit(stream, VIVS_GL_STALL_TOKEN_FROM(from) | VIVS_GL_STALL_TOKEN_TO(to)); } }
int etna_stall(struct etna_ctx *ctx, uint32_t from, uint32_t to) { int status; if(ctx == NULL) return ETNA_INVALID_ADDR; if((status = etna_reserve(ctx, 4)) != ETNA_OK) return status; ETNA_EMIT_LOAD_STATE(ctx, VIVS_GL_SEMAPHORE_TOKEN>>2, 1, 0); ETNA_EMIT(ctx, VIVS_GL_SEMAPHORE_TOKEN_FROM(from) | VIVS_GL_SEMAPHORE_TOKEN_TO(to)); if(from == SYNC_RECIPIENT_FE) { /* if the frontend is to be stalled, queue a STALL frontend command */ ETNA_EMIT_STALL(ctx, from, to); } else { /* otherwise, load the STALL token state */ ETNA_EMIT_LOAD_STATE(ctx, VIVS_GL_STALL_TOKEN>>2, 1, 0); ETNA_EMIT(ctx, VIVS_GL_STALL_TOKEN_FROM(from) | VIVS_GL_STALL_TOKEN_TO(to)); } return ETNA_OK; }