WizeCore

Wize API

WIZE_ALLIANCE_BANNER
enum wize_api_ret_e

This enum define the return code from Wize API.

Values:

enumerator WIZE_API_SUCCESS
enumerator WIZE_API_FAILED
enumerator WIZE_API_ADM_SUCCESS
enumerator WIZE_API_ACCESS_TIMEOUT
enumerator WIZE_API_INVALID_PARAM
static wize_net_t sNetCtx
static struct ses_disp_ctx_s sSesDispCtx
static struct time_upd_s sTimeUpdCtx
wize_api_ret_e WizeApi_GetAdmCmd(net_msg_t *pMsg)

This function get the last received ADM command message.

Parameters:

pMsg[out] Pointer on message buffer

Return values:

return – wize_api_ret_e::WIZE_API_SUCCESS (0) if everything is fine return wize_api_ret_e::WIZE_API_ACCESS_TIMEOUT (3) if access is refused return wize_api_ret_e::WIZE_API_INVALID_PARAM (4) if given parameter(s) is/are invalid

wize_api_ret_e WizeApi_GetAdmRsp(net_msg_t *pMsg)

This function get the last sent ADM response message.

Parameters:

pMsg[out] Pointer on message buffer

Return values:

return – wize_api_ret_e::WIZE_API_SUCCESS (0) if everything is fine return wize_api_ret_e::WIZE_API_ACCESS_TIMEOUT (3) if access is refused return wize_api_ret_e::WIZE_API_INVALID_PARAM (4) if given parameter(s) is/are invalid

wize_api_ret_e WizeApi_GetStats(net_stats_t *pStats)
wize_api_ret_e WizeApi_SetDeviceId(device_id_t *pDevId)

This function set the device identification.

Parameters:

sDevId[in] The device identification to set

Return values:

return – wize_api_ret_e::WIZE_API_SUCCESS (0)

wize_api_ret_e WizeApi_GetDeviceId(device_id_t *pDevId)

This function get the device identification.

Parameters:

pDevId[in] Pointer on the device identification holder

Return values:

return – wize_api_ret_e::WIZE_API_SUCCESS (0)

wize_api_ret_e WizeApi_ExecPing(void)

This function start a INST (PING/PONG) session.

Return values:

return – wize_api_ret_e::WIZE_API_SUCCESS (0) if everything is fine return wize_api_ret_e::WIZE_API_FAILED (1) if INST session failed return wize_api_ret_e::WIZE_API_ACCESS_TIMEOUT (3) if access is refused

wize_api_ret_e WizeApi_Send(uint8_t *pData, uint8_t u8Size, uint8_t u8Type)

This function send a DATA message.

Parameters:
  • pData[in] Pointer on raw data to send

  • u8Size[in] Number of byte to send

  • u8Type[in] Type of frame DATA or DATA_PRIO

Return values:

return – wize_api_ret_e::WIZE_API_SUCCESS (0) if everything is fine return wize_api_ret_e::WIZE_API_FAILED (1) if ADN session failed return wize_api_ret_e::WIZE_API_ADM_SUCCESS (2) if ADM CMD has been received return wize_api_ret_e::WIZE_API_ACCESS_TIMEOUT (3) if access is refused return wize_api_ret_e::WIZE_API_INVALID_PARAM (4) if given parameter(s) is/are invalid

wize_api_ret_e WizeApi_SendEx(uint8_t *pData, uint8_t u8Size, uint8_t u8Type)

This function send a DATA message.

Parameters:
  • pData[in] Pointer on raw data to send

  • u8Size[in] Number of byte to send

  • u8Type[in] Type of frame DATA or DATA_PRIO

Return values:

return – wize_api_ret_e::WIZE_API_SUCCESS (0) if everything is fine return wize_api_ret_e::WIZE_API_FAILED (1) if ADN session failed return wize_api_ret_e::WIZE_API_ADM_SUCCESS (2) if ADM CMD has been received return wize_api_ret_e::WIZE_API_ACCESS_TIMEOUT (3) if access is refused return wize_api_ret_e::WIZE_API_INVALID_PARAM (4) if given parameter(s) is/are invalid

void WizeApi_Setup(phydev_t *pPhyDev)

This function setup the wize stack.

Return values:

None

void WizeApi_Enable(uint8_t bFlag)
void WizeApi_CtxClear(void)

This function Clear the Time Update state.

Returns:

None

void WizeApi_CtxSave(void)

This function Save the Time Update state.

Returns:

None

void WizeApi_CtxRestore(void)

This function Restore the Time Update state.

Returns:

None

void WizeApi_Init(void)

This function initialize the wize stack.

Parameters:

pPhyDev[in] Pointer on the phy device

Return values:

None

SES_MGR_INST_REQ_TMO_MSK
SES_MGR_INST_FLG_TMO_MSK
SES_MGR_INST_FLG_ALL_MSK
SES_MGR_ADM_REQ_TIMEOUT_MSK
SES_MGR_ADM_FLG_TIMEOUT_MSK
SES_MGR_ADM_FLG_ALL_MSK

Application Layer

enum ses_mgr_evt_e

This enumeration define.

Values:

enumerator SES_MGR_EVT_MSK
enumerator SES_MGR_INST_EVT_OPEN
enumerator SES_MGR_INST_EVT_CLOSE
enumerator SES_MGR_ADM_EVT_OPEN
enumerator SES_MGR_ADM_EVT_CLOSE
enum ses_mgr_flg_e

This enumeration define.

Values:

enumerator SES_MGR_FLG_NONE
enumerator SES_MGR_FLG_SUCCESS
enumerator SES_MGR_FLG_FAILED
enumerator SES_MGR_FLG_REQUEST
enumerator SES_MGR_FLG_MSK
enumerator SES_MGR_ADM_FLG_SUCCES
enumerator SES_MGR_ADM_FLG_FAILED
enumerator SES_MGR_ADM_FLG_REQUEST
enumerator SES_MGR_INST_FLG_SUCCESS
enumerator SES_MGR_INST_FLG_FAILED
enum glo_flg_e

This enumeration define.

Values:

