This commit is contained in:
matt
2020-11-22 20:59:18 +08:00
parent a3b61f2c39
commit 076156e618
2 changed files with 175 additions and 0 deletions
+86
View File
@@ -0,0 +1,86 @@
/*
* 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
#endif
/* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */
/*
* Create external references here.
*
*/
/* %%%-SFUNWIZ_wrapper_externs_Changes_BEGIN --- EDIT HERE TO _END */
/* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */
/*
* Start function
*
*/
void hal_uart_in_Start_wrapper(const uint8_T *uart_id, const int_T p_width0)
{
/* %%%-SFUNWIZ_wrapper_Start_Changes_BEGIN --- EDIT HERE TO _END */
#ifdef HAL_IMPL
#endif
/* %%%-SFUNWIZ_wrapper_Start_Changes_END --- EDIT HERE TO _BEGIN */
}
/*
* Output function
*
*/
void hal_uart_in_Outputs_wrapper(uint8_T *Data,
uint16_T *Data_len,
int32_T *ErrorCode,
const uint8_T *uart_id, const int_T p_width0,
const int_T y_width)
{
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
/* **********************************************************
* collect all data from this uart and push to Data buffer;
*
* parameter:
* uart_id - uart FIFO device to read
*
* outputs:
* Data - read all FIFO data and write to Data array
* Data_len[0] - the number of written data
* ErrorCode[0] - return zero for success, others for failail.
*
* constant:
* y_width - maximum length to write to Data array
************************************************************/
Data_len[0] = 0u;
ErrorCode[0] = -1;
#ifdef HAL_IMPL
switch (uart_id[0])
{
case 0:
{
// TODO read all data from fifo
ErrorCode[0] = 0;
}
break;
case 1:
{
// TODO read all data from fifo
ErrorCode[0] = 0;
}
break;
}
#endif
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
}
+89
View File
@@ -0,0 +1,89 @@
/*
* 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
void rec(uint8_T *buff, uint16_T len);
#endif
/* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */
#define y_width 1
/*
* Create external references here.
*
*/
/* %%%-SFUNWIZ_wrapper_externs_Changes_BEGIN --- EDIT HERE TO _END */
/* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */
/*
* Start function
*
*/
void hal_uart_out_Start_wrapper(const uint8_T *uart_id, const int_T p_width0)
{
/* %%%-SFUNWIZ_wrapper_Start_Changes_BEGIN --- EDIT HERE TO _END */
#ifdef HAL_IMPL
#endif
/* %%%-SFUNWIZ_wrapper_Start_Changes_END --- EDIT HERE TO _BEGIN */
}
/*
* Output function
*
*/
void hal_uart_out_Outputs_wrapper(const uint8_T *buff,
const uint16_T *len,
const uint8_T *sep,
int32_T *ErrorCode,
const uint8_T *uart_id, const int_T p_width0,
const int_T u_width)
{
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
#ifdef HAL_IMPL
static uint8_T last_seq;
/* ***********************************************
* push all data to this uart output queue;
*
* inputs:
* buff - data array to be sent
* len[0] - available length in the data array
* sep[0] - it means the data array updated when sep[0] changed,
* uart_id[0] - uart FIFO device which is required to send data
*
* output:
* ErrorCode[0] - return zero for success, others for failail.
*
* constant:
* u_width - the maximum size of buff, do not read buff out of range.
*************************************************/
ErrorCode[0] = -1;
switch (uart_id[0])
{
case 4:
if (sep[0] != last_seq)
{
last_seq = sep[0];
rec(buff, len[0]);
ErrorCode[0] = 0;
}
break;
}
#else
/* dummy function for generate mex file for sim*/
ErrorCode[0] = 0;
#endif
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
}