Files
slhal/X7/hal_clock_wrapper.c
T
2020-10-18 19:46:38 +08:00

78 lines
1.4 KiB
C

/*
* 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
/* TODO include files */
#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 */
int is_init = 0;
static void initialize_clock()
{
if (!is_init)
{
#ifdef HAL_IMPL
/* TODO setup clock */
is_init = 1;
#endif
}
}
/* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */
/*
* Start function
*
*/
void hal_clock_Start_wrapper(const uint8_T *typ, const int_T p_width0)
{
/* %%%-SFUNWIZ_wrapper_Start_Changes_BEGIN --- EDIT HERE TO _END */
initialize_clock();
/* %%%-SFUNWIZ_wrapper_Start_Changes_END --- EDIT HERE TO _BEGIN */
}
/*
* Output function
*
*/
void hal_clock_Outputs_wrapper(uint32_T *boot_time,
const uint8_T *typ, const int_T p_width0)
{
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */
if (is_init)
{
#ifdef HAL_IMPL
//TODO get clock
// typ: 0 - msec; 1 - usec;
if(typ[0] == 0)
{
boot_time[0] = get_milliseconds();
}
else if(typ[0] == 1)
{
boot_time[0] = get_mircoseconds();
}
#endif
}
/* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */
}