enumerator GLO_FLG_NONE
enumerator GLO_FLG_SEND_RECV_MSK
enumerator GLO_FLG_CMD_RECV_READ
enumerator GLO_FLG_CMD_RECV_WRITE
enumerator GLO_FLG_CMD_RECV_KEY
enumerator GLO_FLG_CMD_RECV_EXEC
enumerator GLO_FLG_CMD_RECV_ANN
enumerator GLO_FLG_CMD_RECV
enumerator GLO_FLG_PONG_RECV
enumerator GLO_FLG_BLK_RECV
enumerator GLO_FLG_DATA_SENT
enumerator GLO_FLG_RSP_SENT
enumerator GLO_FLG_PING_SENT
enumerator GLO_FLG_TIME_MSK
enumerator GLO_FLG_FINE_ADJUST
enumerator GLO_FLG_COARSE_ADJUST
enumerator GLO_FLG_DAY_PASSED
enumerator GLO_FLG_DAYLIGHT_CHG
enumerator GLO_FLG_SESSION_MSK
enumerator GLO_FLG_ADM_START
enumerator GLO_FLG_ADM_COMPLETE
enumerator GLO_FLG_ADM_ERROR
enumerator GLO_FLG_FULL_POWER
enumerator GLO_FLG_INST_START
enumerator GLO_FLG_INST_COMPLETE
enumerator GLO_FLG_INST_ERROR
enumerator GLO_FLG_PERIODIC_INST
enumerator GLO_FLG_DWN_START
enumerator GLO_FLG_DWN_COMPLETE
enumerator GLO_FLG_DWN_ERROR
enumerator GLO_FLG_DWN_CORRUPTED
enumerator GLO_FLG_ADM_ACTIVE
enumerator GLO_FLG_ADM_TIMEOUT
enumerator GLO_FLG_INST_ACTIVE
enumerator GLO_FLG_INST_TIMEOUT
enumerator GLO_FLG_DWN_ACTIVE
enumerator GLO_FLG_DWN_TIMEOUT
enum ses_disp_state_e

This enumeration define.

Values:

enumerator SES_DISP_STATE_DISABLE
enumerator SES_DISP_STATE_ENABLE
enum ses_disp_pending_e

This enumeration define.

Values:

enumerator SES_ADM_CMD_PEND
enumerator SES_ADM_RSP_PEND
enumerator SES_ADM_SES_PEND
enumerator SES_INST_SES_PEND
enumerator SES_DWN_SES_PEND
void SesDisp_Setup(struct ses_disp_ctx_s *pCtx)

This function setup the SesDisp (Session Dispatcher) module.

Parameters:

pCtx[in] Pointer on the current context

Returns:

None

void SesDisp_Init(struct ses_disp_ctx_s *pCtx, uint8_t bEnable)

This function initialize the SesDisp (Session Dispatcher) module.

Parameters:
  • pCtx[in] Pointer on the current context

  • bEnable[in] Enable / Disable the Session dispatcher

Returns:

None

static inline uint32_t _get_pos(uint32_t ulFlg)
static void _ses_disp_main_(void const *argument)

This is the session dispatcher task. It call its FSM to treat events from Wize API and NetMgr.

Parameters:

argument[in] (not used)

Returns:

None

static void _ses_disp_fsm_(struct ses_disp_ctx_s *pCtx, uint32_t u32Event)

This is the session dispatcher FSM that treat events from Wize API and NetMgr.

Parameters:
  • pCtx[in] Pointer on the current session dispatcher context

  • u32Event[in] Received event to treat

Returns:

None

static void _ses_disp_bckflg_(struct ses_disp_ctx_s *pCtx, uint32_t u32Flag)

This is function send back to the caller the session result.

Parameters:
  • pCtx[in] Pointer on the current session dispatcher context

  • u32Flag[in]

Returns:

None

static uint32_t _ses_disp_postCmd_(struct ses_disp_ctx_s *pCtx)

This function effectively execute the “COMMAND” treatment.

Parameters:

pCtx[in] Pointer on the current session dispatcher context

Retval :

static uint32_t _ses_disp_OnDayPass_(struct ses_disp_ctx_s *pCtx)

This is update “Periodic Install” and “Back to Full Power” counter.

Parameters:

pCtx[in] Pointer on the current session dispatcher context

Retval :

static void _ses_disp_get_param_(void)

This function get parameters from global table and setup internal variables.

Returns:

None

static inline void _adm_mgr_get_param_(struct adm_mgr_ctx_s *pCtx)

This function get parameters from global table and setup internal variables.

Parameters:

pCtx[in] Pointer in the current context

Returns:

None

static inline void _inst_mgr_get_param_(struct inst_mgr_ctx_s *pCtx)

This function get parameters from global table and setup internal variables.

Parameters:

pCtx[in] Pointer in the current context

Returns:

None

SES_MGR_EVT_POS
SES_MGR_FLG_POS
struct ses_disp_ctx_s
#include <ses_dispatcher.h>

This struct defines the session dispatcher context.

Common Application Layer

Warning

doxygengroup: Cannot find group “wize_comm_app” in doxygen xml output for project “OpenWize Developer Documentation” from directory: _build/xml

Installation Layer

Warning

doxygengroup: Cannot find group “wize_inst_layer” in doxygen xml output for project “OpenWize Developer Documentation” from directory: _build/xml

Administration Layer

Warning

doxygengroup: Cannot find group “wize_admin_layer” in doxygen xml output for project “OpenWize Developer Documentation” from directory: _build/xml

Download Layer

Warning

doxygengroup: Cannot find group “wize_dwn_layer” in doxygen xml output for project “OpenWize Developer Documentation” from directory: _build/xml

Time management

static struct time_mgr_ctx_s sTimeMgrCtx

This define the Time manager context.

inline void _time_wakeup_enable(void)

Enable the RTC wake-up timer.

inline void _time_wakeup_reload(void)

Reload the RTC wake-up timer.

inline void _time_wakeup_force(void)

Force the RTC wake-up timer notify.

void TimeMgr_Setup(struct time_upd_s *pTimeUpdCtx)

This function initialize the TimeMgr context.

Returns:

None

static void _time_mgr_main_(void const *argument)

This is the main task function, as FSM that treat events from periodic wake-up timer.

Parameters:

argument[in] (not used)

Returns:

None

static uint32_t _time_mgr_check_upd_time_(struct time_upd_s *pCtx, uint32_t cur_epoch)

