/* This file is part of the Simba project.  */
int board_pin_string_to_device_index(const char *str_p)
/* This file is part of the Simba project.  */
int board_pin_string_to_device_index(const char *str_p)
{
    long pin;
    if (tolower((int)str_p[0]) == 'd') {
        if (std_strtol(&str_p[1], &pin) == NULL) {
            return (-ENODEV);
        }
        if ((pin < 2) || (pin > 13)) {
            return (-ENODEV);
        }
    } else if (tolower((int)str_p[0]) == 'a') {
        if (std_strtol(&str_p[1], &pin) == NULL) {
            return (-ENODEV);
        }
        if ((pin < 0) || (pin > 5)) {
            return (-ENODEV);
        }
        pin += 14;
    } else if (strcmp(str_p, "led") == 0) {
        pin = 13;
    } else if (strcmp(str_p, "rx") == 0) {
        pin = 0;
    } else if (strcmp(str_p, "tx") == 0) {
        pin = 1;
    } else {
        return (-ENODEV);
    }
    return (pin);
}