Пример #1
0
void drp_debug3(void){
    int value=0, res=0;
    unsigned int index;
    unsigned long block;

    con_printf("(Destructive) Testing -256block r/w- memSD\r\n");
    for(block=0; block<1024; block=block+256){
        printf("testing 256Block = %lu\n", block);

        value=20000;
        for(index=0; index<=0xFFFF; index++, value++){

            con_printf("writing: ");
            msd_setVar_256BlockExtMem( block, index, value);
            printf("value[%u] = %d    |    ", index, value);

            printf("reading: ");
            msd_getVar_256BlockExtMem( block, index, &res);
            printf("value[%u] = %d    |    ", index, res);

            printf("comparing: ");
            if( value==res ){ printf("ok\n"); }
            else{ con_printf("fail\n"); return; }

            ClrWdt();
        }
    }
    //drp_memSD_BlockErase();
}
Пример #2
0
/**
 * Modifica el i-esima valor del buffer de Telecomandos
 * @param indx Posicion del buffer a recuperar
 * @param data Valor de la indx-esima posicion del buffer
 */
void dat_set_TeleCmd_Buff(int indx, int data)
{
    if(indx>=DAT_MAX_BUFF_TELECMD) {
        return;
    }
    else {
#if (SCH_TFLIGHTPLAN_EXTMEMORY == 0 || SCH_SYSBUS_ONBOARD==0)
        DAT_CMD_BUFF[indx] = data;
#else
        msd_setVar_256BlockExtMem(dat_gpb_TeleCmd_256Block, indx, data);
#endif
    }
}
Пример #3
0
/**
 * Esta funcion escribe el parametro (asociado a un comando) de un determinado indice el flight plan
 * @param index Indice del f. plan que sera actualizado
 * @param param Parametro que sera escrito
 * @return 1, OK. 0, Fallo
 */
int dat_set_FlightPlan_param(unsigned int index, int param)
{
    if(index < SCH_TFLIGHTPLAN_N_CMD)
    {
#if (SCH_TFLIGHTPLAN_EXTMEMORY == 1)
        msd_setVar_256BlockExtMem( dat_gpb_FlightPlan_256Block, 0xFFFF-index, param);
#elif (SCH_TFLIGHTPLAN_EXTMEMORY == 0)
        DAT_FPLAN_BUFF[index+SCH_TFLIGHTPLAN_N_CMD] = param;
#endif
        return 1;
    }
    else
        return 0;
}
Пример #4
0
/**
 * Esta funcion escribe un comando en un determinado indice el flight plan
 * @param index Indice del f. plan que sera actualizado
 * @param cmdId Comando que sera escrito
 * @return 1, OK. 0, Fallo
 */
int dat_set_FlightPlan_cmd(unsigned int index, unsigned int cmdID)
{
    if(index < SCH_TFLIGHTPLAN_N_CMD)
    {
#if (SCH_TFLIGHTPLAN_EXTMEMORY == 1)
        msd_setVar_256BlockExtMem( dat_gpb_FlightPlan_256Block, index, cmdID);
#elif (SCH_TFLIGHTPLAN_EXTMEMORY == 0)
        DAT_FPLAN_BUFF[index] = cmdID;
#endif
        return 1;
    }
    else
        return 0;
}
Пример #5
0
BOOL dat_set_Payload_Buff_at_indx(DAT_Payload_Buff pay_i, int value, unsigned int indx) {
    // guarda "value" en la sgte posicion libre del buffer,
    // y retorna si lo logro o no (buffer lleno, payload invalido)
    unsigned int nextIndx;

    // Descarta si pay_i invalido
    if(pay_i>=dat_pay_last_one) {
#if (SCH_DATAREPOSITORY_VERBOSE>=1)
        printf("dat_set_Payload_Buff: payload invalido\n");
#endif
        return FALSE;
    }

//    if(mode == DAT_PAYBUFF_MODE_USE_MAXINDX){
//        printf("dat_set_PayloadBuff: Using MAXINDX mode\n");
//        // Descarta si pay_i esta lleno
//        if( dat_isFull_Payload_Buff(pay_i)==TRUE){
//            #if (SCH_DATAREPOSITORY_VERBOSE>=1)
//                printf("dat_set_PayloadBuff: nextIndx > maxIndx\n");
//            #endif
//            return FALSE;
//        }
//    }

    //Obtiene nextIndx (posicion a la que guardar)
    nextIndx = indx;

#if (SCH_DATAREPOSITORY_VERBOSE>=2)
    printf("setPayloadVar [%04d] = %0x%X\n", nextIndx, value);
#endif

    //guardo el valor de value
    unsigned long block = dat_pay_i_to_block(pay_i);
    msd_setVar_256BlockExtMem(block, nextIndx, value);

    //actualizo nextIndx
    dat_set_NextPayIndx(pay_i, nextIndx+1);

    return TRUE;
}
Пример #6
0
//Set
void dat_set_Aux_Buff(DAT_Aux_Buff aux_i, unsigned int indx, int value) {
    unsigned long block = dat_aux_i_to_block(aux_i);
    msd_setVar_256BlockExtMem(block, indx, value);

}
Пример #7
0
//Setea el valor del indice actual del buffer de cierto payload
void dat_set_NextPayIndx(DAT_Payload_Buff pay_i, unsigned int nextIndx) {
    msd_setVar_256BlockExtMem(dat_gpb_Pay_nextIndx_256Block, (unsigned char)pay_i, nextIndx);
}
Пример #8
0
//Setea el valor del ultimo/maximo indice del buffer de cierto payload
void dat_set_MaxPayIndx(DAT_Payload_Buff pay_i, unsigned int maxIndx) {
    msd_setVar_256BlockExtMem(dat_gpb_Pay_maxIndx_256Block, (unsigned char)pay_i, maxIndx);
}