| | |
| | | void SCPI_RegSet(scpi_t * context, scpi_reg_name_t name, scpi_reg_val_t val) { |
| | | bool_t srq = FALSE; |
| | | scpi_reg_val_t mask; |
| | | scpi_reg_val_t old_val; |
| | | |
| | | if ((name >= SCPI_REG_COUNT) || (context->registers == NULL)) { |
| | | return; |
| | | } |
| | | |
| | | /* store old register value */ |
| | | old_val = context->registers[name]; |
| | | |
| | | /* set register value */ |
| | | context->registers[name] = val; |
| | |
| | | mask &= ~STB_SRQ; |
| | | if (val & mask) { |
| | | val |= STB_SRQ; |
| | | srq = TRUE; |
| | | /* avoid sending SRQ if nothing has changed */ |
| | | if (old_val != val) { |
| | | srq = TRUE; |
| | | } |
| | | } else { |
| | | val &= ~STB_SRQ; |
| | | } |
| | |
| | | |
| | | |
| | | case SCPI_REG_COUNT: |
| | | // nothing to do |
| | | /* nothing to do */ |
| | | break; |
| | | } |
| | | |
| | | // set updated register value |
| | | /* set updated register value */ |
| | | context->registers[name] = val; |
| | | |
| | | if (srq) { |
| | |
| | | * @param context |
| | | */ |
| | | void SCPI_EventClear(scpi_t * context) { |
| | | // TODO |
| | | /* TODO */ |
| | | SCPI_RegSet(context, SCPI_REG_ESR, 0); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | scpi_result_t SCPI_CoreOpcQ(scpi_t * context) { |
| | | // Operation is always completed |
| | | /* Operation is always completed */ |
| | | SCPI_ResultInt(context, 1); |
| | | return SCPI_RES_OK; |
| | | } |
| | |
| | | int result = 0; |
| | | if (context && context->interface && context->interface->test) { |
| | | result = context->interface->test(context); |
| | | } |
| | | } |
| | | SCPI_ResultInt(context, result); |
| | | return SCPI_RES_OK; |
| | | } |
| | |
| | | */ |
| | | scpi_result_t SCPI_CoreWai(scpi_t * context) { |
| | | (void) context; |
| | | // NOP |
| | | /* NOP */ |
| | | return SCPI_RES_OK; |
| | | } |
| | | |