/*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
+ * Copyright (C) 2012-2013, 2015 Czech Technical University in Prague
*
* Created on: 28.2.2013
*
* Authors:
* - Michal Horn
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * This document contains proprietary information belonging to Czech
+ * Technical University in Prague. Passing on and copying of this
+ * document, and communication of its contents is not permitted
+ * without prior written authorization.
*
* File : cmd_fray.c
*
#ifndef DOCGEN
+#include "drv/port_def.h"
#include "rpp/rpp.h"
-#include "drv/fray.h"
#include "cmdproc_utils.h"
-#include "hal/hal.h"
#include "cmdproc.h"
-#include "sys/ti_drv_fray.h"
+#include "spi_resp_transl.h"
/**
* This structure contains global FlexRay configuration.
{
char *p;
int pin;
- uint32_t numCmdDesc;
- int i;
- uint32_t numFieldDesc;
p = param[1];
if (sscanf(p, "%d", &pin) != 1)
if (Fr_spi_transfer(pin) != 0) return -CMDERR_BADDIO;
- spitr_reg_translate_table_t translatedData;
- const spitr_cmd_map_t *cmdDesc = get_spi_cmd_map(PORT_NAME_FRAY1, -1, &numCmdDesc);
- if (cmdDesc == NULL) return -CMDERR_BADREG;
-
- const spitr_field_desc_t *fieldDescs = get_spi_field_desc(cmdDesc, numCmdDesc, Fr_spi_get_cmd(pin), &numFieldDesc);
- if (fieldDescs == NULL)
+ const spitr_cmd_desc_t *cmd_desc = get_spi_cmd_desc(&spitr_port_cmds[PORT_ID_FRAY1],
+ Fr_spi_get_cmd(pin));
+ if (cmd_desc == NULL)
return -CMDERR_BADPAR;
uint32_t fr_spi_response = Fr_spi_response(pin);
uint32_t lsbResponse = 0 | ((fr_spi_response & 0xFF) << 8) | ((fr_spi_response & 0xFF00) >> 8);
- spitr_fill_tr_table(fieldDescs, numFieldDesc, lsbResponse, &translatedData);
- for (i = 0; i < translatedData.num_rows; i++) {
- rpp_sci_printf("%s: %x\r\n", translatedData.row[i].field_name, translatedData.row[i].value);
- }
+
+ spitr_print_resp(cmd_desc, lsbResponse);
return 0;
}