/*
* Copyright 2016-2022 The MathWorks, Inc.
*
* File: xcp_daq.c
*
* Abstract:
* Implementation of XCP Protocol Layer DAQ Lists (and STIM) support
*/
#include "xcp_common.h"
#include "xcp.h"
#include "xcp_internal.h"
#include "xcp_cfg.h"
#include "xcp_daq.h"
#ifdef XCP_DAQ_SUPPORT
#include "xcp_daq_ext.h"
#include "xcp_transport_internal.h"
#include "xcp_types.h"
#include "xcp_daq_types.h"
#include "xcp_mem.h"
/*****************************************************************************
Internal Global variables specific to DAQ support
******************************************************************************/
/** Dynamic DAQ Lists data structures */
static XcpDaqLists xcpDynamicDaqLists;
/** Number of event threads currently in execution */
static size_t xcpRunningEventCounter = 0;
/** ID of the selected DAQ List on START_STOP_DAQ_LIST command */
#define XCP_INVALID_DAQ_LIST_ID -1
static int32_T startStopDaqListId = XCP_INVALID_DAQ_LIST_ID;
/** Pointer to current ODT entry */
static XcpDaqPtr xcpCurrentDaq = { 0xFFFF, 0xFF, 0xFF };
static XcpEventCustomMemoryManager xcpEventCustomMemoryManager = {XCP_DAQ_CUSTOM_MEMORY_INVALID_EVENT_ID, NULL, NULL};
#ifndef XCP_DAQ_LIST_INDEPENDENT_EVENT_LOCK
#ifdef XCP_LOCKLESS_SYNC_DATA_TRANSFER_SUPPORT
/* XCP_LOCKLESS_SYNC_DATA_TRANSFER_SUPPORT is typically enabled
for multi-core applications, where it is critical to limit
the interference between threads streaming data.
For this reason, by default we enable the independent lock
of the DAQ list data structures between events */
#define XCP_DAQ_LIST_INDEPENDENT_EVENT_LOCK 1
#else
/* XCP_LOCKLESS_SYNC_DATA_TRANSFER_SUPPORT is typically disabled
for single-core bare-metal applications, where it is critical
to limit the memory footprint of the target executable.
For this reason, by default we disable the independent lock
of the DAQ list data structures between events and use a single
mutex to protect the DAQ lists data structures */
#define XCP_DAQ_LIST_INDEPENDENT_EVENT_LOCK 0
#endif
#endif
#if !defined(XCP_DAQ_LIST_INDEPENDENT_EVENT_LOCK) || (XCP_DAQ_LIST_INDEPENDENT_EVENT_LOCK == 0)
/* Mutex protecting against the concurrent access to DAQ Lists data structures */
static XCP_MUTEX_DEFINE(daqLock);
static boolean_T xcpDaqWriteLock(XcpEventIdType eventId)
{
boolean_T locked = false;
XCP_UNUSED_PARAM(eventId);
XCP_WRITE_TRY_LOCK(daqLock, xcpRunningEventCounter, locked);
return locked;
}
static void xcpDaqWriteUnlock(XcpEventIdType eventId)
{
XCP_UNUSED_PARAM(eventId);
XCP_WRITE_UNLOCK(daqLock);
}
static void xcpDaqReadLock(XcpEventIdType eventId)
{
XCP_UNUSED_PARAM(eventId);
XCP_READ_LOCK(daqLock, xcpRunningEventCounter);
}
static void xcpDaqReadUnlock(XcpEventIdType eventId)
{
XCP_UNUSED_PARAM(eventId);
XCP_READ_UNLOCK(daqLock, xcpRunningEventCounter);
}
#else
/* Each XCP event has an independent mutex to protect the read/write access
to the DAQ list data structures */
#ifndef XCP_MAX_EVENT_DATA_NUMBER
#define XCP_MAX_EVENT_DATA_NUMBER XCP_MAX_EVENT_CHANNEL
#endif
typedef struct XcpEventData {
XCP_MUTEX_DEFINE(lock);
} XcpEventData;
/** Array of event-specific data */
static XcpEventData xcpEventData[XCP_MAX_EVENT_DATA_NUMBER];
static boolean_T xcpDaqWriteLock(XcpEventIdType eventId)
{
XCP_MUTEX_LOCK(xcpEventData[eventId].lock);
return true;
}
static void xcpDaqWriteUnlock(XcpEventIdType eventId)
{
XCP_MUTEX_UNLOCK(xcpEventData[eventId].lock);
}
static void xcpDaqReadLock(XcpEventIdType eventId)
{
XCP_MUTEX_LOCK(xcpEventData[eventId].lock);
}
static void xcpDaqReadUnlock(XcpEventIdType eventId)
{
XCP_MUTEX_UNLOCK(xcpEventData[eventId].lock);
}
#endif
#ifndef XCP_MIN_EVENT_NO_RESERVED_POOL
#define XCP_MIN_EVENT_NO_RESERVED_POOL 0xFFFF
#endif
/*****************************************************************************
Internal Functions specific to DAQ support
******************************************************************************/
/* When enabled, timestamp is required for first ODT in the DAQ list */
#if XCP_TIMESTAMP_FIXED == 0
#define IS_TIMESTAMP_REQUIRED(mode, odtNumber) ((odtNumber == 0) && \
XCP_READ_BIT_VALUE(mode, XCP_DAQ_MODE_TIMESTAMP_MASK))
#else
#define IS_TIMESTAMP_REQUIRED(mode, odtNumber) (odtNumber == 0)
#endif
/* Incrementing pointer. byteOffset argument will have a valid value only when
we are emulating as a BYTE addressable target. Otherwise, it is 0. */
#ifdef XCP_EMULATE_BYTE_ADDRESSABLE_TARGET
#define XCP_HW_PTR_INCREMENT(ptr, incr, byteOffset) (uint8_T *)(byteOffset ? (ptr + XCP_IN_HW_AG(incr - 1)) : (ptr + XCP_IN_HW_AG(incr)))
#else
#define XCP_HW_PTR_INCREMENT(ptr, incr, byteOffset) (uint8_T *)(ptr + incr)
#endif
/* Update byteOffset when emulating as a BYTE addressable target */
#ifdef XCP_EMULATE_BYTE_ADDRESSABLE_TARGET
#define XCP_HW_BYTE_OFFSET_UPDATE(offset, size) ((offset + size) % XCP_HARDWARE_ADDRESS_GRANULARITY_BYTES_NUMBER)
#else
#define XCP_HW_BYTE_OFFSET_UPDATE(offset, size) 0
#endif
#define IS_USING_CUSTOM_POOL(x) (x == xcpEventCustomMemoryManager.eventId)
static boolean_T isActiveDaqList(uint16_T daqListId)
{
return (xcpDynamicDaqLists.daq[daqListId].status == XCP_DAQ_SELECTED) ||
(xcpDynamicDaqLists.daq[daqListId].status == XCP_DAQ_STARTED);
}
static boolean_T noActiveDaqLists(void)
{
boolean_T found = 0;
uint16_T i = 0;
for (i = 0; (i < xcpDynamicDaqLists.daqCount) && !found; i++) {
found = isActiveDaqList(i);
}
return !found;
}
static boolean_T isValidDaqPtr(uint16_T daqListId, uint8_T odtId, uint8_T odtEntryId)
{
boolean_T ret = (xcpDynamicDaqLists.daq != NULL) &&
(daqListId < xcpDynamicDaqLists.daqCount) &&
(xcpDynamicDaqLists.daq[daqListId].odt != NULL) &&
(odtId < xcpDynamicDaqLists.daq[daqListId].odtCount) &&
(xcpDynamicDaqLists.daq[daqListId].odt[odtId].entry != NULL) &&
(odtEntryId < xcpDynamicDaqLists.daq[daqListId].odt[odtId].entriesCount);
return ret;
}
static boolean_T isValidDaqEntry(uint8_T bitOffset, uint8_T size, uint32_T address)
{
boolean_T ret = false;
uint16_T entrySize = size; /* cast to 16-bit avoids -Werror=type-limits */
if (bitOffset == 0xFF) {
/* "Normal" (non-bitwise) access has been selected */
if ( (entrySize <= XCP_MAX_ODT_ENTRY_SIZE) &&
(entrySize % (XCP_ODT_ENTRY_SIZE_GRANULARITY/XCP_ADDRESS_GRANULARITY_BYTES_NUMBER) == 0) &&
( address % (XCP_ODT_ENTRY_SIZE_GRANULARITY/XCP_ADDRESS_GRANULARITY_BYTES_NUMBER) == 0) ) {
ret = true;
}
}
else {
/* Bitwise access has been selected */
if ((bitOffset <= 0x1F) && (address % XCP_ODT_ENTRY_SIZE_GRANULARITY) &&
(entrySize == XCP_ODT_ENTRY_SIZE_GRANULARITY)) {
ret = true;
}
}
return ret;
}
/** The current supported mode includes:
- alternating = 0
- direction = 0 (DAQ only)
- timestamp = 1 or 0
- PID OFF = 0
*/
static boolean_T isSupportedDaqListMode(uint8_T mode)
{
#if XCP_TIMESTAMP_FIXED == 0
return ( (mode & ~XCP_DAQ_MODE_TIMESTAMP_MASK) == 0 );
#else
return (mode == XCP_DAQ_MODE_TIMESTAMP_MASK);
#endif
}
static boolean_T isValidStartStopMode(uint8_T mode)
{
boolean_T ret = false;
if ((mode == XCP_DAQ_LIST_STOP) ||
(mode == XCP_DAQ_LIST_START) ||
(mode == XCP_DAQ_LIST_SELECT))
ret = true;
return ret;
}
static boolean_T isValidStartStopSynchMode(uint8_T mode)
{
boolean_T ret = false;
if ((mode == XCP_DAQ_LIST_STOP_ALL) ||
(mode == XCP_DAQ_LIST_START_SELECTED) ||
(mode == XCP_DAQ_LIST_STOP_SELECTED))
ret = true;
return ret;
}
static boolean_T absoluteOdtNumberIdentification(void)
{
return (XCP_ID_FIELD_TYPE == XCP_ID_ABSOLUTE_ODT_NUMBER);
}
static boolean_T isDaqPackedModeEnabled(uint16_
没有合适的资源?快使用搜索试试~ 我知道了~
matlab coder interface for deep learnig 离线安装
共2000个文件
m:1762个
h:63个
json:52个
需积分: 0 0 下载量 80 浏览量
2024-05-23
00:06:52
上传
评论
收藏 68.39MB ZIP 举报
温馨提示
C:\Program Files\MATLAB\R2023a\toolbox\coder 替换应该就能用,待测试。
资源推荐
资源详情
资源评论
收起资源包目录
matlab coder interface for deep learnig
离线安装 (2000个子文件)
xcp_daq.c 69KB
ext_convert.c 40KB
ext_convert.c 40KB
xcp_transport.c 26KB
xcp.c 25KB
xcp_ext_common.c 25KB
ext_comm.c 24KB
ext_serial_win32_comm.c 24KB
xcp_mem_default.c 24KB
ext_serial_utils.c 20KB
xcp_ext_classic_trigger.c 19KB
xcp_standard.c 18KB
ext_serial_pkt.c 15KB
xcp_frame_serial.c 15KB
xcp_ext_mode.c 15KB
ext_util.c 14KB
ext_util.c 14KB
xcp_ext_work.c 14KB
xcp_platform_default.c 13KB
xcp_frame_tcp.c 11KB
ext_custom_transport.c 11KB
rtiostream_interface.c 11KB
rtiostream_serial_interface.c 10KB
cloudCall.c 9KB
ext_serial_transport.c 9KB
xcp_frame_can.c 8KB
xcp_drv_rtiostream.c 7KB
ext_main.c 7KB
ext_main.c 7KB
xcp_calibration.c 7KB
xcp_slave_default.c 6KB
getData.c 5KB
xcp_ext_param_default_tcp.c 4KB
host_timer_csa_x86.c 4KB
rawdatastream.c 3KB
host_hwcount_glnxa64.c 3KB
xcp_ext_param_default_serial.c 3KB
xcp_ext_param_default_can.c 3KB
host_timer_x86.c 2KB
rt_size_check.c 1KB
xcp_fifo.c 1KB
host_threadid_x86.c 1KB
host_cpuid_x86.c 1KB
xcp_utils.c 886B
host_stack_x86.c 389B
general_stack.c 203B
RTIOStreamTgtAppSvc.cpp 8KB
ParamTuningTgtAppSvcCIntrf.cpp 4KB
Message.cpp 2KB
Application.cpp 945B
ParamTuningTgtAppSvc.cpp 507B
RTIOStreamTgtAppSvcCIntrf.cpp 497B
index-css.css 1.13MB
index-css.css 1.07MB
index-css.css 1.06MB
index-css.css 1.03MB
index-css.css 925KB
index-css.css 850KB
index-css.css 848KB
index-css.css 840KB
reportWidgets.css 3KB
autosarreport.css 3KB
AUTOSAR.css 1KB
Mfx.h 80KB
Ifx.h 70KB
xcp_daq_types.h 25KB
xcp_types.h 16KB
extsim.h 16KB
xcp_mem_config_helper.h 14KB
xcp_mem_config.h 13KB
xcp_cfg.h 10KB
xcp_standard_types.h 10KB
xcp_mem_default.h 8KB
ext_mode.h 7KB
xcp_frame_serial.h 6KB
Mfl.h 6KB
xcp_transport_internal.h 6KB
xcp.h 5KB
xcp_mem.h 5KB
xcp_ext_common.h 5KB
xcp_frame.h 4KB
xcp_platform_default.h 4KB
xcp_daq.h 4KB
xcp_ext_classic_trigger.h 4KB
xcp_internal.h 3KB
xcp_drv.h 3KB
Ifl.h 3KB
xcp_platform.h 3KB
xcp_calibration_types.h 3KB
xcp_transport.h 3KB
extutil.h 3KB
xcp_frame_tcp.h 2KB
xcp_frame_can.h 2KB
ext_transport.h 2KB
xilutils.h 2KB
coderinstrumentation.h 2KB
probedispatcher_testing.h 2KB
xcp_fifo.h 1KB
Platform_Types.h 1KB
xcp_slave.h 1KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
摘云01
- 粉丝: 2
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于C语言的文件操作代码.zip
- Python基于YOLOv7的农作物病虫害识别项目&防治系统(源码&教程)
- miniproject2.py
- 基于YOLOv7的植物虫害识别&防治系统(源码&教程)
- Java项目-基于SSM+Vue的大学生企业推荐系统的设计与实现(源码+数据库脚本+部署视频+代码讲解视频+全套软件)
- 基于FreeRTOS+STM32CubeMX+LCD1602+MCP4162(SPI接口)的数字电位器Proteus仿真
- Java项目-基于SSM+Vue的大学生兼职信息系统的设计与实现(源码+数据库脚本+部署视频+代码讲解视频+全套软件)
- PHP开发学生成绩管理系统例子.rar
- Java项目基于SSM实现的学生竞赛模拟系统+代码+论文+答辩PPT
- 基于FreeRTOS+STM32CubeMX+LCD1602+MCP4162(SPI接口)的数字电位器Proteus仿真
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功