FIX 1.铁芯与平台交互增加设置,读取上传间隔参数;
parent
286ae19de0
commit
be5c095792
@ -0,0 +1,20 @@
|
|||||||
|
#ifndef __PD_CSGIRON_H__
|
||||||
|
#define __PD_CSGIRON_H__
|
||||||
|
|
||||||
|
#ifdef CFG_DEV_TYPE_LAND_PD
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
//#include "pd_dau.h"
|
||||||
|
|
||||||
|
typedef int32_t (*csgiron_recv_fun_cb)(uint8_t, char*, uint16_t);
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16_t report_period;
|
||||||
|
uint8_t reserved[2];
|
||||||
|
} iron_config_t;
|
||||||
|
|
||||||
|
|
||||||
|
extern int32_t _csgiron_recv_process(uint8_t slot, char *pkt, uint16_t len);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,78 @@
|
|||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CFG_DEV_TYPE_LAND_PD
|
||||||
|
/* 标准C库头文件. */
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
/* 用户代码头文件. */
|
||||||
|
#include "pd_csgiron.h"
|
||||||
|
#include "pd_csg.h"
|
||||||
|
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
|
||||||
|
/* Internal functions --------------------------------------------------------*/
|
||||||
|
int32_t _csgiron_config_port_get(uint8_t slot, char* pkt, uint16_t len)
|
||||||
|
{
|
||||||
|
csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
|
||||||
|
iron_config_t *pdata = (iron_config_t*)(pkt + sizeof(csg_pkt_head_t));
|
||||||
|
pdata->report_period = pd_config.config_slot[slot].report_period;
|
||||||
|
|
||||||
|
_csg_send_data(CSG_REPLY, head->cmd, pkt, sizeof(iron_config_t), slot + 1);
|
||||||
|
return E_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t _csgiron_config_port_set(uint8_t slot, char* pkt, uint16_t len)
|
||||||
|
{
|
||||||
|
iron_config_t *pdata = (iron_config_t*)(pkt + sizeof(csg_pkt_head_t));
|
||||||
|
pd_config.config_slot[slot].report_period = pdata->report_period;
|
||||||
|
return E_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 命令映射表 */
|
||||||
|
static csgiron_recv_fun_cb _csgiron_command[] =
|
||||||
|
{
|
||||||
|
NULL, // 0
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 命令映射表 */
|
||||||
|
static csgiron_recv_fun_cb _csgiron_prv_command[] =
|
||||||
|
{
|
||||||
|
NULL, // 0
|
||||||
|
NULL, // CSG_PRV_CONFIG_GLOBAL_SET
|
||||||
|
NULL, // CSG_PRV_CONFIG_GLOBAL_GET
|
||||||
|
_csgiron_config_port_set, // CSG_PRV_CONFIG_PORT_SET
|
||||||
|
_csgiron_config_port_get, // CSG_PRV_CONFIG_PORT_GET
|
||||||
|
};
|
||||||
|
|
||||||
|
int32_t _csgiron_recv_process(uint8_t slot, char *pkt, uint16_t len)
|
||||||
|
{
|
||||||
|
dau_pkt_head_t *head = (dau_pkt_head_t*)pkt;
|
||||||
|
if (CSG_REQUEST == head->cmd)
|
||||||
|
{
|
||||||
|
_csgiron_command[head->cmd](slot, pkt, len);
|
||||||
|
}
|
||||||
|
else if (CSG_PRV_REQUEST == head->cmd)
|
||||||
|
{
|
||||||
|
_csgiron_prv_command[head->cmd](slot, pkt, len);
|
||||||
|
}
|
||||||
|
return E_NONE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue