Exemplo n.º 1
0
void dat_reset_Payload_Buff(DAT_Payload_Buff pay_i) {
#if (SCH_DATAREPOSITORY_VERBOSE>=2)
    printf("Borrando buffer de pay_i = %u\n", (unsigned int)pay_i );
    printf("Usando mode = ");
    if(mode==1) {
        printf("1 (con borrado)..\n");
    }
    else {
        printf("0 (sin borrado)..\n");
    }
#endif

    //Seteo limites del Buffer
//    dat_set_MaxPayIndx(pay_i, lenBuff-1);
    dat_set_NextPayIndx(pay_i, 0);

//    if(mode==1){
//        //borro el conteido del buffer
//        dat_erase_Payload_Buff(pay_i);
//    }
//    //Reinicio el Buffer
//    dat_set_NextPayIndx(pay_i, 0);
//    #if (SCH_DATAREPOSITORY_VERBOSE>=2)
//        printf("reseteo de payload completo\n");
//    #endif
}
Exemplo n.º 2
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;
}
Exemplo n.º 3
0
void drp_debug4(void){
    int value=0, res=0;
    unsigned int index;

    printf("DAT_TeleCmdBuff..\n");
    value=20000;
    for(index=0; index<SCH_DATAREPOSITORY_MAX_BUFF_TELECMD; index++, value++){

        printf("  writing: ");
        dat_set_TeleCmd_Buff(index, value);
        printf("    DAT_TeleCmdBuff[%u] = %d    |    ", index, value);

        printf("  reading: ");
        res = dat_get_TeleCmd_Buff(index);
        printf("    DAT_TeleCmdBuff[%u] = %d    |    ", index, res);

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

        ClrWdt();
    }

    printf("DAT_FlightPlanBuff..\n");
    value=1000; DispCmd NewCmd;
    for(index=0; index<(SCH_FLIGHTPLAN_N_CMD); index++, value++){

        printf("  writing: ");
        dat_set_FlightPlan_cmd(index, value);
        printf("    DAT_FlightPlanBuff[%u].cmd = %d    |    ", index, value);
        dat_set_FlightPlan_param(index, value+1);
        printf("    DAT_FlightPlanBuff[%u].param = %d    |    \n", index, value+1);
        

        printf("  reading: ");
        NewCmd = dat_get_FlightPlan(index);
        printf("    DAT_FlightPlanBuff[%u].cmd = %d    |    ", index, NewCmd.cmdId);
        printf("    DAT_FlightPlanBuff[%u].param = %d    |    \n", index, NewCmd.param);

        printf("  comparing: ");
        if( value==NewCmd.cmdId && (value+1)==NewCmd.param ){ printf("ok\n"); }
        else{ con_printf("fail\n"); return; }

        ClrWdt();
    }
    
    printf("DAT_NextPayBuff and DAT_MaxPayBuff..\n");
    int pay_i; int n=0, m=49, res1, res2;
    for(pay_i=0; pay_i<dat_pay_last_one; pay_i++, m=m+10){
        printf("  writing: ");
        dat_set_NextPayIndx(pay_i, n);
        printf("    DAT_NextPayBuff[%u] = %d    |    ", pay_i, n);
        dat_set_MaxPayIndx(pay_i, m);
        printf("    DAT_NextPayBuff[%u] = %d    |    \n", pay_i, m);

        printf("  reading: ");
        res1 = dat_get_NextPayIndx(pay_i);
        printf("    DAT_NextPayBuff[%u] = %d    |    ", pay_i, res1);
        res2 = dat_get_MaxPayIndx(pay_i);
        printf("    DAT_MaxPayBuff[%u] = %d    |    \n", pay_i, res2);

        printf("  comparing: ");
        if( n==res1 && m==res2 ){ printf("ok\n"); }
        else{ printf("fail\n"); return; }

        ClrWdt();
    }

    printf("DAT_Payload_Buff..\n");
    int maxind;
    for(pay_i=0; pay_i<dat_pay_last_one; pay_i++){
        value=20000; 
        maxind = dat_get_MaxPayIndx(pay_i);
        for(index=0; index<=maxind; index++, value++){

            printf("  writing: ");
            dat_set_Payload_Buff(pay_i, value, DAT_PAYBUFF_MODE_NO_MAXINDX);
            printf("    DAT_Payload_Buff[%u][%u] = %d    |    ",pay_i, index, value);
            printf("%d/%d [NextIndx/MaxIndx]   |    \n", dat_get_NextPayIndx(pay_i), dat_get_MaxPayIndx(pay_i) );

            printf("  reading: ");
            dat_get_Payload_Buff(pay_i, index, &res);
            printf("    DAT_Payload_Buff[%u][%u] = %d    |    \n",pay_i,  index, res);

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

            ClrWdt();
        }
        printf("*******************************************\n");
    }

    printf("DAT_AuxBuff..\n");
    int aux_i; int maxind2;
    for(aux_i=0; aux_i<dat_aux_last_one; aux_i++){
        value=20000;
        maxind2 = 30;
        for(index=0; index<=maxind2; index++, value++){

            printf("  writing: ");
            dat_set_Aux_Buff(aux_i, index, value);
            printf("    DAT_AuxdBuff[%u] = %d    |    ", index, value);

            printf("  reading: ");
            res = dat_get_Aux_Buff(aux_i, index);
            printf("    DAT_AuxdBuff[%u] = %d    |    ", index, res);

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

            ClrWdt();
        }
        printf("*******************************************\n");
    }
    printf("End of drp_debug4\n");
}