]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/commitdiff
Removed most of the fixmes for command help
authorMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 30 Jul 2013 17:54:32 +0000 (19:54 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Tue, 30 Jul 2013 17:54:32 +0000 (19:54 +0200)
Also, the code was updated where a problem was found.

commands/cmd_adc.c
commands/cmd_can.c
commands/cmd_hbr.c
commands/cmd_hout.c
commands/cmd_pin.c
commands/cmd_port.c
commands/cmd_spi.c
commands/cmd_vbat.c

index 13f27737aaf99fa07d90026d76a0a702a3e3233f..22a867b9f0597bd2f383f0cc0001cae5b61059a1 100644 (file)
@@ -47,10 +47,8 @@ int cmd_do_read_adc1_values(cmd_io_t *cmd_io, const struct cmd_des *des, char *p
     uint32_t i;                                                // Cycle control variable
 
     rpp_ain_update();
-    rpp_sci_printf("ADC1: values: ");
-    /* conversion results :                                       */
     for (i = 0; i < PORT_ADC_CHANNEL_NUM; i++) {
-       rpp_sci_printf((uint8_t *)"\r\nChannel: %d\tvalue: %d\t%h", i+1, rpp_ain_get(i+1), rpp_ain_get(i+1));
+       rpp_sci_printf((uint8_t *)"ADC%-2d %4d\n", i+1, rpp_ain_get(i+1));
     }
     return 0;
 }
@@ -60,34 +58,31 @@ int cmd_do_read_adc1_values(cmd_io_t *cmd_io, const struct cmd_des *des, char *p
 /** Descriptor of command for adc port reading */
 cmd_des_t const cmd_des_read_adc1={
     0, 0,
-    "adcread","Read values from ADC1", /* FIXME: is ADC1 also a name of a pin? */
+    "adcread","Read values from ADC inputs",
     "=== Command syntax ===\n"
     "\n"
     "   adcread\n"
     "\n"
     "=== Description ===\n"
     "\n"
-    "This command reads values of all ADIN 1-12 channels and prints it as\n" /* FIXME: Which pins are this? */
-    "channel-value (hexadecimal) table.\n"
+    "This command reads values corresponding to analog voltages on ADC\n"
+    "inputs 1-12 and prints them as decimal numbers.\n"
     "\n"
     "=== Example ===\n"
     "\n"
     "   --> adcread\n"
-    "   ADC1: values:\n"
-    "   Channel: 1     value: 110\n" /* FIXME: There is no exadecimal number */
-    "   Channel: 2     value: 107\n"
-    "   Channel: 3     value: 109\n"
-    "   Channel: 4     value: 108\n"
-    "   Channel: 5     value: 109\n"
-    "   Channel: 6     value: 110\n"
-    "   Channel: 7     value: 111\n"
-    "   Channel: 8     value: 110\n"
-    "   Channel: 9     value: 107\n"
-    "   Channel: 10    value: 109\n"
-    "   Channel: 11    value: 110\n"
-    "   Channel: 12    value: 110\n"
-    "\n"
-    "Prints the values of all ADC channels.\n",
+    "   ADC1  2338\n"
+    "   ADC2   107\n"
+    "   ADC3   108\n"
+    "   ADC4   106\n"
+    "   ADC5   108\n"
+    "   ADC6   110\n"
+    "   ADC7   110\n"
+    "   ADC8   109\n"
+    "   ADC9   106\n"
+    "   ADC10  107\n"
+    "   ADC11  110\n"
+    "   ADC12  108\n",
     CMD_HANDLER(cmd_do_read_adc1_values), (void *)&cmd_list_adc
 };
 
index 5dc82d8062e6018e15341f73d9c8ae707353ef95..c292984c294ed9a1f3386510056a42a0c8ca229c 100644 (file)
@@ -49,59 +49,40 @@ extern uint32_t canSendError;
 /** Error counter for errors in receiving */
 extern uint32_t canRecError;
 
-/**
- *     @brief  Function for printing CAN error status
- *
- *     Function prints CAN status as a human readable string and status code.
- *
- *     @note The function canInit has to be called before this function can be used.
- *
- *     @param[in]      node    Pointer to CAN registers
- *     @param[in]      str             String to be printed befor status and code
- *     @param[in]      errorStatus     Code of the CAN status
- *     @param[in]      isFinal 0 when error testing during sending and receiving
- *                                             1 when final printout was requested
- */
-uint32_t canCheckForError(canBASE_t *node, const char* str, uint32_t *errorStatus, uint8_t isFinal)
+static void canPrintStatus(int can_num, uint32_t es)
 {
-    //uint32_t errorStatus = node->ES;
-    uint32_t errorLevel = *errorStatus & 0xE0U;
-    uint32_t errStat = *errorStatus;
-    char* levText = "Unknown level. ES: 0x";
-
+       uint32_t errorLevel = es & 0xE0U;
+       char* levText;
 
-       if (*errorStatus != 0) {
-       if (errorLevel & canLEVEL_BUS_OFF) {
-               levText = "CAN bus is off. ES: 0x";
-       }
-       else if (errorLevel & canLEVEL_PASSIVE) {
-               levText = "CAN bus in passive mode. ES: 0x";
-       }
-       else if (errorLevel & canLEVEL_WARNING) {
-               levText = "CAN bus in passive mode. ES: 0x";
-       }
-       else if (errorLevel == canLEVEL_ACTIVE) {
-               if (isFinal) {
-                       levText = "CAN is active. ES: 0x";
-                       *errorStatus = 0;
-               }
-               else levText = NULL;
-       }
-    }
-       else {
-               if (isFinal) {
-                       levText = "CAN no error. ES: 0x";
-               }
-               else levText = NULL;
+       switch (errorLevel) {
+       case canLEVEL_BUS_OFF:
+               levText = "Bus-Off";
+               break;
+       case canLEVEL_PASSIVE:
+               levText = "Error Passive";
+               break;
+       case canLEVEL_WARNING:
+               levText = "Warning";
+               break;
+       case canLEVEL_ACTIVE:
+               levText = "Bus-On";
+               break;
+       default:
+               levText = "Unknown";
        }
 
-       if (levText == NULL) return errorLevel;
+       rpp_sci_printf("CAN%d status: %s, ES: %#x\n", can_num, levText, es);
+}
+
+uint32_t canCheckForError(int can_num, uint32_t es)
+{
+       uint32_t errorLevel = es & 0xE0U;
 
-       rpp_sci_printf(str);
-       rpp_sci_printf(levText);
-       rpp_sci_printf("%h\r\n", errStat);
+       if (errorLevel != 0) {
+               canPrintStatus(can_num, es);
+       }
 
-    return errorLevel;
+       return errorLevel;
 }
 
 /**
@@ -114,7 +95,7 @@ uint32_t canCheckForError(canBASE_t *node, const char* str, uint32_t *errorStatu
  */
 int cmd_do_test_can_loopback(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 {
-       uint32_t can[2];
+       uint32_t can_src, can_dst;
        canBASE_t *canBases[3] = {canREG1, canREG2, canREG3};
        uint32_t canMailBoxes[3] = {canMESSAGE_BOX1, canMESSAGE_BOX2, canMESSAGE_BOX3};
        char* token = NULL;
@@ -141,37 +122,37 @@ int cmd_do_test_can_loopback(cmd_io_t *cmd_io, const struct cmd_des *des, char *
        // Get can ID 1
        if ((token = strtok(param[1], " ")) == NULL) {
 
-               rpp_sci_printf("ERROR: Parameter 1 expected.");
+               rpp_sci_printf("ERROR: Parameter 1 expected.\n");
                return 1;
        }
-       if (EOF == sscanf(token, "%d", &can[0])){
-               rpp_sci_printf("ERROR: unsigned number expected as param 1!");
+       if (EOF == sscanf(token, "%d", &can_src)){
+               rpp_sci_printf("ERROR: unsigned number expected as param 1!\n");
                return 1;
        }
        // Get can ID 2
        if ((token = strtok(NULL, " ")) == NULL) {
-               rpp_sci_printf("ERROR: Parameter 2 expected.");
+               rpp_sci_printf("ERROR: Parameter 2 expected.\n");
                return 1;
        }
-       if (EOF == sscanf(token, "%d", &can[1])){
-               rpp_sci_printf("ERROR: unsigned number expected as param 2!");
+       if (EOF == sscanf(token, "%d", &can_dst)){
+               rpp_sci_printf("ERROR: unsigned number expected as param 2!\n");
                return 1;
        }
        if ((token = strtok(NULL, " ")) != NULL) {
-               rpp_sci_printf("ERROR: More than 2 parameters detected!");
+               rpp_sci_printf("ERROR: More than 2 parameters detected!\n");
                return 1;
        }
-       if (can[0] == can[1]) {
-               rpp_sci_printf("ERROR: Destination equals source!);");
+       if (can_src == can_dst) {
+               rpp_sci_printf("ERROR: Destination equals source!\n");
                return 1;
        }
-       if (can[0] < 1 | can[1] > 3) {
-               rpp_sci_printf("Parameter out of range <1;3>!");
+       if (can_src < 1 | can_dst > 3) {
+               rpp_sci_printf("Parameter out of range <1;3>!\n");
                return 1;
        }
-       canSrc = canBases[can[0]-1];
-       canDst = canBases[can[1]-1];
-       canMsgBox = canMailBoxes[can[0]-1];
+       canSrc = canBases[can_src-1];
+       canDst = canBases[can_dst-1];
+       canMsgBox = canMailBoxes[can_src-1];
        canMsgReceived = xSemaphoreCreateCounting(1, 0);
        canMsgSent = xSemaphoreCreateCounting(1, 0);
 
@@ -196,7 +177,7 @@ int cmd_do_test_can_loopback(cmd_io_t *cmd_io, const struct cmd_des *des, char *
        canEnableErrorNotification(canSrc);
 
        for (i = 0; i < 100; i++) {             // Send 100 times the message
-               if (canCheckForError(canSrc, "TX", &canSendError, 0) != canLEVEL_ACTIVE) {
+               if (canCheckForError(can_src, canSendError) != canLEVEL_ACTIVE) {
                        break;
                }
                canTransmit(canSrc, canMsgBox, tx_data);
@@ -204,7 +185,7 @@ int cmd_do_test_can_loopback(cmd_io_t *cmd_io, const struct cmd_des *des, char *
                        txTimeOutCnt++;
                }
                else {
-                       if (canCheckForError(canSrc, "TX", &canSendError, 0) & canLEVEL_BUS_OFF) {
+                       if (canCheckForError(can_src, canSendError) & canLEVEL_BUS_OFF) {
                                break;
                        }
                        else {
@@ -216,16 +197,13 @@ int cmd_do_test_can_loopback(cmd_io_t *cmd_io, const struct cmd_des *des, char *
                                        if (canGetData(canDst, canMsgBox, rx_data))
                                                messagesReceived++;
 
-                                       if (canCheckForError(canDst, "RX", &canRecError, 0) & canLEVEL_BUS_OFF) {
+                                       if (canCheckForError(can_dst, canRecError) & canLEVEL_BUS_OFF) {
                                                break;
                                        }
                                }
                        }
                }
        }
-       rpp_sci_printf("CAN final error state:\r\n");
-       canCheckForError(canSrc, "TX", &canSendError, 1);
-       canCheckForError(canDst, "RX", &canRecError, 1);
        rpp_sci_printf("Messages transmitted: %d/100\r\n", messagesTransmitted);
        rpp_sci_printf("Messages received: %d/100\r\n", messagesReceived);
        rpp_sci_printf("TX timeouts: %d\r\n", txTimeOutCnt);
@@ -234,6 +212,8 @@ int cmd_do_test_can_loopback(cmd_io_t *cmd_io, const struct cmd_des *des, char *
        rpp_sci_printf("Src RX error counter: %d\r\n", (canSrc->EERC & 0xFF00U) >> 8);
        rpp_sci_printf("Dst TX error counter: %d\r\n", canDst->EERC & 0xFFU);
        rpp_sci_printf("Dst RX error counter: %d\r\n", (canDst->EERC & 0xFF00U) >> 8);
+       canPrintStatus(can_src, canSendError);
+       canPrintStatus(can_dst, canRecError);
 
        canDisableErrorNotification(canDst);
        canDisableErrorNotification(canSrc);
@@ -251,24 +231,36 @@ cmd_des_t const cmd_des_test_can_loopback={
     "=== Command syntax ===\n"
     "\n"
     "   cantest <SOURCE> <DESTINATION>\n"
-    "where <SOURCE> and <DESTINATION> is a number in range 1-3 and <SOURCE>\n"
-    "is not equal <DESTINATION>.\n"
+    "\n"
+    "where <SOURCE> and <DESTINATION> are different numbers in range 1-3.\n"
     "\n"
     "=== Description ===\n"
     "\n"
-    "This command tests CAN bus by sending and receiving messages through\n"
-    "external loopback. When the bus is in fault state, this command resets it\n" /* FIXME: What it is fault state? */
-    "into functional state.\n"
+    "This command tests CAN communication by sending and receiving messages\n"
+    "through external loopback. At the beginning, the involved CAN\n"
+    "controller are initialized to the Bus-On state.\n"
+    "\n"
+    "The command sends 100 messages and measures the numbers of TX errors,\n"
+    "RX errors and detected timeouts. At the end, these statistics are\n"
+    "printed as well as the status of the involved CAN controllers.\n"
     "\n"
-    "The command sends a message 100 times and measures the numbers of TX\n"
-    "errors, RX errors and detected timeouts. At the end, the state of the\n"
-    "bus and the number of errors is printed.\n"
+    "When an error is detected during the test, the status of faulty CAN\n"
+    "controller is printed immediately.\n"
     "\n"
     "=== Example ===\n"
     "\n"
     "   --> cantest 1 2\n"
-    "\n"
-    "Sends 100 times message from CAN1 to CAN2\n",
+    "   Testing CAN loopback\n"
+    "   Messages transmitted: 100/100\n"
+    "   Messages received: 100/100\n"
+    "   TX timeouts: 0\n"
+    "   RX timeouts: 0\n"
+    "   Src TX error counter: 0\n"
+    "   Src RX error counter: 0\n"
+    "   Dst TX error counter: 0\n"
+    "   Dst RX error counter: 0\n"
+    "   CAN1 status: Bus-On, ES: 0x8\n"
+    "   CAN2 status: Bus-On, ES: 0x10\n",
     CMD_HANDLER(cmd_do_test_can_loopback), (void *)&cmd_list_can
 };
 
index a2de388b5523ad03a896418a7b41adfd311fe493..77e404e588faa061036bd814efed88b8cd498b1f 100644 (file)
@@ -57,10 +57,10 @@ int cmd_do_hbr_enable(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]
 
        ret = rpp_hbr_enable(period);
        if (ret == FAILURE) {
-               rpp_sci_printf("Enable procedure failed.");
+               rpp_sci_printf("Enable procedure failed.\n");
        }
 
-       return cmd_opchar_replong(cmd_io, param, period, 0, 16);
+       return cmd_opchar_replong(cmd_io, param, period, 0, 10);
 }
 
 /**
@@ -85,14 +85,14 @@ int cmd_do_hbr_control(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[
 
        ret = rpp_hbr_control((double)cmd/(double)100);
        if (ret == -1) {
-               rpp_sci_printf("H-bridge not enabled.");
+               rpp_sci_printf("H-bridge not enabled.\n");
                return -1;
        }
        else if (ret == -2) {
-               rpp_sci_printf("Command out of range.");
+               rpp_sci_printf("Command out of range.\n");
                return -CMDERR_BADPAR;
        }
-       return cmd_opchar_replong(cmd_io, param, cmd, 0, 16);
+       return cmd_opchar_replong(cmd_io, param, cmd, 0, 10);
 }
 
 /**
@@ -107,9 +107,9 @@ int cmd_do_hbr_disable(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[
        int ret;
        ret = rpp_hbr_disable();
        if (ret == FAILURE) {
-               rpp_sci_printf("H-bridge already disabled.");
+               rpp_sci_printf("H-bridge already disabled.\n");
        }
-       return cmd_opchar_replong(cmd_io, param, ret, 0, 16);
+       return cmd_opchar_replong(cmd_io, param, ret, 0, 10);
 }
 
 #endif /* DOCGEN */
@@ -121,24 +121,26 @@ cmd_des_t const cmd_des_hbr_enable = {
     "=== Command syntax ===\n"
     "\n"
     "   hbrenable:<PER>\n"
-    "where <PER> is PWM period in us\n"
+    "\n"
+    "where <PER> is PWM period in microseconds.\n"
     "\n"
     "=== Description ===\n"
     "\n"
-    "This command enables the H-bridge, i.e. the enable signal is set,\n"
-    "watchdog reset task is started and PWM is configured with specified\n"
-    "period and duty cycle 0%.\n"
+    "This command enables the H-bridge (HBR pin), i.e. the enable signal\n"
+    "the H-bridge chip is set, the watchdog reset task is started and the\n"
+    "PWM is configured with the specified period and duty cycle 0%.\n"
     "\n"
-    "If the period is lower than zero, default frequency 18kHz is used\n"
-    "instead. This command should be called before any other HBR command is\n"
-    "used. If HBR is already enabled, an error is returned.\n"
+    "If the period is lower than zero, the default frequency of 18kHz is\n"
+    "used instead. This command should be called before any other command\n"
+    "starting with hbr is used. If H-bridge is already enabled, an error is\n"
+    "printed.\n"
     "\n"
     "=== Example ===\n"
     "\n"
     "   --> hbrenable:1000\n"
-    "   hbrenable=3E8\n"       /* FIXME: Why hex */
+    "   hbrenable=1000\n"
     "\n"
-    "Enables HBR with period 1kHz. HBR output is still inactive, but ready\n" /* FIXME: What does it mean "inactive"? */
+    "Enables HBR with period 1kHz. HBR output is still inactive, but ready\n"
     "for other commands.\n",
     CMD_HANDLER(cmd_do_hbr_enable), (void *)&cmd_list_hbr
 };
@@ -159,27 +161,25 @@ cmd_des_t const cmd_des_hbr_control = {
     "The command sets the direction and the size of the voltage at HBR\n"
     "output.\n"
     "\n"
-    "When <SPEED> is 0, the output is inactive.\n"
-    "\n"
     "HBR has to be enabled by hbrenable command before calling this\n"
     "command.\n"
     "\n"
     "=== Example ===\n"
     "\n"
     "   --> hbrcontrol:-25\n"
-    "   hbrcontrol=FFFFFFE7\n" /* FIXME: Why hex? */
+    "   hbrcontrol=-25\n"
     "\n"
-    "Activates motor rotation to the left with 25% speed.\n"
+    "Rotates the motor to the left with 25% speed.\n"
     "\n"
     "   --> hbrcontrol:25\n"
-    "   hbrcontrol=19\n"
+    "   hbrcontrol=25\n"
     "\n"
-    "Activates motor rotation to the right with 25% speed.\n"
+    "Rotates the motor to the right with 25% speed.\n"
     "\n"
     "   --> hbrcontrol:0\n"
     "   hbrcontrol=0\n"
     "\n"
-    "Deactivates motor rotation.\n", /* FIXME: What does it mean "deactivate"? */
+    "Stops the motor.\n",
     CMD_HANDLER(cmd_do_hbr_control), (void *)&cmd_list_hbr
 };
 
@@ -197,7 +197,7 @@ cmd_des_t const cmd_des_hbr_disable = {
     "stopped and the enable signal is cleared. The watchdog task is left\n"
     "running, because it is harmless.\n"
     "\n"
-    "After H-bridge is disabled, it can not be controlled by any command\n"
+    "After H-bridge is disabled, it cannot be controlled by any command\n"
     "until it is enabled again by the hbrenable command.\n"
     "\n"
     "=== Example ===\n"
index 0707fa97ae515e5ddf1cd01730f9ce3effc61804..5509f1cf2f03f7dab8e09c6ad5cdcb6781cc1968 100644 (file)
@@ -57,10 +57,8 @@ int cmd_do_read_hout_ifbk_values(cmd_io_t *cmd_io, const struct cmd_des *des, ch
     if (ret < 0)
        return ret;
 
-    rpp_sci_printf("HOUT_IFBK: values: ");
-    /* conversion results :                                       */
     for (i = 0; i < PORT_HOUTIFBK_CHANNEL_NUM; i++) {
-       rpp_sci_printf("\r\nChannel: %d\tvalue: %d %h", i+1, values[i], values[i]);
+       rpp_sci_printf("HOUT%d: %d\n", i+1, values[i]);
     }
     return 0;
 }
@@ -95,6 +93,7 @@ int cmd_do_test_hout_fault(cmd_io_t *cmd_io, const struct cmd_des *des, char *pa
                rpp_sci_printf("Bad pin selected");
                break;
        }
+       rpp_sci_printf("\n");
        return 0;
 }
 
@@ -137,8 +136,8 @@ int cmd_do_hout_pwm(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
                double period = hout_pwm_get_period(pin);
                uint32_t duty = hout_pwm_get_duty(pin);
 
-               rpp_sci_printf("hout%d_pwm_period: %d\r\nhout%d_pwm_duty: %d/%", pin, period, pin, duty);
-           return 0;
+               rpp_sci_printf("houtpwm%d_period=%g\r\nhoutpwm%d_duty=%u\%", pin+1, period, pin+1, duty);
+               return 0;
          }
 }
 
@@ -195,22 +194,33 @@ int cmd_do_hout_pwm_stop(cmd_io_t *cmd_io, const struct cmd_des *des, char *para
 /** Command descriptor for test hout fault state command */
 cmd_des_t const cmd_des_test_hout_fail = {
     0, 0,
-    "houtfail","Test if some HOUT pin is in the fault state",
+    "houtfail#","Test if some HOUT pin is in the fault state",
     "=== Command syntax ===\n"
     "\n"
-    "   houtfail <PIN>\n"      /* FIXME: Why it is not hourfail<PIN>? */
+    "   houtfail<PIN>\n"
     "where <PIN> is in range 1-6\n"
     "\n"
     "=== Description ===\n"
     "\n"
     "This command tests, if HOUT pin is in a good condition. When the\n"
-    "circuit controlling HOUT pin detects some failure, it starts to\n"
-    "generate a signal on HOUT_DIAG output. This command is supposed to\n"
-    "detect such a state.\n"
+    "circuit controlling HOUT pin detects some failure, it signals that on\n"
+    "HOUT_DIAG output. This command is supposed to read this output and\n"
+    "print its state.\n"
+    "\n"
+    "Possible outputs of this command:\n"
+    "* OK - no failure detected\n"
+    "* FAIL - a failure detected\n"
+    "* NOT RUNNING - PWM was set set up and started\n"
+    "\n"
+    "Note: Before using this command, houtpwmstart and houtpwm commands\n"
+    "should be called.\n"
     "\n"
     "=== Example ===\n"
     "\n"
-    "   --> houtfail 1\n"
+    "   --> houtpwm6:(1000,25)\n"
+    "   --> houtpwmstart6\n"
+    "   --> houtfail6\n"
+    "   OK\n"
     "\n"
     "Detects the state of the HOUT1 and prints OK, FAIL or NOT RUNNING.\n",
     CMD_HANDLER(cmd_do_test_hout_fault), (void *)&cmd_list_hout
@@ -227,14 +237,24 @@ cmd_des_t const cmd_des_read_hifbk={
     "=== Description ===\n"
     "\n"
     "The command reads analog values from HOUT_IFBK pins and prints\n"
-    "them in HOUTX-value table.\n",
+    "them in a table.\n"
+    "\n"
+    "=== Example ===\n"
+    "\n"
+    "  --> houtifbk\n"
+    "  HOUT1: 0\n"
+    "  HOUT2: 134223784\n"
+    "  HOUT3: 134223784\n"
+    "  HOUT4: 0\n"
+    "  HOUT5: 38924\n"
+    "  HOUT6: 1342231444\n",
    CMD_HANDLER(cmd_do_read_hout_ifbk_values), (void *)&cmd_list_hout
 };
 
 /** Command descriptor for HOUT set PWM command */
 cmd_des_t const cmd_des_hout_pwm={
     0, CDESM_OPCHR|CDESM_RW,
-    "houtpwm*","Set or get actual PWM parameters", /* FIXME: Why is here * and other commands have #? */
+    "houtpwm#","Set or get actual PWM parameters",
     "=== Command syntax ===\n"
     "\n"
     "   houtpwm<PIN>:(<PER>,<DUTY>)\n"
@@ -243,8 +263,8 @@ cmd_des_t const cmd_des_hout_pwm={
     "* <PIN> is a number in range 1-6\n"
     "* : means set parameters\n"
     "* ? means get parameters\n"
-    "* <PER> is a number greater than 0\n"
-    "* <DUTY> is a number in range 0-100\n"
+    "* <PER> is a length of the PWM period in microseconds\n"
+    "* <DUTY> is a the PWM duty cycle in percent (0-100)\n"
     "\n"
     "=== Description ===\n"
     "\n"
@@ -257,7 +277,9 @@ cmd_des_t const cmd_des_hout_pwm={
     "HOUT1 PWM will have the period of 1ms and will be active for 25% of\n"
     "this period.\n"
     "\n"
-    "   --> hbrpwm1?\n"
+    "   --> houtpwm1?\n"
+    "   houtpwm1_period=1000\n"
+    "   houtpwm1_duty=25\n"
     "\n"
     "Prints the actual period of HOUT1 PWM in microseconds and the duty\n"
     "cycle in percents.\n",
@@ -275,14 +297,16 @@ cmd_des_t const cmd_des_hout_pwm_start={
     "\n"
     "=== Description ===\n"
     "\n"
-    "If HOUT PWM was previously set by the houtpwm command, this command\n"
-    "starts to generate the PWM signal on the specified pin.\n"
+    "This command starts to generate the PWM signal on the specified HOUT\n"
+    "pin. The HOUT PWM has to be previously set by the houtpwm command,\n"
+    "otherwise an error is printed.\n"
     "\n"
     "=== Example ===\n"
     "\n"
+    "   --> houtpwm1:(1000,25)\n"
     "   --> houtpwmstart1\n"
     "\n"
-    "HOUT1 PWM generation will be activated.\n",
+    "HOUT1 PWM generation will be started.\n",
     CMD_HANDLER(cmd_do_hout_pwm_start), (void *)&cmd_list_hout
 };
 
index c46fe0d56dabc83a2da5f9ca6e05b44989b5d4c3..23e835342b4a1fc21fabd012b82314dfdd2de78b 100644 (file)
@@ -81,11 +81,12 @@ int cmd_do_pin_val(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
            if (val != 0 && val != 1)
                      return -CMDERR_BADPAR;
            hal_gpio_pin_set_value(*desc, (uint32_t) val);
+           cmd_opchar_replong(cmd_io, param, val, 0, 0);
            return val;
          }
          else{
                uint32_t pin_value = hal_gpio_pin_get_value(*desc);
-           return cmd_opchar_replong(cmd_io, param, pin_value, 0, 0);
+               return cmd_opchar_replong(cmd_io, param, pin_value, 0, 0);
          }
 }
 
@@ -125,6 +126,7 @@ int cmd_do_pin_dir(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) {
            }
 
            hal_gpio_pin_conf(*desc);
+           cmd_opchar_replong(cmd_io, param, val, 0, 0);
            return val;
          }
          else{
@@ -219,24 +221,26 @@ cmd_des_t const cmd_des_pin_val={
        "\n"
        "=== Description ===\n"
        "\n"
-       "This command is used to set or get a value of the particular pin.\n"
+       "This command is sets or gets a value of the particular pin.\n"
        "\n"
        "The list of valid pin names can be obtained with pinlist command.\n"
        "\n"
-       "Most of the pins are accessible indirectly via highlevel commands\n"
-       "HBR_EN is, for example, controlled by the hbrenable command. This command\n"
-       "serves as supplement to highlevel commands for testing purpose.\n"
+       "Most of the pins are accessible indirectly via other highlevel\n"
+       "commands. HBR_EN is, for example, controlled by the hbrenable command.\n"
+       "This command serves as supplement to highlevel commands for testing\n"
+       "purpose.\n"
        "\n"
        "=== Example ===\n"
        "\n"
-       "   --> pinvalHBREN:1\n" /* FIXME: No output */
+       "   --> pinvalHBREN:1\n"
+       "   pinvalHBREN=1\n"
        "\n"
-       "Sets the HBR_EN pin to 1\n"
+       "Sets the HBR_EN pin to 1.\n"
        "\n"
        "   --> pinvalHBREN?\n"
        "   pinvalHBREN=1\n"
        "\n"
-       "Gets a value of the HBR_EN pin\n",
+       "Gets a value of the HBR_EN pin.\n",
        CMD_HANDLER(cmd_do_pin_val), (void *)&cmd_list_pin
 };
 
@@ -260,20 +264,22 @@ cmd_des_t const cmd_des_pin_dir={
        "\n"
        "The list of valid pin names can be obtained with pinlist command.\n"
        "\n"
-       "Most of the pins are accessible indirectly via highlevel commands\n"
-       "HBR_EN is, for example, controlled by the hbrenable command. This command\n"
-       "serves as supplement to highlevel commands for testing purpose.\n"
+       "Most of the pins are accessible indirectly via other highlevel\n"
+       "commands HBR_EN is, for example, controlled by the hbrenable command.\n"
+       "This command serves as supplement to highlevel commands for testing\n"
+       "purpose.\n"
        "\n"
        "=== Example ===\n"
        "\n"
-       "   --> pindirHBREN:1\n" /* FIXME: No output */
+       "   --> pindirHBREN:1\n"
+       "   pindirHBREN=1\n"
        "\n"
-       "Sets the HBR_EN pin as output\n"
+       "Sets the HBR_EN pin as output.\n"
        "\n"
        "   --> pindirHBREN?\n"
        "   pindirHBREN=1\n"
        "\n"
-       "Get the direction of the HBR_EN pin\n",
+       "Gets the direction of the HBR_EN pin.\n",
        CMD_HANDLER(cmd_do_pin_dir), (void *)&cmd_list_pin
 };
 
index 89f6b6f9aa887355b0477468cdc6c395f76c7b68..0da51c1bc17a4c12c792477d0b45d7b656913376 100644 (file)
@@ -117,15 +117,15 @@ cmd_des_t const cmd_des_port_val={
     "=== Example ===\n"
     "\n"
     "   --> portvalLOUT:(FA)\n"        /* FIXME: This example returns ERROR 20 */
-    "LOUT1 = 0\n"              /* FIXME: This is an exaple output? */
+    "   LOUT1 = 0\n"
     "\n"
-    "LOUT2 = 1\n"
+    "   LOUT2 = 1\n"
     "\n"
-    "LOUT3 = 0\n"
+    "   LOUT3 = 0\n"
     "\n"
-    "LOUT4 = 1\n"
+    "   LOUT4 = 1\n"
     "\n"
-    "LOUT5-8 = 1\n",
+    "   LOUT5-8 = 1\n",
     CMD_HANDLER(cmd_do_port_val), (void *)&cmd_list_port
 };
 
index d6dde970808f2977ea75f40894ccb3efb8083663..c5ed4559349958cc01b955059d530fd49451afde 100644 (file)
@@ -122,13 +122,16 @@ int spimst_print_rx(struct spi_drv *ifc, int status, int addr, uint8_t *buf)
 {
        int i;
 
-       rpp_sci_printf("SPI! %h ", addr);
-       if (status < 0)
-               rpp_sci_printf("FAIL ");
+       if (status < 0) {
+               rpp_sci_printf("spirx failed: %d\n", status);
+               return;
+       }
 
-       rpp_sci_printf(" RX(");
+       rpp_sci_printf("spirx:%#x(", addr);
        for (i = 0; i < status; i++) {
-               rpp_sci_printf("%h,", buf[i]);
+               rpp_sci_printf("%#x", buf[i]);
+               if (i < status-1)
+                       rpp_sci_printf(",");
        }
        rpp_sci_printf(")\n");
 
@@ -198,22 +201,22 @@ cmd_des_t const cmd_des_spi_translate={
        "\n"
        "   spitr<NAME>?(<CMD>,<RESP>)\n"
        "where\n"
-       "* <NAME> is a string specifying the name of the peripheral\n" /* FIXME: what are the valid names? */
+       "* <NAME> is a string specifying the name of the peripheral (one of DINSPI, LOUT, DAC12, DAC34, HBR, FRAY1 and FRAY2)\n"
        "* <CMD> is a hexadecimal number in range 0 - FFFFFFFF\n"
        "* <RESP> is a hexadecimal number in range 0 - FFFFFFFF\n"
        "\n"
        "=== Description ===\n"
        "\n"
-       "This command can translate a response from SPI from many different\n"
-       "peripherals into human readable form. Standard SPI response is in the\n"
+       "This command translates a response from SPI from many different\n"
+       "peripherals into a human readable form. The SPI response is in the\n"
        "form of a hexadecimal number, which encodes the information. This\n"
        "commands takes this response, the command which produced this\n"
        "response, the name of the peripheral and translates the response into\n"
        "the attribute-value table.\n"
        "\n"
        "=== Example ===\n"
-       "\n"
-       " --> spitrFRAY1?(FFFF,2B10)\n" /* FIXME: Hangs!!! */
+       "FIXME: Hangs!!!\n"
+       " --> spitrFRAY1?(FFFF,2B10)\n"
        "\n"
        "Translates response 0x2B10 returned by command 0xFFFF into a human\n"
        "readable form.\n",
@@ -235,12 +238,13 @@ cmd_des_t const cmd_des_spimst = {
        "=== Description ===\n"
        "\n"
        "The command sends given data to the SPI peripheral and prints the\n"
-       "response.\n"
+       "response. The response contains the address and the received data in\n"
+       "parentheses.\n"
        "\n"
        "=== Example ===\n"
        "\n"
        "   --> spimst1:0(7F,00,00)\n"
-       "   SPI!  RX()\n"       /* FIXME: What it means? */
+       "   spirx:0x0(0x3f,0xc0,0xff)\n"
        "\n"
        "Sends reset command (0x7F0000) to the DIN peripheral.\n",
        CMD_HANDLER(cmd_do_spimst), (void *)&cmd_list_spi
index 51db529f9a542e58282164430a26cb1bf2ff145e..705a635bb6dca35bd2ce3c98caa814a9deccfc4d 100644 (file)
@@ -118,28 +118,34 @@ int cmd_do_power_off(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 /** Command descriptor for poweron */
 cmd_des_t const cmd_des_power_on = {
     0, 0,
-    "poweron","Set VBATEN and VBAT1EN using PWM", /* FIXME: Why PWM? */
+    "poweron","Enable VBATEN and VBAT1EN power supply by using PWM hack",
     "=== Command syntax ===\n"
     "\n"
     "   poweron\n"
     "\n"
     "=== Description ===\n"
     "\n"
-    "This command turns on the VBAT voltage and slowly charges capacitors\n"
-    "connected to VBAT1 by using PWM signal with scalable timing.\n"
+    "This command tries to work around error on VBAT power supply wiring\n"
+    "and attempts to switch the power supply on.\n"
+    "\n"
+    "It turns on the VBAT voltage by slowly charging the capacitors\n"
+    "connected to the VBAT1 signal by using the software-generated PWM\n"
+    "signal with increasing duty cycle.\n"
     "\n"
     "The poweron command has to be launched before any access to any SPI\n"
-    "peripherals, otherwise they will not work.\n"
+    "peripherals, otherwise they will not work (or the power supply has to\n"
+    "be electrically bypassed).\n"
     "\n"
-    "Please note that parameters for the PWM signal may change from device\n" /* FIXME: I don't understand this. */
-    "to device and it might be necessary to tune them for each device.\n",
+    "Please note that parameters for the PWM signal may change from device\n"
+    "to device and it might be necessary to tune them (in source code) for\n"
+    "each device.\n",
     CMD_HANDLER(cmd_do_power_on), (void *)&cmd_list_vbat
 };
 
 /** Command descriptor for poweroff */
 cmd_des_t const cmd_des_power_off = {
     0, 0,
-    "poweroff","Clear VBATEN and VBAT1EN",
+    "poweroff","Disables VBATEN and VBAT1EN power supply",
     "=== Command syntax ===\n"
     "\n"
     "   poweroff\n"