This function check if there are pending time/clock correction.

Parameters:

cur_epoch[in] The current epoch

Returns:

The corrected epoch value to apply; 0 is none;

static void _time_mgr_evtCb_(void)

ISR Callback function to notify an event occurs.

Returns:

None

struct time_upd_s
#include <time_mgr.h>

This struct define the time update context.

struct time_mgr_ctx_s

This struct define the time manager task context.

Sessions Management

enum ses_log_e

Values:

enumerator SES_LOG_NONE
enumerator SES_LOG_CMD_RECV_READ
enumerator SES_LOG_CMD_RECV_WRITE
enumerator SES_LOG_CMD_RECV_KEY
enumerator SES_LOG_CMD_RECV_EXEC
enumerator SES_LOG_CMD_RECV_ANN
enumerator SES_LOG_PONG_RECV
enumerator SES_LOG_BLK_RECV
enumerator SES_LOG_DATA_SENT
enumerator SES_LOG_RSP_SENT
enumerator SES_LOG_PING_SENT
enumerator SES_LOG_FINE_ADJUST
enumerator SES_LOG_COARSE_ADJUST
enumerator SES_LOG_DAY_PASSED
enumerator SES_LOG_DAYLIGHT_CHG
enum ses_state_e

This enum define session state.

Values:

enumerator SES_STATE_DISABLE
enumerator SES_STATE_IDLE
enumerator SES_STATE_SENDING
enumerator SES_STATE_LISTENING
enumerator SES_STATE_WAITING
enumerator SES_STATE_WAITING_RX_DELAY
enumerator SES_STATE_WAITING_TX_DELAY
enum ses_flg_e

This enum define the session return flags.

Values:

enumerator SES_FLG_NONE

Nothing

enumerator SES_FLG_FAILED

Failed

enumerator SES_FLG_SUCCESS

Success

enumerator SES_FLG_ERROR

Error

enumerator SES_FLG_TIMEOUT

Time Out

enumerator SES_FLG_RECV_MSK

Convenient mask on recv flags

enumerator SES_FLG_CMD_RECV

Command has been received

enumerator SES_FLG_PONG_RECV

Pong has been received

enumerator SES_FLG_BLK_RECV

SW Block has been received

enumerator SES_FLG_SENT_MSK

Convenient mask on send flags

enumerator SES_FLG_DATA_SENT

Data has been sent

enumerator SES_FLG_RSP_SENT

Response has been sent

enumerator SES_FLG_PING_SENT

Ping has been sent

enumerator SES_FLG_COMPLETE

Session is complete

enumerator SES_FLG_OUT_DATE

Message is out of date

enumerator SES_FLG_CORRUPTED

Image is corrupted

enumerator SES_FLG_FRM_PASSED

Frame is by passed

enum ses_evt_e

Values:

enumerator SES_EVT_NET_MGR_MSK
enumerator SES_EVT_NONE
enumerator SES_EVT_SEND_DONE
enumerator SES_EVT_RECV_DONE
enumerator SES_EVT_FRM_PASSED
enumerator SES_EVT_TIMEOUT
enumerator SES_EVT_SES_MGR_MSK
enumerator SES_EVT_ADM_DELAY_EXPIRED
enumerator SES_EVT_INST_DELAY_EXPIRED
enumerator SES_EVT_DWN_DELAY_EXPIRED
enumerator SES_EVT_ADM_READY
enumerator SES_EVT_INST_READY
enumerator SES_EVT_DWN_READY
enumerator SES_EVT_MSK
enumerator SES_EVT_OPEN
enumerator SES_EVT_CLOSE
enumerator SES_EVT_CANCEL
enumerator SES_EVT_EXT_MSK
enumerator SES_EVT_DAY_PASSED
enum ses_type_t

Values:

enumerator SES_INST
enumerator SES_ADM
enumerator SES_DWN
enumerator SES_NB
enumerator SES_NONE
static const char *const _ses_name_str_ [] ={[SES_INST] = "INST",[SES_ADM]  = "ADM",[SES_DWN]  = "DWN",}
static const char *const _ses_state_str_ [] ={[SES_STATE_DISABLE]            = "DISABLE",[SES_STATE_IDLE]               = "IDLE",[SES_STATE_SENDING]            = "SENDING",[SES_STATE_LISTENING]          = "LISTENING",[SES_STATE_WAITING]            = "WAITING",[SES_STATE_WAITING_RX_DELAY]   = "WAITING_RX_DELAY",[SES_STATE_WAITING_TX_DELAY]   = "WAITING_TX_DELAY",}
static const char *const _ses_log_str_ [] ={[SES_LOG_NONE]           = "...",[SES_LOG_CMD_RECV_READ]  = "READ",[SES_LOG_CMD_RECV_WRITE] = "WRITE",[SES_LOG_CMD_RECV_KEY]   = "KEY",[SES_LOG_CMD_RECV_EXEC]  = "EXEC",[SES_LOG_CMD_RECV_ANN]   = "ANN",[SES_LOG_PONG_RECV]      = "PONG",[SES_LOG_BLK_RECV]       = "BLK",[SES_LOG_DATA_SENT]      = "DATA",[SES_LOG_RSP_SENT]       = "RSP",[SES_LOG_PING_SENT]      = "PING",[SES_LOG_FINE_ADJUST]    = "FINE ADJ",[SES_LOG_COARSE_ADJUST]  = "COARSE ADJ",[SES_LOG_DAY_PASSED]     = "DAY PASSED",[SES_LOG_DAYLIGHT_CHG]   = "DAYLIGHT CHG"}
union ses_evt_t

Public Members

uint32_t SES_EVT
uint32_t NET_EVT
uint32_t TIM_EVT
uint32_t API_EVT
uint32_t RESERVED
struct ses_evt_t::[anonymous] SES_EVT_b
union ses_flg_t

Public Members

uint32_t SES_FLG
uint32_t ERROR
uint32_t SUCCESS
uint32_t NC1
uint32_t SENT
uint32_t RECEIVED
uint32_t COMPLETE
uint32_t OUT_DATE
uint32_t CORRUPTED
uint32_t PASSED
uint32_t NC2
uint32_t RX_DELAY
uint32_t TX_DELAY
uint32_t TIMEOUT
uint32_t TIMEOUT_EX
uint32_t DAY_DELAY
uint32_t DELTA_DELAY
uint32_t NC3
uint32_t RESEREVD
struct ses_flg_t::[anonymous] SES_FLG_b
struct ses_ctx_s

