VLCB SDK
An opinionated SDK for VLCB protocol
Loading...
Searching...
No Matches
param.c
Go to the documentation of this file.
1#include "vlcb/module/param.h"
2
3#include <assert.h>
4#include <stddef.h>
5#include <stdint.h>
6#include <string.h>
7
8#include "param.h"
11
13 const VlcbModuleParam param) {
14 assert(params != NULL && param <= params->len);
15 return params->buf[param - 1];
16}
17
19 VlcbModuleParams *const params, const VlcbModuleVersion version,
20 const VlcbManufacturer moduleManu, const VlcbBusType busType,
21 const uint8_t moduleType, const uint8_t cpuId,
22 const VlcbProcessorManufacturer cpuManu,
23 const VlcbModuleParamCpuManuId cpuManuId,
24 const VlcbModuleParamLoadAddr loadAddr, const VlcbModuleFlags moduleFlags,
25 const uint8_t nodeVariableCount, const uint8_t eventCount,
26 const uint8_t eventVariableCount) {
27 assert(params != NULL && params->len >= VLCB_MODULE_PARAMS_MIN_LEN);
28
29 params->buf[VLCB_MODULE_PARAM_MODULE_MANUFACTURER] = moduleManu;
30 params->buf[VLCB_MODULE_PARAM_MINOR_VERSION] = version.minor;
31 params->buf[VLCB_MODULE_PARAM_MODULE_TYPE] = moduleType;
32 params->buf[VLCB_MODULE_PARAM_MAX_EVENT_COUNT] = eventCount;
33 params->buf[VLCB_MODULE_PARAM_EVENT_VARIABLE_COUNT] = eventVariableCount;
34 params->buf[VLCB_MODULE_PARAM_NODE_VARIABLE_COUNT] = nodeVariableCount;
35 params->buf[VLCB_MODULE_PARAM_MAJOR_VERSION] = version.major;
38 params->buf[VLCB_MODULE_PARAM_CPU_ID] = cpuId;
39 params->buf[VLCB_MODULE_PARAM_BUS_TYPE] = busType;
40 memcpy(&params->buf[VLCB_MODULE_PARAM_LOAD_ADDRESS], &loadAddr,
42 memcpy(&params->buf[VLCB_MODULE_PARAM_CPU_MANUFACTURER_ID], &cpuManuId,
44 params->buf[VLCB_MODULE_PARAM_CPU_MANUFACTURER] = cpuManu;
45 params->buf[VLCB_MODULE_PARAM_BETA_VERSION] = version.beta;
46};
uint32_t VlcbModuleParamLoadAddr
char VlcbModuleParamCpuManuId[4]
@ VLCB_MODULE_PARAM_CPU_MANUFACTURER
@ VLCB_MODULE_PARAM_NODE_VARIABLE_COUNT
@ VLCB_MODULE_PARAM_MINOR_VERSION
@ VLCB_MODULE_PARAM_MAX_EVENT_COUNT
@ VLCB_MODULE_PARAM_MAJOR_VERSION
@ VLCB_MODULE_PARAM_EVENT_VARIABLE_COUNT
@ VLCB_MODULE_PARAM_MODULE_MANUFACTURER
@ VLCB_MODULE_PARAM_CPU_MANUFACTURER_ID
#define VLCB_MODULE_PARAMS_MIN_LEN
VlcbManufacturer
VlcbModuleParam ModuleParamGetByte(const VlcbModuleParams *const params, const VlcbModuleParam param)
Definition param.c:12
void vlcb_module_params_Init(VlcbModuleParams *const params, const VlcbModuleVersion version, const VlcbManufacturer moduleManu, const VlcbBusType busType, const uint8_t moduleType, const uint8_t cpuId, const VlcbProcessorManufacturer cpuManu, const VlcbModuleParamCpuManuId cpuManuId, const VlcbModuleParamLoadAddr loadAddr, const VlcbModuleFlags moduleFlags, const uint8_t nodeVariableCount, const uint8_t eventCount, const uint8_t eventVariableCount)
Definition param.c:18
VlcbProcessorManufacturer
Definition processor.h:9