ses_step_va_balance
authoryu.dongliang <18588496441@163.com>
Wed, 13 Sep 2023 11:26:54 +0000 (19:26 +0800)
committeryu.dongliang <18588496441@163.com>
Wed, 13 Sep 2023 11:26:54 +0000 (19:26 +0800)
ses_step_va.c
ses_step_va_balance.c
ses_steps.c

index d57d842889c8c519aba7aee05155586944e768ef..86e302e3c6649c83fc7d6b1204650bf93583b8a1 100644 (file)
@@ -255,20 +255,18 @@ static int _va_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t* ct
        ScfEpin*       Bp;
        ScfEpin*       Bn;
 
-       size_t i;
-       size_t j;
-       size_t k;
-
        B  = f->components[0];
        Bp = B->pins[SCF_EDA_Battery_POS];
        Bn = B->pins[SCF_EDA_Battery_NEG];
 
        printf("\n*******************\n");
 
+       int i;
+
        for (i = 0; i < ctx->paths->size; i++) {
                path      = ctx->paths->data[i];
 
-               scf_logi("i: %ld, path->type: %d\n", i, path->type);
+               scf_logi("i: %d, path->type: %d\n", i, path->type);
 
                if (path->pins->size < 2) {
                        scf_loge("\n");
index 17b736e127799b3e6795933a2cdc85843e4e238e..e9be2fb620634f37a369fba6645b8e1205e75b37 100644 (file)
@@ -2,6 +2,46 @@
 
 static int _va_balance_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t* ctx)
 {
+       ses_path_t*    path;
+       ScfEcomponent* B;
+       ScfEpin*       p0;
+       ScfEpin*       p1;
+       ScfEpin*       Bp;
+       ScfEpin*       Bn;
+
+       B  = f->components[0];
+       Bp = B->pins[SCF_EDA_Battery_POS];
+       Bn = B->pins[SCF_EDA_Battery_NEG];
+
+       printf("\n*******************\n");
+
+       int i;
+
+       for (i = 0; i < ctx->paths->size; i++) {
+               path      = ctx->paths->data[i];
+
+               if (path->pins->size < 2) {
+                       scf_loge("\n");
+                       return -EINVAL;
+               }
+
+               p0 = path->pins->data[0];
+               p1 = path->pins->data[path->pins->size - 1];
+
+               if (p0->lid == Bp->lid || p1->lid == Bn->lid)
+                       continue;
+
+               scf_logi("i: %d, path->type: %d\n", i, path->type);
+
+               ses_path_print(path);
+#if 0
+               int ret = __ses_path_va(f, path);
+               if (ret < 0)
+                       return ret;
+#endif
+               printf("\n");
+       }
+
        return 0;
 }
 
index fea076e206406a2c35db7ff80366018b69683a46..8306c207a4d43a27adc34fa399e63f089bc01261 100644 (file)
@@ -40,7 +40,7 @@ static ses_step_t*  ses_steps[] =
 
        &ses_step_jr,
        &ses_step_va,
-//     &ses_step_va_balance,
+       &ses_step_va_balance,
 
        &ses_step_output,
 };