Administration Session

Warning

doxygengroup: Cannot find group “wize_admin_mgr” in doxygen xml output for project “OpenWize Developer Documentation” from directory: _build/xml

Installation Session

void InstMgr_Setup(struct ses_ctx_s *pCtx)

This function initialize the session context.

Parameters:

pCtx[in] Pointer in the current context

Returns:

None

static void _inst_mgr_ini_(struct ses_ctx_s *pCtx)

Initialize the fsm internal private context.

Parameters:

pCtx[in] Pointer in the current context

Returns:

None

static uint32_t _inst_mgr_fsm_(struct ses_ctx_s *pCtx, uint32_t u32Evt)

This is the FSM that treat input/output events.

Parameters:
  • pCtx[in] Pointer in the current context

  • u32Evt[in] Input event from outside (see ses_evt_e)

Return values:
struct inst_mgr_ctx_s
#include <inst_mgr.h>

This struct defines the install manager internal context.

Download Session

void DwnMgr_Setup(struct ses_ctx_s *pCtx)

This function initialize the session context.

Parameters:

pCtx[in] Pointer in the current context

Returns:

None

static void _dwn_mgr_ini_(struct ses_ctx_s *pCtx)

Initialize the fsm internal private context.

Parameters:

pCtx[in] Pointer in the current context

Returns:

None

static uint32_t _dwn_mgr_fsm_(struct ses_ctx_s *pCtx, uint32_t u32Evt)

This is the FSM that treat input/output events.

Parameters:
  • pCtx[in] Pointer in the current context

  • u32Evt[in] Input event from outside (see ses_evt_e)

Return values:
static int32_t _dwn_mgr_adjustInit_(struct dwn_mgr_ctx_s *pCtx)

This function adjust context parameters in case download windows has already been started.

Parameters:

pCtx[in] Pointer in the current context

Return values:

offset – value of the next block -1 if there is no more block or day in download windows

struct dwn_mgr_ctx_s
#include <dwn_mgr.h>

This struct defines the download manager internal context.

Network Device Management

Warning

doxygengroup: Cannot find group “wize_net” in doxygen xml output for project “OpenWize Developer Documentation” from directory: _build/xml

Network Device Manager

enum net_event_e

This enumeration define the net device events.

Values:

enumerator NET_EVENT_NONE

Empty event

enumerator NET_EVENT_SUCCESS

Successful event

enumerator NET_EVENT_ERROR

Error event

enumerator NET_EVENT_SEND_DONE

Message has been sent

enumerator NET_EVENT_RECV_DONE

Message has been received

enumerator NET_EVENT_TIMEOUT

Timeout event occurs

enumerator NET_EVENT_FRM_PASSED

Frame received and passed

enumerator NET_EVENT_MSK
enum net_status_e

This define the network return status.

Values:

enumerator NET_STATUS_OK

Network return status OK

enumerator NET_STATUS_ERROR

Network return status ERROR

enumerator NET_STATUS_BUSY

Network return status BUSY

enum net_listen_type_e

This enumeration define the listen type before timeout.

Values:

enumerator NET_LISTEN_TYPE_ONE

One matching message until timeout

enumerator NET_LISTEN_TYPE_DETECT

One matching message, extend timeout if detect occurs

enumerator NET_LISTEN_TYPE_MANY

Many matching messages until timeout

void NetMgr_Setup(phydev_t *pPhyDev, wize_net_t *pWizeNet)

This function setup the NetMgr module.

Parameters:
  • pPhyDev[in] Pointer on the Phy device structure

  • pWizeNet[in] Pointer on the Wize network context

Returns:

None

int32_t NetMgr_Init(void)

This function initialize the NetMgr module.

Return values:
int32_t NetMgr_Open(void *hTaskToNotify)

This function open (acquire) the device.

Parameters:

hTaskToNotify[in] Task handle which will get events back from NetMgr. If NULL, then the caller task will be notified.

Return values:
int32_t NetMgr_Close(void)

This function release the device.

Return values:
int32_t NetMgr_SetUplink(phy_chan_e eChannel, phy_mod_e eMod)

This function set the uplink channel and modulation.

Parameters:
  • eChannel[in] Channel to set

  • eMod[in] Modulation to set

Return values:
int32_t NetMgr_SetDwlink(phy_chan_e eChannel, phy_mod_e eMod)

This function set the downlink channel and modulation.

Parameters:
  • eChannel[in] Channel to set

  • eMod[in] Modulation to set

Return values:
int32_t NetMgr_Ioctl(uint32_t eCtl, uint32_t args)

This function set/get the network device ctl.

Parameters:
  • eCtl[in] CTL to set

  • args[in] extra argument

Return values:
int32_t NetMgr_Send(net_msg_t *pxNetMsg, uint32_t u32TimeOut)

This function send the given message.

Parameters:
  • pxNetMsg[in] Pointer to the message to send

  • u32TimeOut[in] Timeout in millisecond

Return values:
int32_t NetMgr_Listen(net_msg_t *pxNetMsg, uint32_t u32TimeOut, net_listen_type_e eListenType)

This function listen for the given message.

Parameters:
  • pxNetMsg[in] Pointer to the message to listen. The net_msg_t::u8Type field select the filtered message).

  • u32TimeOut[in] Timeout in millisecond

  • eListenType[in] Listen type define the relationship between the timeout and the received message.

Return values:
int32_t NetMgr_ListenReady(void)

This function notify that previous listened net_msg_t buffer is no more pending.

Return values:
int32_t NetMgr_Uninit(void)

This function de-initialize the NetMgr module.

Return values:
static void _net_mgr_main_(void const *argument)

This is the main task function, as FSM that treat events from net/phy and to/from other tasks.

Parameters:

argument[in] (not used)

Returns:

None

static void _net_mgr_evtCb_(uint32_t evt)

ISR Callback function to notify an event occurs.

Parameters:

evt[in] Notified event

Returns:

None

static inline void _net_mgr_notify_caller_(uint32_t evt)

