📄 can_shell.h
字号:
/************************************************************************
*
* Freescale Semicondactor
* ALL RIGHTS RESERVED
* (c) Copyright 2004Freescale Semiconductor
*
*************************************************************************
*
* FILE NAME: can_shell.h
*
* PURPOSE: Header file for can_shell.c
*
* AUTHOR(s): Andrej A. Oulianov, Igor Byeda
*
*************************************************************************/
#ifndef _CAN_SHELL_H
#define _CAN_SHELL_H
//#include "sys_global.h"
#include "shell.h"
#include "general.h"
#include "can_unit.h"
/************************************************************************
*
* CAN subshell
*
*************************************************************************/
/* Definitions
**************/
static const char CAN_SHL_PROMPT_STR[] = "iGW_CAN> ";
#define CAN_SHL_HELP_FORMAT ("%8s %-40s %s %s\n")
#define CAN_SHL_SET_OPT_FORMAT ("%12s: ")
#define CAN_OUT_TBL_NAMES (" SYNC PROPSEG PSEG1 PSEG2 RJW SAMP\n")
#define CAN_OUT_TBL_LINE (" -----------------------------------\n")
#define CAN_OUT_TBL_FRMT (" 1 %d %d %d %d %d\n")
#define CAN_OUT_BR_FRMT (" Baudrate %d kBit/s\n")
#define CAN_OUT_AD_FRMT (" Force baudrate Autodetect at startup: %s\n")
#define CAN_OUT_SC_FRMT (" S-clock: %d MHz, PRESDIV: %d\n")
#define CAN_OUT_SP_FRMT (" Sampling point: %d%%, BTL cycles: %d\n")
#define CAN_SHL_SET_OPT_ERR ("Error: Invalid set option: %s\n")
#define CAN_SHL_SET_STD_ERR ("Error: The value is not in StandartBaudrateList: %d (use 'set std')\n")
#define CAN_SHL_SET_PRESDIV_ERR ("Error: Invalid PRESDIV value: %d. Should be [0..255]\n")
#define CAN_SHL_SET_BT_1_ERR ("Error: Should be nTQ = 1+PROPSEG+PSEG1+PSEG2\n")
#define CAN_SHL_SET_BT_2_ERR ("Error: Invalid PROPSEG value: %d. Should be [1..8]\n")
#define CAN_SHL_SET_BT_3_ERR ("Error: Invalid PSEG1 value: %d. Should be [1..8]\n")
#define CAN_SHL_SET_BT_4_ERR ("Error: Invalid PSEG2 value: %d. Should be [2..8]\n")
#define CAN_SHL_SET_RJW_ERR ("Error: Invalid RJW value: %d. Should be [1..4]\n")
#define CAN_SHL_SET_SAMP_ERR ("Error: Invalid SAMP value: %d. Should be [1,3]\n")
/* Function Prototypes
**********************/
void can_shl_init(void);
void can_shl_exit(void);
void can_shl_show(struct shell_t *, int, char **);
void can_shl_set(struct shell_t *, int, char **);
void can_shl_speed(struct shell_t *, int, char **);
void can_shl_mode(struct shell_t *, int, char **);
void can_shl_autodt(struct shell_t *, int, char **);
void can_shl_help(struct shell_t *, int, char **);
void can_shl_set_std(struct shell_t *, int, char **);
void can_shl_set_presdiv(struct shell_t *, int, char **);
void can_shl_set_bitparam(struct shell_t *, int, char **);
void can_shl_set_rjw(struct shell_t *, int, char **);
void can_shl_set_samp(struct shell_t *, int, char **);
void can_shl_speed_auto(struct shell_t *, int, char **);
void can_shl_speed_calc(struct shell_t *, int, char **);
void can_shl_speed_apply(struct shell_t *, int, char **);
void can_shl_mode_start(struct shell_t *, int, char **);
void can_shl_mode_stop(struct shell_t *, int, char **);
void can_shl_autodt_on(struct shell_t *, int, char **);
void can_shl_autodt_off(struct shell_t *, int, char **);
/* The table of the SET command parameters
*****************************************/
static struct shl_set_cmd_t can_shl_set_cmd[] =
{
{"std", can_shl_set_std, "<one of the standard speed values (kBit/s)>"},
{"PRESDIV", can_shl_set_presdiv, "<PREScaler DIVide factor>"},
{"bitparam", can_shl_set_bitparam, "<nTQ PROPSEG PSEG1 PSEG2 values>"},
{"RJW", can_shl_set_rjw, "<ResynchronizationJumpWidth value>"},
{"SAMP", can_shl_set_samp, "<SAMPling mode [1,3]>"}
};
#define CAN_SHELL_SET_CMD_NUM (sizeof(can_shl_set_cmd)/sizeof(struct shl_set_cmd_t))
/* The table of the SPEED command parameters
*****************************************/
static struct shl_set_cmd_t can_shl_speed_cmd[] =
{
{"auto", can_shl_speed_auto, "autodetect CAN Baudrate"},
{"calc", can_shl_speed_calc, "calculate speed before apply to HW"},
{"apply", can_shl_speed_apply, "apply bittiming settings to HW"}
};
#define CAN_SHELL_SPEED_CMD_NUM (sizeof(can_shl_speed_cmd)/sizeof(struct shl_set_cmd_t))
/* The table of the MODE command parameters
*****************************************/
static struct shl_set_cmd_t can_shl_mode_cmd[] =
{
{"run", can_shl_mode_start, "CAN unit START"},
{"stop", can_shl_mode_stop, "CAN unit STOP"}
};
#define CAN_SHELL_MODE_CMD_NUM (sizeof(can_shl_mode_cmd)/sizeof(struct shl_set_cmd_t))
/* The table of the AUTODT command parameters
*****************************************/
static struct shl_set_cmd_t can_shl_autodt_cmd[] =
{
{"on", can_shl_autodt_on, "Autodetection ENABLE"},
{"off", can_shl_autodt_off, "Autodetection DISABLE"}
};
#define CAN_SHELL_AUTODT_CMD_NUM (sizeof(can_shl_autodt_cmd)/sizeof(struct shl_set_cmd_t))
#endif /* _CAN_SHELL_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -