/* If the function returns a 0 it means no conflicting procedure has been initiated. Otherwise it returns the appropriate BLE error code to send. */
uint8_t ble_ll_ctrl_proc_with_instant_initiated(struct ble_ll_conn_sm *connsm, uint8_t req_ctrl_proc)
/* If the function returns a 0 it means no conflicting procedure has been initiated. Otherwise it returns the appropriate BLE error code to send. */
uint8_t ble_ll_ctrl_proc_with_instant_initiated(struct ble_ll_conn_sm *connsm, uint8_t req_ctrl_proc)
{
    uint8_t err;
    switch (connsm->cur_ctrl_proc) {
    case BLE_LL_CTRL_PROC_PHY_UPDATE:
    case BLE_LL_CTRL_PROC_CONN_UPDATE:
    case BLE_LL_CTRL_PROC_CONN_PARAM_REQ:
    case BLE_LL_CTRL_PROC_CHAN_MAP_UPD:
        if (req_ctrl_proc == connsm->cur_ctrl_proc) {
            err = BLE_ERR_LMP_COLLISION;
        } else if ((connsm->cur_ctrl_proc == BLE_LL_CTRL_PROC_CONN_UPDATE) &&
                   (req_ctrl_proc == BLE_LL_CTRL_PROC_CONN_PARAM_REQ)) {
            err = BLE_ERR_LMP_COLLISION;
        } else {
            err = BLE_ERR_DIFF_TRANS_COLL;
        }
        break;
    default:
        err = 0;
    }
    return err;
}