Notify the caller an event occurs.

Parameters:

evt[in] Notified event

Returns:

None

static uint32_t _net_mgr_fsm_(netdev_t *pNetDev, uint32_t u32Evt)

Internal fsm.

Parameters:
  • pNetDev[in] Pointer to NetDev device

  • u32Evt[in] Event to treat

Return values:
static int32_t _net_mgr_send_with_retry_(netdev_t *pNetDev, net_msg_t *pxNetMsg, uint8_t u8Retry)

Internal function to send the given message with retry.

Parameters:
  • pNetDev[in] Pointer to device to send the message

  • pxNetMsg[in] Pointer to the message to send

  • u8Retry[in] Number of retry

Return values:
static int32_t _net_mgr_listen_with_retry_(netdev_t *pNetDev, uint8_t u8Retry)

Internal function to listen for message with retry.

Parameters:
  • pNetDev[in] Pointer to device to listen the message

  • u8Retry[in] Number of retry

Return values:
static int32_t _net_mgr_error_(netdev_t *pNetDev)

Internal function to get and clear errors.

Return values:
  • 0 – Success

  • 1 – Phy abort is required

static int32_t _net_mgr_try_abort_(netdev_t *pNetDev)

Internal function to abort and clean the current net/phy state.

Return values:
  • 0 – Success

  • 1 – Fatal : unable to Abort nor Reset the Phy device

struct wize_ctx_s
#include <net_mgr.h>

This struct defines the network manager context.

Network API

enum netdev_ctl_e

This define netdev control/configuration.

Values:

Set the up-link channel

Set the up-link modulation

Set the down-link channel

Set the down-link modulation

enumerator NETDEV_CTL_SET_FOFFSET

Set the frequency offset

enumerator NETDEV_CTL_SET_PWR

Set the RF transmission power

enumerator NETDEV_CTL_SET_TRANSLEN

Set the max. application layer transmission length

enumerator NETDEV_CTL_SET_RECVLEN

Set the max. application layer reception length

enumerator NETDEV_CTL_SET_NETWID

Set the network ID

enumerator NETDEV_CTL_SET_DWNID

Set the download ID

enumerator NETDEV_CTL_SET_DEVID

Set the device ID

enumerator NETDEV_CTL_CFG_MEDIUM

Configure the medium

enumerator NETDEV_CTL_CFG_PROTO

Configure the protocol

enumerator NETDEV_CTL_GET_DEVID

Get the device ID

enumerator _NETDEV_CTL_ERR_

Delimiter for netdev error control

enumerator NETDEV_CTL_GET_ERR

Get the current error code

enumerator NETDEV_CTL_CLR_ERR

Clear the current error

enumerator NETDEV_CTL_GET_STR_ERR

Get the current error string

enumerator _NETDEV_CTL_STATS_

Delimiter for netdev statistics control

enumerator NETDEV_CTL_GET_STATS

Get the statistics

enumerator NETDEV_CTL_CLR_STATS

Clear the statistics

enumerator NETDEV_CTL_PHY_CMD

Pass command to the PHY

enum netdev_evt_e

This define the netdev possible events.

Values:

enumerator NETDEV_EVT_NONE
enumerator NETDEV_EVT_RX_STARTED

Started to receive a packet

enumerator NETDEV_EVT_RX_COMPLETE

Finished receiving a packet

enumerator NETDEV_EVT_TX_STARTED

Started to transfer a packet

enumerator NETDEV_EVT_TX_COMPLETE

Transfer packet complete

enumerator NETDEV_EVT_ERROR

An error occurs in net, phy or stack

enumerator NETDEV_EVT_TIMEOUT

Timeout event occurs

enumerator NETDEV_EVT_LAST

Last event ID

enum netdev_status_e

This define the netdev return status.

Values:

enumerator NETDEV_STATUS_OK

Net device return status OK

enumerator NETDEV_STATUS_ERROR

Net device return status ERROR

enumerator NETDEV_STATUS_BUSY

Net device return status BUSY

enum netdev_err_type_e

This define the netdev possible error types.

Values:

enumerator NETDEV_ERROR_NONE

Error None

enumerator NETDEV_ERROR_PHY

Error in phy dev

enumerator NETDEV_ERROR_PROTO

Error in protocol

enumerator NETDEV_ERROR_NET

Error in net dev

enum netdev_state_e

This define the netdev possible states.

Values:

enumerator NETDEV_STATE_UNKWON

Net Device state is UNKNOWN

enumerator NETDEV_STATE_IDLE

Net device is IDLE

enumerator NETDEV_STATE_BUSY

Net device is BUSY

enumerator NETDEV_STATE_ERROR

Net device is ERROR

typedef struct netdev_s netdev_t

This define the netdev type.

typedef void (*netdev_evt_cb_t)(uint32_t eEvt)

This define the event call-back pointer function.

typedef struct wize_net_s wize_net_t

This structure define the Wize network context.

int32_t WizeNet_Setup(netdev_t *pNetdev, wize_net_t *pWizeCtx, phydev_t *pPhydev)

This function setup the netdev_t device.

Parameters:
  • pNetdev[in] Pointer on netdev_t device

  • pWizeCtx[in] Pointer on network context

  • pPhydev[in] Pointer on the PHY device context

Return values:
int32_t WizeNet_Init(netdev_t *pNetdev, netdev_evt_cb_t pfcbEvent)

This function initialize the netdev_t and phy devices.

Parameters:
  • pNetdev[in] Pointer on netdev_t device

  • pfcbEvent[in] Event call-back to upper layer (still in interrupt)

Return values:
int32_t WizeNet_Uninit(netdev_t *pNetdev)

This function de-initialize the netdev_t and phy devices.

Parameters:

pNetdev[in] Pointer on netdev_t device

Return values:
int32_t WizeNet_Send(netdev_t *pNetdev, net_msg_t *pNetMsg)

This function send the given message.

Parameters:
  • pNetdev[in] Pointer on netdev_t device

  • pNetMsg[in] Pointer on structure that hold the message

Return values:
int32_t WizeNet_Recv(netdev_t *pNetdev, net_msg_t *pNetMsg)

This function get the received message.

