Exemple #1
0
void drp_debug5(void){
    int value=0, res=0;
    unsigned int index;

    printf("dat_reset_Payload_Buff()..\n");
    int pay_i; int lenBuff=10, r_nextIndx, r_MaxIndx;
    for(pay_i=0; pay_i<dat_pay_last_one; pay_i++, lenBuff=lenBuff+1){
        printf("  writing: ");
        dat_reset_Payload_Buff(pay_i, lenBuff, 0);
        printf("    dat_reset_Payload_Buff(%d, %d)\r\n", pay_i, lenBuff);

        printf("  reading: ");
        r_nextIndx = dat_get_NextPayIndx(pay_i);
        printf("    dat_get_NextPayIndx(%u) = %d    |    ", pay_i, r_nextIndx);
        r_MaxIndx = dat_get_MaxPayIndx(pay_i);
        printf("    dat_get_MaxPayIndx(%u) = %d    |    \n", pay_i, r_MaxIndx);

        printf("  comparing: ");
        if( r_nextIndx==0 && r_MaxIndx==(lenBuff-1) ){ printf("ok\n"); }
        else{ printf("fail\n"); return; }

        ClrWdt();
    }

    printf("DAT_Payload_Buff..\n");
    int maxind; BOOL st;
    for(pay_i=0; pay_i<dat_pay_last_one; pay_i++){
        value=20000;
        st = TRUE;
        maxind = dat_get_MaxPayIndx(pay_i);
        for(index=0; st==TRUE; 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{ printf("fail\n"); return; }

            if( dat_isFull_Payload_Buff(pay_i)==TRUE){
                printf("    DAT_Payload_Buff[%u] esta lleno\r\n", pay_i);
                st = FALSE;
            }

            ClrWdt();
        }
        printf("*******************************************\n");
    }
    printf("End of drp_debug5\n");
}
Exemple #2
0
int drp_print_dat_PayloadIndxs(void *param){
    printf("===================================\r\n");
    printf("Reading sta_PayloadIndxs Block\r\n");
    printf("===================================\r\n");

//    char buffer[10];
    DAT_Payload_Buff pay_i;
    for(pay_i=0; pay_i<dat_pay_last_one; pay_i++)
    {
        unsigned int max = dat_get_MaxPayIndx( pay_i);
        unsigned int next = dat_get_NextPayIndx( pay_i);
        
        printf("pay_i = %u | maxIndx = %d | next = %d \r\n", (unsigned int)pay_i, max, next);
//        itoa(buffer, (unsigned int)pay_i,10);
//        con_printf(buffer); con_printf("\r\n");
//        con_printf("    MaxIndx=");
//        itoa(buffer, (unsigned int)max,10);
//        sprintf (buffer, "0x%X", (unsigned int)max);
//        con_printf(buffer); con_printf("\r\n");
//        con_printf("    NextIndx=");
//        //itoa(buffer, (unsigned int)next,10);
//        sprintf (buffer, "0x%X", (unsigned int)next);
//        con_printf(buffer); con_printf("\r\n");
    }
    return 1;
}
Exemple #3
0
BOOL dat_isFull_Payload_Buff(DAT_Payload_Buff pay_i) {
    unsigned int nextIndx, maxIndx;

    if(pay_i>=dat_pay_last_one) {
#if (SCH_DATAREPOSITORY_VERBOSE>=2)
        printf("isFullPayload_Buffer: payload invalido\n");
#endif
        return FALSE;   //payload invalido
    }

    nextIndx = dat_get_NextPayIndx(pay_i);
    maxIndx = dat_get_MaxPayIndx(pay_i);
    if(nextIndx>maxIndx) {
#if (SCH_DATAREPOSITORY_VERBOSE>=2)
        printf("isFullPayload_Buffer: buffer lleno, desiredIndx>maxIndx\n");
#endif
        return TRUE;   //buffer lleno, indice fuera de rango
    }
    return FALSE;
}
Exemple #4
0
int drp_print_dat_PayloadVar(void *param){

    int pay_i2 = *((int *)param);
    
    con_printf("===================================\r\n");
    con_printf("Reading sta_PayloadVar \r\n");
    con_printf("===================================\r\n");

    char buffer[10];
    DAT_Payload_Buff pay_i=pay_i2;
    if(pay_i>=dat_pay_last_one){
        printf("pay_i= %d NO existe, nada que imprimir\r\n", pay_i);
//        itoa(buffer, (unsigned int)pay_i,10);
//        con_printf(buffer);
//        con_printf(" NO existe. Nada que imprimir\r\n");
        return 0;
    }

    printf("pay_i = %d\r\n", pay_i);
//    itoa(buffer, (unsigned int)pay_i,10);
//    con_printf(buffer); con_printf("\r\n");

    unsigned int indx; unsigned int max = dat_get_MaxPayIndx(pay_i); int val;
    for(indx=0; indx<=max; indx++)
    {
        dat_get_Payload_Buff(pay_i, indx, &val);
        
        con_printf("sta_getPayloadVar[");
        //itoa(buffer, (unsigned int)indx,10);
        sprintf (buffer, "%d", (unsigned int)indx);
        con_printf(buffer); con_printf("]=");
        //itoa(buffer, (unsigned int)val,10);
        sprintf (buffer, "0x%X", (unsigned int)val);
        con_printf(buffer); con_printf("\r\n");

        ClrWdt();
    }
    return 1;
}
Exemple #5
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");
}