3. Custom Test

3.1. Overview

Besides the built-in tests in the PLT, it is possible to add a number of custom specific tests.

_images/custom_test.png

Fig. 3 Custom Test

Custom tests can have multiple instances with different settings and meaningful names. Tests can be added and removed using the two buttons (- and +) at the bottom right side of each panel. When enabled, the PLT software will send an HCI command through UART to activate a customer defined test that will run on the DUTs. The HCI custom test command will contain a single byte as data (the Command ID byte), to be used mainly as identification for a specific test in the firmware.

A default custom test is already present in the production test firmware and implemented functionality is to respond with the same Command ID. Otherwise, the test will be considered as failed. Each of the custom tests will create a log entry with the custom test number and result in the log file.

The default custom test looks as follows:

void hci_custom_action(dgtl_msg_t *msg)
{
      plt_cmd_hci_custom_action_t *cmd = (plt_cmd_hci_custom_action_t *) msg;
      dgtl_msg_t *msg_evt;
      plt_evt_hci_custom_action_t *evt;

      msg_evt = init_response_evt(&cmd->hci_cmd, sizeof(*evt));
      evt = (plt_evt_hci_custom_action_t *) msg_evt;

      evt->custom_action = cmd->custom_action;

      dgtl_send(msg_evt);
}
Code 1

The hci_custom_action() can be found in the file plt_fw.c in the PLT software.

3.2. Custom code

To implement the custom test code a switch() statement needs to be added to the existing hci_custom_action() to catch the Command ID. For the specific custom test, the necessary code needs to be embedded in a case statement with the relevant Command ID. Additional custom tests can be added using more case statements with a unique Command ID. As Default case the Command ID needs to returned to the PLT software.

The code structure should look like:

The default custom test looks as follows:

void hci_custom_action(dgtl_msg_t *msg)
{
        plt_cmd_hci_custom_action_t *cmd = (plt_cmd_hci_custom_action_t *) msg;
        dgtl_msg_t *msg_evt;
        plt_evt_hci_custom_action_t *evt;

        msg_evt = init_response_evt(&cmd->hci_cmd, sizeof(*evt));
        evt = (plt_evt_hci_custom_action_t *) msg_evt;

        switch(cmd->custom_action)
        {
           case 0x01:      */ Command ID /*
           {
                   Insert testcode here.
                   break;
           }
           case 0x02:
           {
                   Insert 2nd testcode here
                   break;
           }

           default:
           {
                   evt->custom_action = cmd->custom_action;
                   break;
           }

        }
        dgtl_send(msg_evt);
}
Code 2

Every case statement should return an event code (evt->custom_action). If the event code is equal to the Command ID (cmd->custom_action) the PLT software considers the test as passed. Any other return value is considered as failed.