Parameters:
  • pNetdev[in] Pointer on netdev_t device

  • pNetMsg[in] Pointer on structure that will hold the message

Return values:
int32_t WizeNet_Listen(netdev_t *pNetdev)

This function open a listen window.

Parameters:

pNetdev[in] Pointer on netdev_t device

Return values:
int32_t WizeNet_Ioctl(netdev_t *pNetdev, uint32_t eCtl, uint32_t args)

This function Get/Set internal configuration variable.

Parameters:
  • pNetdev[in] Pointer on netdev_t device

  • eCtl[in] Id of configuration variable to get/set (see netdev_ctl_e)

  • args[inout] scalar or pointer that hold the value to set/get

Return values:
static int32_t _check_idle_state(netdev_t *pNetdev)

This function check if the device is in IDLE state.

Parameters:

pNetdev[in] Pointer on netdev_t device

Return values:
static void _evt_cb(void *p_CbParam, uint32_t evt)

Callback function, from Phy to Higher level (still in interrupt handler)

Parameters:
  • p_CbParam[in] Pointer on netdev_t device structure

  • evt[in] Event from lower PHY layer

Returns:

Status

union device_id_t
#include <net_api.h>

This structure is used to hold the device information.

Public Members

uint8_t aDevInfo[8]

Device info .

uint8_t aManuf[2]

Device manufacturer (8 BCD, LSB first).

uint8_t aAddr[6]

Unique device identification number (8 BCD, LSB first).

uint8_t aNum[4]

Unique device identification number (8 BCD, LSB first).

uint8_t u8Ver

Device version (BCD).

uint8_t u8Type

Device type (BCD)

struct device_id_t::[anonymous] [anonymous]
struct netdev_s
#include <net_api_private.h>

This define the netdev context.

struct medium_cfg_s
#include <net_api_private.h>

