support EF3Lite
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
|
||||
/*
|
||||
* Include Files
|
||||
*
|
||||
*/
|
||||
#if defined(MATLAB_MEX_FILE)
|
||||
#include "tmwtypes.h"
|
||||
#include "simstruc_types.h"
|
||||
#else
|
||||
#include "rtwtypes.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* %%%-SFUNWIZ_wrapper_includes_Changes_BEGIN --- EDIT HERE TO _END */
|
||||
#ifdef HAL_IMPL
|
||||
//#include "param_mgr.h"
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
/* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */
|
||||
|
||||
/*
|
||||
* Create external references here.
|
||||
*
|
||||
*/
|
||||
/* %%%-SFUNWIZ_wrapper_externs_Changes_BEGIN --- EDIT HERE TO _END */
|
||||
typedef int (*genral_in_ptr)(uint8_t *packed_in, const int y_width, void **pW);
|
||||
|
||||
//Demo
|
||||
int demo_init_func(void **pW)
|
||||
{
|
||||
static int is_init = 0;
|
||||
if (!is_init)
|
||||
{
|
||||
is_init = 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int demo_in_func(uint8_t *packed_in, const int y_width, void **pW)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//TODO add other init/input functions
|
||||
/* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */
|
||||
|
||||
/*
|
||||
* Start function
|
||||
*
|
||||
*/
|
||||
void hal_general_in_Start_wrapper(void **pW,
|
||||
const uint8_T *device_id, const int_T p_width0)
|
||||
{
|
||||
/* %%%-SFUNWIZ_wrapper_Start_Changes_BEGIN --- EDIT HERE TO _END */
|
||||
int *valid = (int *)&pW[0]; /* 0-invalid; 1-valid; */
|
||||
genral_in_ptr *func = (genral_in_ptr *)&pW[1];
|
||||
|
||||
valid[0] = 0;
|
||||
if (strncmp(device_id, "demo", p_width0))
|
||||
{
|
||||
if (!demo_init_func(&pW[2]))
|
||||
{
|
||||
*valid = 1;
|
||||
*func = &demo_in_func;
|
||||
}
|
||||
}
|
||||
//TODO add other cases
|
||||
/* %%%-SFUNWIZ_wrapper_Start_Changes_END --- EDIT HERE TO _BEGIN */
|
||||
}
|
||||
/*
|
||||
* Output function
|
||||
*
|
||||
*/
|
||||
void hal_general_in_Outputs_wrapper(uint8_T *packed_in,
|
||||
int32_T *ErrorCode,
|
||||
void **pW,
|
||||
const uint8_T *device_id, const int_T p_width0,
|
||||
const int_T y_width)
|
||||
{
|
||||
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
|
||||
int *valid = (int *)&pW[0]; /* 0-invalid; 1-valid; */
|
||||
if (valid[0])
|
||||
{
|
||||
genral_in_ptr func = (genral_in_ptr)pW[1];
|
||||
ErrorCode[0] = (*func)(packed_in, y_width, &pW[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorCode[0] = -1;
|
||||
}
|
||||
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user