This structure define the medium configuration (RX/TX channel, modulation, power…

struct wize_net_s
#include <net_api_private.h>

This structure define the Wize network context.

Phy Interface

enum phy_status_e

This define the PHY device status.

Values:

enumerator PHY_STATUS_OK

Status OK

enumerator PHY_STATUS_ERROR

Status Error

enumerator PHY_STATUS_BUSY

Status Busy

enumerator PHY_STATUS_DISABLE

Status Disable

enum phy_ctl_e

This define the available command to change the PHY state.

Values:

enumerator PHY_CTL_SET_TX_FREQ_OFF

Set the TX frequency Offset

enumerator PHY_CTL_SET_TX_POWER

Set the TX Power

enumerator PHY_CTL_SET_PA

Enable/Disable the PA (if any)

enumerator PHY_CTL_SET_PWR_ENTRY

Set the calibrate values for a specific Power entry

enumerator PHY_CTL_GET_TX_FREQ_OFF

Get the TX frequency Offset

enumerator PHY_CTL_GET_TX_POWER

Get the TX Power

enumerator PHY_CTL_GET_PA

Get the PA state

enumerator PHY_CTL_GET_PWR_ENTRY

Get the calibrate values for a specific Power entry

enumerator PHY_CTL_GET_FREQ_ERR

Get the frequency error

enumerator PHY_CTL_GET_RSSI

Get the RX RSSI

enumerator PHY_CTL_GET_NOISE

Get the TX Noise

enumerator PHY_CTL_GET_ERR

Get the Last error id

enumerator PHY_CTL_GET_STR_ERR

Get the Last error string

enumerator PHY_CTL_SPE
enumerator PHY_CTL_SPE_TEST_MODE

Test mode (if any)

enumerator PHY_CTL_CMD
enumerator PHY_CTL_CMD_PWR_OFF

Power off the device

enumerator PHY_CTL_CMD_PWR_ON

Power on the device

enumerator PHY_CTL_CMD_RESET

Reset the PHY device

enumerator PHY_CTL_CMD_READY

Go in ready state

enumerator PHY_CTL_CMD_SLEEP

Sleep command

enumerator PHY_CTL_CMD_LAST
enum phy_test_mode_e

This define the available test mode.

Values:

enumerator PHY_TST_MODE_NONE

Test mode deactivated

enumerator PHY_TST_MODE_RX

RX test mode

enumerator PHY_TST_MODE_PER_RX

PER RX test mode

enumerator PHY_TST_MODE_TX

TX test mode

enumerator PHY_NB_TST_MODE
enum phydev_evt_e

This define the PHY device events.

Values:

enumerator PHYDEV_EVT_NONE

Nothing special

enumerator PHYDEV_EVT_RX_STARTED

Received packet started (preamble received)

enumerator PHYDEV_EVT_RX_COMPLETE

Packet has been received

enumerator PHYDEV_EVT_TX_STARTED

Transfer packet started

enumerator PHYDEV_EVT_TX_COMPLETE

Transfer packet complete

enumerator PHYDEV_EVT_CCA_STARTED

CCA sequence has started

enumerator PHYDEV_EVT_CCA_COMPLETE

CCA sequence complete

enumerator PHYDEV_EVT_ERROR

Error occurs

enum phy_chan_e

This define the available channel.

Values:

enumerator PHY_CH100

(100 + 0) * 10 = 100 (0x64)

enumerator PHY_CH110

(100 + 1) * 10 = 110 (0x6E)

enumerator PHY_CH120

(100 + 2) * 10 = 120 (0x78)

enumerator PHY_CH130

(100 + 3) * 10 = 130 (0x82)

enumerator PHY_CH140

(100 + 4) * 10 = 140 (0x8C)

enumerator PHY_CH150

(100 + 5) * 10 = 150 (0x96)

enumerator PHY_NB_CH
enum phy_mod_e

This define the available modulation.

Values:

enumerator PHY_WM2400

WM2400 modulation

enumerator PHY_WM4800

WM4800 modulation

enumerator PHY_WM6400

WM6400 modulation - TX only

enumerator PHY_NB_MOD
enum phy_power_e

This define the available TX power.

Values:

enumerator PHY_PMAX_minus_0db

Maximum TX power

enumerator PHY_PMAX_minus_6db

Maximum TX power minus 6dB

enumerator PHY_PMAX_minus_12db

Maximum TX power minus 12db

enumerator PHY_NB_PWR
typedef void (*phydev_evt_cb_t)(void *pCbParam, uint32_t eEvt)

PHY device event call-back.

typedef struct phydev_s phydev_t

The PHY device type.

typedef struct phy_if_s phy_if_t

PHY device interface.

struct phy_if_s
#include <phy_itf.h>

PHY device interface.

struct phydev_s
#include <phy_itf.h>

PHY device structure.

Protocol

enum app_type_e

This enum defines the application layer payload type .

Values:

enumerator APP_INSTALL

Application Install (used for PING and PONG).

enumerator APP_ADMIN

Application Administration (used for COMMAND and RESPONSE).

enumerator APP_DOWNLOAD

Application Download.

enumerator APP_DATA

Application Data (used by the specific L7).

enumerator APP_DATA_PRIO

Application Priority Data (used by the specific L7).

enumerator APP_UNKNOWN

Application payload type is unknown.

enumerator APP_TYPE_NB
enum ret_code_e

This enum define the common return codes.

Values:

enumerator PROTO_SUCCESS

Success, everything is fine.

enumerator PROTO_FAILED

Failed, something wrong happened.

enumerator PROTO_STACK_MISMATCH_ERR

Incoherent call/parameters between layers.

enumerator PROTO_INTERNAL_CRC_ERR

Internal CRC error computation.

enumerator PROTO_INTERNAL_HASH_ERR

Internal hash error computation.

enumerator PROTO_INTERNAL_CIPH_ERR

Internal cipher or decipher error computation.

enumerator PROTO_INTERNAL_NULL_ERR

Error due to a NULL pointer.

enumerator PROTO_FRM_ERR

Frame error related.

enumerator PROTO_HEAD_END_AUTH_ERR

Head-End authentication failed (Hash Kenc, Klog, kchg computation result is not valid)

enumerator PROTO_GATEWAY_AUTH_ERR

Gateway authentication failed (Hash Kmac computation result is not valid)

enumerator PROTO_PROTO_UNK_ERR

The Protocol is unknown (not Wize, CiField doesn’t match).

enumerator PROTO_FRAME_UNK_ERR

The Frame is unknown (not Wize, CField doesn’t match).

enumerator PROTO_FRAME_CRC_ERR

The Frame is corrupted (CRC computation is not valid).

enumerator PROTO_FRAME_RS_ERR

The Frame is corrupted (RS could not correct the frame).

enumerator PROTO_FRAME_SZ_ERR

The Frame size is too short (< 0x16)

enumerator PROTO_APP_MSG_SZ_ERR

The APP message length is too long.

enumerator PROTO_KEYID_UNK_ERR

The key id is unknown or not match.

enumerator PROTO_NETWID_UNK_ERR

The Network id is unknown or not match.

enumerator PROTO_FRM_WRN

Frame warning related.

enumerator PROTO_GATEWAY_AUTH_WRN

Don’t know how to authenticate the Gateway (Kmac selection OprID/NetwID)

enumerator PROTO_DOWNLOAD_VER_WRN

The Download version is invalid (not register from previous)

enumerator PROTO_FRM_INF

Frame info related.

enumerator PROTO_DW_BLK_PASS_INF

The Download block id is bypassed (already down loaded)

enumerator PROTO_FRAME_PASS_INF

The received frame was bypass (we are not the destination device or didn’t received an anndownload or not waiting PONG)

enumerator PROTO_RET_CODE_NB
enum cfield_e

This enum defines the link layer frame type .

Values:

enumerator INSTPONG

PONG (CNF_IR). From Gateway to Device

enumerator INSTPING

PING (SND_IR). From Device to Gateway

enumerator COMMAND

COMMAND (SND_UD2). From Gateway to Device

enumerator RESPONSE

RESPONSE (RSP_UD). From Device to Gateway

enumerator DATA

DATA (SND_NR). From Device to Gateway

enumerator DATA_PRIO

Priority DATA. From Device to Gateway

typedef struct frm_err_stats_s frm_err_stats_t

This structure hold the frame statistics.

typedef struct proto_stats_s net_stats_t

This structure hold the net device statistics.

typedef struct net_msg_s net_msg_t

This structure is used to hold net device message.

const char *const wize_err_msg[]

This table defines the protocol error string messages.

const char *const wize_err_msg [] = {[PROTO_SUCCESS]            = "SUCCESS",[PROTO_FAILED]             = "FAILED",[PROTO_STACK_MISMATCH_ERR] = "Incoherent call/parameters between layers",[PROTO_INTERNAL_CRC_ERR]   = "Internal CRC error computation",[PROTO_INTERNAL_HASH_ERR]  = "Internal hash error computation",[PROTO_INTERNAL_CIPH_ERR]  = "Internal cipher or decipher error computation",[PROTO_INTERNAL_NULL_ERR]  = "Error due to a NULL pointer",[PROTO_HEAD_END_AUTH_ERR]  = "Head-End authentication failed (Hash Kenc, Klog, Kchg computation result is not valid)",[PROTO_GATEWAY_AUTH_ERR]   = "Gateway authentication failed (Hash Kmac  computation result is not valid)",[PROTO_PROTO_UNK_ERR]      = "The Protocol is unknown (not Wize, CiField doesn't match).",[PROTO_FRAME_UNK_ERR]      = "The Frame is unknown (not Wize, CField doesn't match).",[PROTO_FRAME_CRC_ERR]      = "The Frame is corrupted (CRC computation is not valid).",[PROTO_FRAME_RS_ERR]       = "The Frame is corrupted (RS could not correct the frame).",[PROTO_FRAME_SZ_ERR]       = "The Frame size is too short (< 12) or too long ( > 127, but != 255)",[PROTO_APP_MSG_SZ_ERR]     = "The APP message length is too long",[PROTO_KEYID_UNK_ERR]      = "The key id is unknown",[PROTO_NETWID_UNK_ERR]     = "The Network id is unknown or not match",[PROTO_GATEWAY_AUTH_WRN]   = "Don't know how to authenticate the Gateway (Kmac selection OprID/NetwID)",[PROTO_DOWNLOAD_VER_WRN]   = "The Download version is invalid (not register from previous)",[PROTO_DW_BLK_PASS_INF]    = "The Download block id is bypassed (already down loaded)",[PROTO_FRAME_PASS_INF]     = "The received frame was bypass (we are not the destination device or didn't received an anndownload or not waiting PONG)",}

This table defines the protocol error string messages.

uint8_t Wize_ProtoBuild(struct proto_ctx_s *pCtx, net_msg_t *pNetMsg)

This function build the Presentation and Link Layer. The Application Layer must be into the given net_msg_t buffer.

Parameters:
  • *pCtx[inout] Pointer on structure that hold the protocol context.

  • *pNetMsg[inout] Pointer on structure that hold the Application message.

Return values:
uint8_t Wize_ProtoExtract(struct proto_ctx_s *pCtx, net_msg_t *pNetMsg)

This function extract the Presentation and Link Layer. The resulting Application Layer is set into the given net_msg_t buffer.

Parameters:
  • *pCtx[inout] Pointer on structure that hold the protocol context.

  • *pNetMsg[inout] Pointer on structure that hold the Application message.

Return values:
void Wize_ProtoStats_RxUpdate(struct proto_ctx_s *pCtx, uint8_t u8ErrCode, uint8_t u8Rssi)

This function update the reception statistics.

Parameters:
  • *pCtx[inout] Pointer on structure that hold the protocol context.

  • u8ErrCode[in] Protocol error code returned from previous Wize_ProtoExtract call.

  • u8Rssi[in] RSSI from previous reception.

Return values:

None

void Wize_ProtoStats_TxUpdate(struct proto_ctx_s *pCtx, uint8_t u8ErrCode, uint8_t u8Noise)

This function update the transmission statistics.

Parameters:
  • *pCtx[inout] Pointer on structure that hold the protocol context.

  • u8ErrCode[in] Protocol error code returned from previous Wize_ProtoBuild call.

  • u8Noise[in] Noise from previous transmission.

Return values:

None

void Wize_ProtoStats_RxClear(struct proto_ctx_s *pCtx)

This function clear the reception statistics.

Parameters:

*pCtx[inout] Pointer on structure that hold the protocol context.

Return values:

None

void Wize_ProtoStats_TxClear(struct proto_ctx_s *pCtx)

This function clear the transmission statistics.

Parameters:

*pCtx[inout] Pointer on structure that hold the protocol context.

Return values:

None

const char *Wize_Proto_GetStrErr(uint8_t eErr)

This function return a pointer on string error.

Parameters:

eErr[in] The error code number.

Return values:

Pointer – on string error

static uint8_t _encrypt_(uint8_t *p_In, uint8_t u8_Sz, uint8_t p_Ctr[CTR_SIZE], uint8_t u8_KeyId)

Wrapper to Crypto_Encrypt(p_Out, p_In, u8_Sz, p_Ctr, u8_KeyId) function.

Parameters:
  • *p_In[inout] point on data to encrypt (plaintext). This will be replaced by the encrypted one.

  • u8_Sz[in] length, in byte, of the data stream to encrypt.

  • p_Ctr[in] initial value for the AES counter.

  • u8_KeyId[in] the key id to be used for encryption.

Returns:

See the return codes from Crypto_Encrypt function.

static uint8_t _decrypt_(uint8_t *p_In, uint8_t u8_Sz, uint8_t p_Ctr[CTR_SIZE], uint8_t u8_KeyId)

Wrapper to Crypto_Decrypt(p_Out, p_In, u8_Sz, p_Ctr, u8_KeyId) function.

Parameters:
  • *p_In[inout] point on data to decrypt (plaintext). This will be replaced by the decrypted one.

  • u8_Sz[in] length, in byte, of the data stream to decrypt.

  • p_Ctr[in] initial value for the AES counter.

  • u8_KeyId[in] the key id to be used for decryption.

Returns:

See the return codes from Crypto_Decrypt function.

static uint8_t _download_extract(struct proto_ctx_s *pCtx, net_msg_t *pNetMsg)

This function extract the Download Layer. The resulting Application Layer is set into the given net_msg_t buffer. buffer.

Parameters:
  • *pCtx[inout] Pointer on structure that hold the protocol context.

  • *pNetMsg[inout] Pointer on structure that hold the Application message.

Return values:
static uint8_t _exchange_extract(struct proto_ctx_s *pCtx, net_msg_t *pNetMsg)

This function extract the Exchange Layer. The resulting Application Layer is set into the given net_msg_t buffer. buffer.

Parameters:
  • *pCtx[inout] Pointer on structure that hold the protocol context.

  • *pNetMsg[inout] Pointer on structure that hold the Application message.

Return values:
static uint8_t _exchange_build(struct proto_ctx_s *pCtx, net_msg_t *pNetMsg)

This function build the Exchange Layer. The Application Layer must be into the given net_msg_t buffer buffer.

Parameters:
  • *pCtx[inout] Pointer on structure that hold the protocol context.

  • *pNetMsg[inout] Pointer on structure that hold the Application message.

Return values:
L6VER_WIZE_REV_1_2

This macro define the Wize revision number.

Wize Revision 1.2.

L6VER_WIZE_REV_0_0

Wize Revision 0.0.

L6VER_WIZE_REV_1_0

Wize Revision 1.0.

L6VER_WIZE_REV_1_1

Wize Revision 1.1.

L6VERS
L6APP_ADM
L6APP_INST
struct frm_err_stats_s
#include <proto.h>

This structure hold the frame statistics.

struct proto_stats_s
#include <proto.h>

This structure hold the net device statistics.

struct net_msg_s
#include <proto.h>

This structure is used to hold net device message.

struct l2_exch_header_t
#include <proto_private.h>

This structure defines the link layer exchange header.

struct l2_down_header_t
#include <proto_private.h>

This structure defines the link layer download header.

#include <proto_private.h>

This structure defines the link layer exchange footer.

#include <proto_private.h>

This structure defines the link layer download footer.

struct l6_exch_header_t
#include <proto_private.h>

This structure defines the presentation layer exchange header.

struct l6_down_header_t
#include <proto_private.h>

This structure defines the presentation layer download header.

#include <proto_private.h>

This structure defines the presentation layer exchange footer.

#include <proto_private.h>

This structure defines the presentation layer download footer.

struct proto_config_s
#include <proto_private.h>

This structure define the protocol configuration.

struct proto_ctx_s
#include <proto_private.h>

This structure define the protocol context.