API Reference
Code Organization
Repository structure
The repository structure is as follows :
OpenWize
├── docs : documentation directory
├── demo
│ ├── Nucleo-L476 : contains source code specific to the Demo and Nucleo-L476 board
│ │ ├── app : A simple demo application
│ │ ├── board : Nucleo L476 board specific
│ │ ├── bsp : demo specific board support package for Nucleo L476
│ │ └── device : demo specific device driver
│ └── project : IDE project files
├── sources : contains source code specific to the OpenWize
│ ├── Samples : source code of libraries, provided as "samples", required by the WizeCore
│ └── WizeCore : Wize Stack source code
├── third-party :
│ ├── firmware
│ │ └── STM32 : STM32 HAL as a submodule
│ ├── libraries
│ │ └── Tinycrypt : Tinycrypt library as a submodule
│ ├── rtos
│ │ └── FreeRTOS : FreeRTOS as a submodule
│ └── testing
│ └── Unity : CMock as a submodule
├── tools
│ ├── build_support : cmake files to help building OpenWize
│ └── scripts : various bash script
│
└── CMakeLists.txt : the main CMakeList.txt file
Sources directory
The sources directory is organized as follow :
There are mainly two sub-directories “Samples” and “WizeCore”. “WizeCore” is the stack implementation, while “Samples” contains some required libraries by the Wize stack. The WizeCore is split in four folders, each one corresponding more or less to an abstraction layer.
sources
├── config.in
├── Samples
│ ├── CRC_sw
│ ├── Crypto
│ ├── ImgStorage
│ ├── Logger
│ ├── Parameters
│ ├── ReedSolomon
│ └── TimeEvt
├── WizeCore
│ ├── app
│ ├── mgr
│ ├── net
│ ├── proto
│ └── CMakeLists.txt
├── CMakeLists.txt
└── OpenWize_Options.cmake
Samples sub directory
CRC_swCRC_sw library provides functions to compute and check the CRC16 (Cyclic Redundancy Check) as specified by Wize Lan Protocol Specifications v1.2.
CryptoCrypto library provides interface functions to cipher, uncipher, compute AES-CMAC and SHA256. This module relies on tinycrypt library located in “third-party/libraries/Tinycrypt” directory (https://github.com/intel/tinycrypt.git).
ReedSolomonReedSolomon library implement Reed-Solomon code correction algorithm RS(255,223). This module is a port of the http://www.eccpage.com/rs.c
ImgStorageImgStorage library provides an interface for storing downloaded firmware block on physical memory.
ParametersParameters library provides interfaces to set and get parameters.
TimeEvtTimeEvt module provides event to the task at the required time.
LoggerLogger module provides a way to log out messages (info, warning, error, debug).
WizeCore sub directory
protoproto implement all necessary to treat the link and presentation layer from the Wize protocol, that is :
build/extract the Link and Presentation Layers information
cipher/un-cipher the application message
compute and check the authentication hash
compute and check the confidentiality hash
compute and check the CRC
compute and check the Reed-Solomon code and correct the frame when possible (Download layer only)
proto depends on the “CRC_sw”, “Crypto” and “ReedSolomon” libraries.
netnet implements a kind of low-level driver to :
drive the protocol in proto
provide an abstract layer to higher level, with function like “send(…)” or “recev(…)”.
provide an interface to the phy driver implementation
net depends on proto
mgrmgr implements four managers :
adm_mgr, inst_mgr and dwn_mgr manage respectively the administration, installation and download sessions. Their role is mainly to ensure the session timing correctness.
net_mgr is a kind of high level driver for the net module. In particular, it manages the net+phy resources in thread-safe manner and ensure the timing correctness in the “send” and “listen” windows.
mgr depends on net, TimeEvt, Logger and FreeRTOS.
appapp implements application layer of the Wize protocol and provide an API to the rest of application firmware.
provide API to send DATA message and execute an installation (PING/PONG) session
open/close administration, installation and download sessions.
build/extract generic administration layer (aka DATA, COMMAND, RESPONSE)
build/extract installation layer (aka PING/PONG)
deal with downloaded firmware image (store, validate)
app depends on mgr, TimeEvt, ImgStorage, Parameters, Logger and FreeRTOS.
Demo directory
Nucleo-L476
├── app : application code
│ ├── CMakeLists.txt
│ ├── cfg : contains the defaults parameters configuration xml files
│ ├── gen : contains the defaults parameters tables as .c and .h files
│ ├── include : application include directory
│ ├── src : application source directory
│ └── sys : initialize the system modules (RTOS, Logger, Stack...)
├── board : Contains the minimum to initialize the board low level (peripherals, clocks)
│ ├── CMakeLists.txt
│ ├── include :
│ ├── ld :
│ ├── src :
│ └── startup :
├── bsp : Restricted and simple Board Support Package
│ ├── CMakeLists.txt
│ ├── include
│ └── src
├── device
│ └── PhyFake : Wrapper around UART to "simulate" a Phy device (aka. RF device)
│ ├── CMakeLists.txt
│ ├── include
│ └── src
├── FreeRTOSConfig.cmake : FreeRTOS configuration file for this application
├── STM32HALConfig.cmake : STM32 HAL configuration file for this board/bsp
└── Nucleo-L476.cmake : main cmake file to build and link everything together
TBD
Samples
CRC sw
-
inline uint8_t CRC_Check(uint16_t u16_CrcA, uint16_t u16_CrcB)
Check if two CRC are equal.
- Parameters:
u16_CrcA – [in] First CRC
u16_CrcB – [in] Second CRC
- Returns:
1 equal; 0 otherwise
-
uint8_t CRC_Compute(uint8_t *p_Buf, uint8_t u8_Sz, uint16_t *p_Crc)
This function compute the CRC as defined by the EN13757 standard.
- Parameters:
p_Buf – [in] Pointer in the message buffer
u8_Sz – [in] The buffer size
p_Crc – [out] Computed CRC
- Returns:
1 success, 0 otherwise.
-
static uint16_t _update_crc16_(const uint16_t *p_Table, uint16_t u16_Crc, uint8_t u8_C)
Private function to compute a part of the CRC.
- Parameters:
p_Table – [in] Pointer on the polynomial table
u16_Crc – [in] The CRC
u8_C – [in] Current byte to compute on
- Returns:
partial CRC.
Crypto
-
enum crypto_code_e
Returned code from Crypto functions.
Values:
-
enumerator CRYPTO_KO
Crypto function failed.
-
enumerator CRYPTO_OK
Crypto function success.
-
enumerator CRYPTO_KID_UNK_ERR
The key id is unknown.
-
enumerator CRYPTO_INT_NULL_ERR
Error due to a NULL pointer.
-
enumerator CRYPTO_KO
- KEY_STORE key_s _a_Key_ []
This table hold all keys used in the system.
-
inline uint8_t Crypto_Encrypt(uint8_t *p_Out, uint8_t *p_In, uint8_t u8_Sz, uint8_t p_Ctr[CTR_SIZE], uint8_t u8_KeyId)
Wrapper around crypt function.
This function encrypt (with the AES128 in CTR mode) a given message.
- Parameters:
p_Out – [inout] Pointer on output buffer (Cipher text).
p_In – [inout] Pointer on input buffer (Plain text).
u8_Sz – [in] Input buffer size
p_Ctr – [in] Counter buffer. Warning : it will be altered by this function.
u8_KeyId – [in] The key id to use for encrypt
- Return values:
return – crypto_code_e::CRYPTO_OK (1) if everything is fine return crypto_code_e::CRYPTO_KO (0) if something goes wrong return crypto_code_e::CRYPTO_KID_UNK_ERR (2) id the key id is out of box return crypto_code_e::CRYPTO_INT_NULL_ERR (4) if one of the given pointer is NULL
-
inline uint8_t Crypto_Decrypt(uint8_t *p_Out, uint8_t *p_In, uint8_t u8_Sz, uint8_t p_Ctr[CTR_SIZE], uint8_t u8_KeyId)
Wrapper around the crypt function.
This function decrypt (with the AES128 in CTR mode) a given message.
- Parameters:
p_Out – [inout] Pointer on output buffer (Plain text).
p_In – [inout] Pointer on input buffer (Cipher text).
u8_Sz – [in] Input buffer size
p_Ctr – [in] Counter buffer. Warning : it will be altered by this function.
u8_KeyId – [in] The key id to use for decrypt
- Return values:
return – crypto_code_e::CRYPTO_OK (1) if everything is fine return crypto_code_e::CRYPTO_KO (0) if something goes wrong return crypto_code_e::CRYPTO_KID_UNK_ERR (2) id the key id is out of box return crypto_code_e::CRYPTO_INT_NULL_ERR (4) if one of the given pointer is NULL
-
inline uint8_t Crypto_AES128_CMAC(uint8_t *p_Hash, uint8_t *p_Msg, uint8_t u8_Sz, uint8_t p_Ctr[CTR_SIZE], uint8_t u8_KeyId)
Wrapper around the AES128_CMAC function.
This function compute the footprint (with the AES128 in CMAC mode) of a given message.
- Parameters:
p_Hash – [inout] Pointer on output buffer (footprint).
p_Msg – [inout] Pointer on input buffer (the message on which the footprint is computed)
u8_Sz – [in] Input buffer size
p_Ctr – [in] Counter buffer.
u8_KeyId – [in] The key id to use for compute the footprint
- Return values:
return – crypto_code_e::CRYPTO_OK (1) if everything is fine return crypto_code_e::CRYPTO_KO (0) if something goes wrong return crypto_code_e::CRYPTO_KID_UNK_ERR (2) id the key id is out of box return crypto_code_e::CRYPTO_INT_NULL_ERR (4) if one of the given pointer is NULL
-
inline uint8_t Crypto_SHA256(uint8_t p_Sha256[SHA256_SIZE], uint8_t *p_Data, uint32_t u32_Sz)
Wrapper around the SHA256 function.
This function compute the SHA256 of given buffer..
- Parameters:
p_Sha256 – [in] Pointer on output buffer (sha256, 32 bytes).
p_Data – [out] Pointer on input buffer (the message on which the footprint is computed)
u32_Sz – [in] Input buffer size
- Return values:
return – crypto_code_e::CRYPTO_OK (1) if everything is fine return crypto_code_e::CRYPTO_KO (0) if something goes wrong return crypto_code_e::CRYPTO_INT_NULL_ERR (4) if one of the given pointer is NULL
-
uint8_t Crypto_WriteKey(uint8_t p_Key[KEY_SIZE], uint8_t u8_KeyId)
This function set (write) a key at specified key id.
- Parameters:
p_Key – [in] The given key to set.
u8_KeyId – [in] The key id to use.
- Return values:
CRYPTO_OK – (1) if everything is fine
CRYPTO_KID_UNK_ERR – (2) id the key id is out of box
-
static uint8_t _crypt_(uint8_t *p_Out, uint8_t *p_In, uint8_t u8_Sz, uint8_t p_Ctr[CTR_SIZE], uint8_t u8_KeyId)
This function en/de crypt with the AES128 in CTR mode.
- Parameters:
p_Out – [inout] Pointer on output buffer. Plain text for decrypt, cipher text for encrypt.
p_In – [inout] Pointer on input buffer. Cipher text for encrypt, plain text for decrypt.
u8_Sz – [in] Input buffer size
p_Ctr – [in] Counter buffer. Warning : it will be altered by this function.
u8_KeyId – [in] The key id to use for encrypt or decrypt
- Return values:
return – crypto_code_e::CRYPTO_OK (1) if everything is fine return crypto_code_e::CRYPTO_KO (0) if something goes wrong return crypto_code_e::CRYPTO_KID_UNK_ERR (2) id the key id is out of box return crypto_code_e::CRYPTO_INT_NULL_ERR (4) if one of the given pointer is NULL
-
static uint8_t _AES128_CMAC_(uint8_t *p_Hash, uint8_t *p_Msg, uint8_t u8_Sz, uint8_t p_Ctr[CTR_SIZE], uint8_t u8_KeyId)
This function compute the footprint with the AES128 in CMAC mode.
- Parameters:
p_Hash – [inout] Pointer on output buffer (footprint).
p_Msg – [inout] Pointer on input buffer (the message on which the footprint is computed)
u8_Sz – [in] Input buffer size
p_Ctr – [in] Counter buffer.
u8_KeyId – [in] The key id to use for compute the footprint
- Return values:
return – crypto_code_e::CRYPTO_OK (1) if everything is fine return crypto_code_e::CRYPTO_KO (0) if something goes wrong return crypto_code_e::CRYPTO_KID_UNK_ERR (2) id the key id is out of box return crypto_code_e::CRYPTO_INT_NULL_ERR (4) if one of the given pointer is NULL
-
static uint8_t _SHA256_(uint8_t p_Sha256[SHA256_SIZE], uint8_t *p_Data, uint32_t u32_Sz)
This function compute the SHA256 of given buffer.
- Parameters:
p_Sha256 – [in] Pointer on output buffer (sha256, 32 bytes).
p_Data – [out] Pointer on input buffer (the message on which the footprint is computed)
u32_Sz – [in] Input buffer size
- Return values:
return – crypto_code_e::CRYPTO_OK (1) if everything is fine return crypto_code_e::CRYPTO_KO (0) if something goes wrong return crypto_code_e::CRYPTO_INT_NULL_ERR (4) if one of the given pointer is NULL
-
static inline uint8_t _set_key_(uint8_t p_Key[KEY_SIZE], uint8_t u8_KeyId)
This function set (write) a key at specified key id.
- Parameters:
p_Key – [in] The given key to set.
u8_KeyId – [in] The key id to use.
- Return values:
CRYPTO_OK – (1) if everything is fine
CRYPTO_KID_UNK_ERR – (2) id the key id is out of box
- void * secure_memcpy (void *__restrict __dest, const void *__restrict __src, size_t __n)
This function is intended to replaced memcpy into secure area.
- Parameters:
__dest – [in] The destination pointer
__src – [in] The source pointer
__n – [in] Number of byte to copy
- Return values:
return – the destination pointer
-
void *secure_memset(void *__s, int __c, size_t __n)
This function is intended to replaced memset into secure area.
- Parameters:
__s – [in] The destination pointer
__c – [in] The character value to set
__n – [in] The number of char to set
- Return values:
return – the destination pointer
-
KEY_STORE
-
KEY_MAX_NB
Define the maximum number of key.
-
KEY_NONE_ID
Define the key id for no encryption.
-
KEY_ENC_MIN
Define the first key id for the kenc key.
-
KEY_ENC_MAX
Define the last key id for the kenc key.
-
KEY_CHG_ID
Define the key id for the kchg key.
-
KEY_MOB_ID
Define the key id for the kmob key.
-
KEY_MAC_ID
Define the key id for the kmac key.
-
KEY_LOG_ID
Define the key id for the klog key.
-
Crypto_KEY_PRIV_H_
-
struct key_s
- #include <key_priv.h>
This structure hold a key used for en/de-cryption and authentication.
Reed-Solomon
-
static const uint8_t pp[mm + 1] = {1, 0, 1, 1, 1, 0, 0, 0, 1}
This variable hold the irreducible polynomial coefficients (1+x^^2+x^^3+x^^4+x^^8)
-
static int16_t index_of[nn + 1]
This variable hold the index values.
-
static uint8_t alpha_to[nn + 1]
This variable hold the alpha values.
-
static uint8_t gg[nn - kk + 1]
This variable hold the Galois Field values.
-
void RS_Init(void)
This function initialize the Galois field and polynomial generator tables.
-
uint8_t RS_Decode(uint8_t b_recd[RS_MESSAGE_SZ + RS_PARITY_SZ])
This function detect and correct the given message.
- Parameters:
b_recd – [inout] Pointer on source and destination data (Message and Parity). b_recd[0 to 222] contains message data, while b_recd[223 to 223 + 32] contains the parity bytes).
- Return values:
0 – Error;
1 – Success
-
void RS_Encode(uint8_t p_Data[RS_MESSAGE_SZ], uint8_t p_Out[RS_PARITY_SZ])
This function generate the parity word of the given message.
- Parameters:
p_Data – [in] Pointer on message (source data).
p_Out – [out] Pointer on parity (destination).
-
uint32_t RS_GetMsgSize(void)
This function give the message size (in byte).
- Returns:
The message size.
-
uint32_t RS_GetParitySize(void)
This function give the parity word size (in byte).
- Returns:
The parity word size.
-
const uint8_t *RS_GetGG_ptr(uint32_t *u32_ggSz)
This function give the generator polynomial pointer.
- Parameters:
*u32_ggSz – [inout] This pointer will hold the generator polynomial size.
- Returns:
The generator polynomial pointer.
-
const uint8_t *RS_GetAlphaOf_ptr(uint32_t *u32_alphaOfSz)
This function give the alpha_to pointer.
- Parameters:
*u32_alphaOfSz – [inout] This pointer will hold the alpha_to size.
- Returns:
The alpha_to pointer.
-
const int16_t *RS_GetIndexOf_ptr(uint32_t *u32_indexOfSz)
This function give the index_of pointer.
- Parameters:
*u32_indexOfSz – [inout] This pointer will hold the index_of size.
- Returns:
The index_of pointer.
-
static void _generate_gf_(void)
This private function generate the Galois-Field.
Generate GF(2**mm) from the irreducible polynomial p(X) in pp[0]..pp[mm] lookup tables:
index->polynomial form alpha_to[] contains j=alpha**i;
polynomial form -> index form index_of[j=alpha**i] = i alpha=2 is the primitive element of GF(2**mm).
-
static void _gen_poly_(void)
This private function compute the generator polynomial.
Obtain the generator polynomial of the tt-error correcting, length nn=(2**mm -1) Reed Solomon code from the product of (X+alpha**i), i=1..2*tt
-
mm
Define the symboles bits number.
-
nn
Define the total message size (with parity word)
-
tt
Define the number of error that can be corrected.
-
kk
Define the useable message size.
-
RS_MESSAGE_SZ
Define an alias to kk.
-
RS_PARITY_SZ
Define the parity word size.
Parameters
-
enum param_access_e
This enum defines the parameter access type.
Values:
-
enumerator NA
No Access.
-
enumerator RO
Read only.
-
enumerator WO
Write only.
-
enumerator RW
Read/Write.
-
enumerator NA
-
enum param_effective_e
This enum defines the parameter update effectiveness.
Values:
-
enumerator IMM
Immediate.
-
enumerator ACK
After the write request acknowledge.
-
enumerator MNT
At the next maintenance period.
-
enumerator HGA
At the next Gas Hour.
-
enumerator UTC
At the next 0h00 UTC.
-
enumerator IMM
-
enum param_ref_e
This enum defines if the parameter is saved or not into the referential.
Values:
-
enumerator REF_N
Not saved into the referential.
-
enumerator REF_Y
Saved into the referential.
-
enumerator REF_N
-
enum restr_type_e
This enum defines the parameter restriction type.
Values:
-
enumerator RESTR_MODULO
Restriction on modulo.
-
enumerator RESTR_RANGE
Restriction on range.
-
enumerator RESTR_ENUM
Restriction on enum list.
-
enumerator RESTR_MODULO
-
enum restr_sz_type_e
This enum defines the size on which restriction is applied.
Values:
-
enumerator RESTR_8BITS
Restriction values are on 8 bits.
-
enumerator RESTR_16BITS
Restriction values are on 16 bits.
-
enumerator RESTR_32BITS
Restriction values are on 32 bits.
-
enumerator RESTR_64BITS
Restriction values are on 64 bits.
-
enumerator RESTR_8BITS
-
enum param_lan_ids_e
This enum defines the lan parameter ids.
Values:
-
enumerator VERS_HW_TRX
Hardware version number of the device (or transceiver for a remote module)
-
enumerator VERS_FW_TRX
Software version number run by the device (or transceiver for a remote module)
-
enumerator DATEHOUR_LAST_UPDATE
Date/time of the last successful firmware download.
-
enumerator L6App
Version of the application layer.
-
enumerator RF_UPLINK_CHANNEL
Frequency channel to be used for all uplink message transmissions.
-
enumerator RF_DOWNLINK_CHANNEL
Frequency channel to be used for all message receptions (except firmware download)
-
enumerator RF_UPLINK_MOD
Modulation to be used for all uplink message transmissions.
-
enumerator RF_DOWNLINK_MOD
Modulation to be used for all message receptions (except firmware download)
-
enumerator TX_POWER
Transceiver nominal transmission power.
-
enumerator TX_DELAY_FULLPOWER
Maximum time between two COMMAND messages before the device automatically returns to maximum transmission power.
-
enumerator TX_FREQ_OFFSET
Absolute transmission correction frequency of.
-
enumerator EXCH_RX_DELAY
Fixed wait time after transmission of a DATA message by the device and before opening the COMMAND message listening window.
-
enumerator EXCH_RX_LENGTH
Duration of the COMMAND message listening window by the device.
-
enumerator EXCH_RESPONSE_DELAY
Time between reception of a COMMAND message by the device and transmission of the corresponding RESPONSE message.
-
enumerator EXCH_RESPONSE_DELAY_MIN
Minimum value accepted for the EXCH_RESPONSE_DELAY parameter (defined by the device MANUFACTURER)
-
enumerator L7TRANSMIT_LENGTH_MAX
Maximum length of application messages that can be sent by the device.
-
enumerator L7RECEIVE_LENGTH_MAX
Maximum length of application messages that can be received by the device.
-
enumerator CLOCK_CURRENT_EPOC
Current time of device.
-
enumerator CLOCK_OFFSET_CORRECTION
Relative correction (time delta) to be applied to the device clock once only to correct its absolute drift.
-
enumerator CLOCK_DRIFT_CORRECTION
Correction of device clock frequency.
-
enumerator CIPH_CURRENT_KEY
Current key number.
-
enumerator CIPH_KEY_COUNT
Number of encryption keys available in the device.
-
enumerator L6NetwIdSelect
Kmac key index.
-
enumerator PING_RX_DELAY
Fixed waiting time after transmission of an INSTPING message by the device and before opening the INSTPONG message listening window.
-
enumerator PING_RX_LENGTH
Duration of the INSTPONG message listening window by the device.
-
enumerator PING_RX_DELAY_MIN
Minimum value of the PING_RX_DELAY parameter.
-
enumerator PING_RX_LENGTH_MAX
Maximum value of the PING_RX_LENGTH parameter.
-
enumerator PING_LAST_EPOCH
Execution time of the last connectivity test (INSTPING/INSTPONG)
-
enumerator PING_NBFOUND
Number of different INSTPONG messages received in response to the last connectivity test.
-
enumerator PING_REPLY1
Response 1 received for the last connectivity test (Bigest L7RssiDown)
-
enumerator PING_REPLY2
Response 2 received for the last connectivity test.
-
enumerator PING_REPLY3
Response 3 received for the last connectivity test.
-
enumerator PING_REPLY4
Response 4 received for the last connectivity test.
-
enumerator PING_REPLY5
Response 5 received for the last connectivity test.
-
enumerator PING_REPLY6
Response 6 received for the last connectivity test.
-
enumerator PING_REPLY7
Response 7 received for the last connectivity test.
-
enumerator PING_REPLY8
Response 8 received for the last connectivity test (Weakess L7RssiDown)
-
enumerator EXECPING_PERIODE
Periodic time of execping sending by the device, in months.
-
enumerator LAST_ID
Don’t remove, it marks the end of table.
-
enumerator VERS_HW_TRX
- param_s
-
const uint16_t u16_ParamValueSz
This external variable hold the parameters table value size.
This external variable hold the parameters table value size.
-
uint8_t a_ParamValue[]
This external variable hold the parameters table value.
-
const uint8_t u8_ParamAccessCfgSz
This external variable hold the parameters access table size.
This external variable hold the parameters access table size.
-
const param_s a_ParamAccess[]
This external variable hold parameters access table.
-
const uint8_t u8_ParamRestrCfgSz
This external variable hold the parameters restriction table size.
This external variable hold the parameters restriction table size.
-
void Param_Init(const uint8_t *p_Param)
Init parameters by with default values.
- Parameters:
p_Param – [in] Pointer on input parameters table.
- Returns:
None
-
uint8_t Param_IsValidId(uint8_t u8_Id)
Check if Id is in acess table.
- Parameters:
u8_Id – [in] The parameter Id.
- Return values:
0 – : not valid
1 – : valid
-
uint8_t Param_GetSize(uint8_t u8_Id)
Get the parameter size.
- Parameters:
u8_Id – [in] The parameter Id.
- Returns:
The parameter size.
-
param_access_e Param_GetLocAccess(uint8_t u8_Id)
Get the local access rights field of the parameter.
- Parameters:
u8_Id – [in] The parameter Id.
- Returns:
The local access rights field.
-
param_access_e Param_GetRemAccess(uint8_t u8_Id)
Get the remote access rights field of the parameter.
- Parameters:
u8_Id – [in] The parameter Id.
- Returns:
The remote access rights field.
-
param_effective_e Param_GetEffect(uint8_t u8_Id)
Get the “effective” field of the parameter.
- Parameters:
u8_Id – [in] The parameter Id.
- Returns:
The “effective” field.
-
param_ref_e Param_GetReferenced(uint8_t u8_Id)
Get the “referenced” field of the parameter.
- Parameters:
u8_Id – [in] The parameter Id.
- Returns:
The “referenced” field.
-
uint32_t Param_GetAddOf(uint8_t u8_Id)
Get the memory address of the parameter.
- Parameters:
u8_Id – [in] The parameter Id.
- Returns:
The parameter address
-
uint8_t Param_GetRestrId(uint8_t u8_Id)
Get the restriction id of the parameter.
- Parameters:
u8_Id – [in] The parameter Id.
- Returns:
The restriction id field.
-
const void *Param_GetRestrTableAdd(uint8_t u8_Id)
Get the restriction table address of the parameter.
- Parameters:
u8_Id – [in] The parameter Id.
- Returns:
The restriction table address.
-
uint8_t Param_CheckConformity(uint8_t u8_Id, uint8_t *p_Data)
Check that given value conform to its restriction definition.
- Parameters:
u8_Id – [in] id of the parameter to check
*p_Data – [in] point on the data to check
- Return values:
0 – : not conform
1 – : conform
-
uint8_t Param_Access(uint8_t u8_Id, uint8_t *p_Data, uint8_t u8_Dir)
Pseudo-Direct access to the parameters table.
- Parameters:
u8_Id – [in] The parameter Id.
p_Data – [inout] Pointer on source or destination data.
u8_Dir – [in] The access direction (0:read; 1:write).
- Return values:
0 – Error
1 – success
-
uint8_t Param_LocalAccess(uint8_t u8_Id, uint8_t *p_Data, uint8_t u8_Dir)
Local access to the parameters table.
- Parameters:
u8_Id – [in] The parameter Id.
p_Data – [inout] Pointer on source or destination data.
u8_Dir – [in] The access direction (0:read; 1:write).
- Return values:
0 – access is forbidden
1 – access granted
-
uint8_t Param_RemoteAccess(uint8_t u8_Id, uint8_t *p_Data, uint8_t u8_Dir)
Remote access to the parameters table.
- Parameters:
u8_Id – [in] The parameter Id.
p_Data – [inout] Pointer on source or destination data.
u8_Dir – [in] The access direction (0:read; 1:write).
- Return values:
0 – access is forbidden; 1: access granted
- struct __attribute__ ((__packed__))
This structure defines the parameter properties.
-
static uint8_t _param_access_(uint8_t u8_Id, uint8_t *p_Data, uint8_t u8_Dir, uint8_t u8_Access)
This private function deal with access to parameter table.
- Parameters:
u8_Id – [in] The parameter Id.
p_Data – [inout] Pointer on source or destination data.
u8_Dir – [in] The access direction (0:read; 1:write).
u8_Access – [in] The access rights.
- Return values:
0 – Error
1 – Success
-
static restr_s *_get_restr_add_(uint8_t u8_Id)
Get the restriction table address of the parameter.
- Parameters:
u8_Id – [in] The parameter Id.
- Returns:
The restriction table address.
-
static uint8_t _check_conform_modulo_(restr_s *p_Restr, uint8_t *p_Data)
Check that given value conform to the modulo value.
- Parameters:
*p_Restr – [in] point on the restriction table
*p_Data – [in] point on the data to check
- Return values:
0 – : not conform
1 – : conform
-
static uint8_t _check_conform_enum_(restr_s *p_Restr, uint8_t *p_Data)
Check that given value conform to one of the enum value.
- Parameters:
*p_Restr – [in] point on the restriction table
*p_Data – [in] point on the data to check
- Return values:
0 – : not conform
1 – : conform
-
static uint8_t _check_conform_range_(restr_s *p_Restr, uint8_t *p_Data)
Check that given value conform to the range value.
- Parameters:
*p_Restr – [in] point on the restriction table
*p_Data – [in] point on the data to check
- Return values:
0 – : not conform
1 – : conform
-
struct restr_s
- #include <parameters_def.h>
This structure defines the parameter restriction table.
Event
-
enum time_evt_cfg_e
This enum define the timer configuration type.
Values:
-
enumerator TIMEEVT_CFG_ONESHOT
One-shot relative timer.
-
enumerator TIMEEVT_CFG_PERIODIC
Periodic relative timer.
-
enumerator TIMEEVT_CFG_ABSOLUTE
One-shot absolute timer.
-
enumerator TIMEEVT_CFG_ONESHOT
-
typedef struct time_evt_s time_evt_t
This struct defines the timer type.
-
typedef void (*pfTimeEvt_HandlerCB_t)(void)
This defines the interrupt call back for the TimeEvt.
-
struct time_evt_ctx_s sTimeEvtCtx
This define the TimeEvt context instance.
-
uint8_t TimeEvt_TimerInit(time_evt_t *pTimeEvt, void (*pvTaskHandle)(uint32_t evt), time_evt_cfg_e eCfg)
Initialize the given timer.
- Parameters:
pTimeEvt – [in] Pointer a Timer to initialize
pvTaskHandle – [in] Task handler to notify
eCfg – [in] The timer configuration
- Return values:
0 – Success
1 – Failed (given is/are null)
-
uint8_t TimeEvt_TimerStart(time_evt_t *pTimeEvt, uint32_t u32Value, int16_t i16DeltaMs, uint32_t u32Event)
Start the given timer.
- Parameters:
pTimeEvt – [in] Pointer a Timer to start (insert)
u32Value – [in] The Timer value in second
i16DeltaMs – [in] The Delta timer value in millisecond
u32Event – [in] Event to notify on timer expire
- Return values:
0 – Success
1 – Failed (the given time value is passed or negative)
-
void TimeEvt_TimerStop(time_evt_t *pTimeEvt)
Stop the given timer.
- Parameters:
pTimeEvt – [in] Pointer a Timer to stop (remove)
- Returns:
None
-
void TimeEvt_Setup(void)
Initialize the TimeEvt Context.
- Returns:
None
-
void TimeEvt_Init(void)
Initialize the TimeEvt module.
- Returns:
None
-
void TimeEvt_UpdateTime(time_t t)
This function update time and internal structure.
- Parameters:
t – [in] The new time value to update
- Returns:
None
-
void TimeEvt_EventHandler(void)
Callback handler on alarm interrupt.
- Returns:
None
-
static void _reset(struct time_evt_ctx_s *pCtx)
Reset the TimeEvt context.
- Parameters:
pCtx – [in] Pointer a TimeEvt context
- Returns:
None
-
static void *_current(struct time_evt_ctx_s *pCtx)
Get the pointer on the current timer.
- Parameters:
pCtx – [in] Pointer a TimeEvt context
- Returns:
the pointer on the current timer
-
static void _update(struct time_evt_ctx_s *pCtx, uint64_t u64Now)
Update the TimeEvt.
- Parameters:
pCtx – [in] Pointer a TimeEvt context
u64Now – [in] Current time to update with
- Returns:
None
-
static void _insert(struct time_evt_ctx_s *pCtx, struct time_evt_s *pNew)
Insert a Timer from the TimeEvt.
- Parameters:
pCtx – [in] Pointer a TimeEvt context
pNew – [in] Pointer on Timer to insert
- Returns:
None
-
static void _remove(struct time_evt_ctx_s *pCtx, struct time_evt_s *pDel)
Remove a Timer from the TimeEvt.
- Parameters:
pCtx – [in] Pointer a TimeEvt context
pDel – [in] Pointer on Timer to remove
- Returns:
None
-
TIME_EVT_ALARM_ID
This macro define the used alarm id.
-
struct time_evt_s
- #include <time_evt.h>
This struct define the timer context.
-
struct time_evt_ctx_s
This struct define the TimeEvt context.
Image Storage
-
enum img_pend_e
This enum define pending image entry.
Values:
-
enumerator PENDING_SETUP
-
enumerator PENDING_NONE
-
enumerator PENDING_LOCAL
-
enumerator PENDING_REMOTE
-
enumerator PENDING_SETUP
-
typedef uint8_t (*pfWriteFlash_t)(uint32_t u32Addr, uint64_t *pData, uint32_t u32NbDoubleWord)
-
typedef uint8_t (*pfEraseFlash_t)(uint32_t u32Addr, uint32_t u32Size)
-
typedef struct img_mgr_ctx_s img_mgr_ctx_t
This struct defines the image context type.
- struct sw_pend_ctrl_s __attribute__
-
struct img_mgr_ctx_s sImgMgrCtx
-
void ImgStore_StoreBlock(uint16_t u16_BlkId, uint8_t *p_Blk)
Save the given software block and set its corresponding bit “on” into the bitmap.
- Parameters:
u16_BlkId – [in] The Id of the given block.
*p_Blk – [in] Pointer on the software block.
-
uint8_t ImgStore_IsComplete(void)
Check if the given software image is complete.
- Return values:
0 – Not complete
1 – Complete
-
uint8_t ImgStore_Verify(uint8_t *pImgHash, uint8_t u8DigestSz)
Verify the sw image integrity (sha256).
- Parameters:
pImgHash – [in] Pointer on expected image sha256
u8DigestSz – [in] Size of expected image sha256
- Return values:
0 – Success
1 – Failed
-
uint8_t ImgStore_GetBitmapLine(uint16_t u16_Id)
Get the line value (from bitmap) of the given block Id.
- Parameters:
u16_Id – [in] The Id of the block.
- Return values:
The – 8 bits bitmap line
-
uint16_t ImgStore_GetMaxBlockNb(void)
Get the maximum admissible block number.
- Return values:
The – maximum block number
-
inline img_pend_e ImgStore_GetPending(void)
Get the pending flag.
- Return values:
return – img_pend_e::PENDING_SETUP return img_pend_e::PENDING_NONE return img_pend_e::PENDING_LOCAL return img_pend_e::PENDING_REMOTE
-
inline void ImgStore_SetPending(img_pend_e ePend)
Set the pending flag.
- Parameters:
ePend – [in] The pending flag to set
- Return values:
None –
-
int8_t ImgStore_Init(uint16_t u16NbExpectedBlk)
Initialize the image manager context.
- Parameters:
u16NbExpectedBlk – [in] The number block for expected new sw image
- Return values:
0 – Success
1 – Failed (at least one of given parameters is out of range)
-1 – Fatal (unable to erase the flash memory area)
-
int8_t ImgStore_Setup(uint32_t u32ImgAdd, pfWriteFlash_t pfWrite, pfEraseFlash_t pfErase)
Initialize the image manager context.
- Parameters:
u32ImgAdd – [in] Software Image address (64 bits aligned)
pfWrite – [in] Function pointer on write sub function
pfErase – [in] Function pointer on erase sub function
- Return values:
0 – Success
1 – Failed (at least one of given parameters is out of range)
- struct sw_pend_buff_s __attribute__ ((aligned(8)))
-
uint8_t _get_bitmap_line(struct img_mgr_ctx_s *pCtx, uint16_t u16_Id)
Get the line value (from bitmap) of the given block Id.
- Parameters:
pCtx – [in] Pointer on image manager context
u16_Id – [in] The Id of the block.
- Returns:
the line value.
-
uint8_t _get_bitmap_bit(struct img_mgr_ctx_s *pCtx, uint16_t u16_Id)
Get the bit value (from bitmap) of the given block Id.
- Parameters:
pCtx – [in] Pointer on image manager context
u16_Id – [in] The Id of the block.
- Return values:
0 – this block is not yet present.
1 – this block is already present.
-
void _set_bitmap(struct img_mgr_ctx_s *pCtx, uint16_t u16_Id)
Set “on” the bit corresponding to the given block Id into the bitmap.
- Parameters:
pCtx – [in] Pointer on image manager context
u16_Id – [in] The Id of block to set “on”.
-
void _clr_bitmap(struct img_mgr_ctx_s *pCtx)
Clear the entire bitmap.
- Parameters:
pCtx – [in] Pointer on image manager context
-
void _clr_pending(struct img_mgr_ctx_s *pCtx)
Clear the pending table.
- Parameters:
pCtx – [in] Pointer on image manager context
-
struct sw_pend_buff_s
- #include <img_storage_private.h>
This structure hold a pending entry.
-
struct sw_pend_ctrl_s
- #include <img_storage_private.h>
This structure hold a pending entry control.
-
struct img_mgr_ctx_s
- #include <img_storage_private.h>
This structure hold a image manager context.
Logger
-
enum logger_level_e
This enum define the logger output level
Values:
-
enumerator LOG_LV_QUIET
Quite, no log is output.
-
enumerator LOG_LV_ERR
Error log is output.
-
enumerator LOG_LV_WRN
Warning log is output.
-
enumerator LOG_LV_INF
Info log is output.
-
enumerator LOG_LV_DBG
Debug log is output.
-
enumerator LOG_LV_FRM_IN
Frame in log is output.
-
enumerator LOG_LV_FRM_OUT
Frame out log is output.
-
enumerator LOG_LV_QUIET
-
enum logger_tstamp_e
This enum define the Timestamp added to the log output
Values:
-
enumerator LOG_TSTAMP_NONE
No Timestamp.
-
enumerator LOG_TSTAMP_NORM
Add Timestamp (epoch) to the log output.
-
enumerator LOG_TSTAMP_HIRES
Add Timestamp (epoch) plus millisecond to the log output.
-
enumerator LOG_TSTAMP_TRUNC
Truncate Timestamp on 5 digits.
-
enumerator LOG_TSTAMP_NONE
-
uint8_t gLoggerLevel
This global variable define the output logger level.
-
uint8_t gLoggerLevel = LOG_LV_QUIET
This global variable define the output logger level.
-
static struct logger_ctx_s sLoggerCtx
-
void Logger_Setup(int32_t (*pfOut)(const char*, FILE*), FILE *pFile)
This function initialize the Logger module.
- Returns:
None
-
inline void Logger_SetLevel(uint8_t u8LogLevel, uint8_t u8Tstmp)
This function setup the Logger module.
- Parameters:
u8LogLevel – [in] Logger level (ORed logger_level_e values)
u8Tstmp – [in] Type of time-stamp to use
- Returns:
None
-
void Logger_Put(char *str, uint32_t u32Nb)
This function “put” a raw string to the logger.
- Parameters:
str – [in] Raw string
u32Nb – [in] The number of char to logout
- Returns:
None
-
void Logger_Post(uint8_t level, char *format, ...)
This function “post” a formated string to the logger.
- Parameters:
level – [in] Level of verbosity
format – [in] Formated string
... – [in] va_args List of variable to log
- Returns:
None
-
void Logger_Frame(char *pStr, uint8_t *pData, uint8_t u8NbData)
This function log a frame as formated string of bytes array.
- Parameters:
pStr – [in] Formated string
pData – [in] Frame data to log
u8NbData – [in] Number of byte to log
- Returns:
None
-
static int32_t _logger_add_timestamp_(int32_t id)
Internal function to add timestamp.
- Parameters:
id – [in] The buffer id on which to add the timestamp
- Returns:
The number of written bytes
-
static int32_t _logger_acquire_id_()
Internal function to acquire an available buffer id.
- Returns:
The buffer id
-
static void _logger_release_id_(int32_t id)
Internal function to release a buffer id.
- Parameters:
id – [in] The buffer id to release
- Returns:
None
-
static void _logger_main_(void const *argument)
This is the main task function.
- Parameters:
argument – [in] (not used)
- Returns:
None
-
Logger_Setup(...)
-
Logger_SetLevel(...)
-
Logger_Put(...)
-
Logger_Post(...)
-
Logger_Frame(...)
-
LOG_MSG(level, fmt, ...)
-
LOG_ERR(fmt, ...)
-
LOG_WRN(fmt, ...)
-
LOG_INF(fmt, ...)
-
LOG_DBG(fmt, ...)
-
LOG_FRM_OUT(pFrm, nb_data)
-
LOG_FRM_IN(pFrm, nb_data)
-
struct logger_ctx_s
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
-
enumerator WIZE_API_SUCCESS
-
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_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
-
enumerator SES_MGR_EVT_MSK
-
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
-
enumerator SES_MGR_FLG_NONE
-
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
-
enumerator GLO_FLG_NONE
-
enum ses_disp_state_e
This enumeration define.
Values:
-
enumerator SES_DISP_STATE_DISABLE
-
enumerator SES_DISP_STATE_ENABLE
-
enumerator SES_DISP_STATE_DISABLE
-
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
-
enumerator SES_ADM_CMD_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
-
enumerator SES_LOG_NONE
-
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
-
enumerator SES_STATE_DISABLE
-
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
-
enumerator SES_FLG_NONE
-
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
-
enumerator SES_EVT_NET_MGR_MSK
-
enum ses_type_t
Values:
-
enumerator SES_INST
-
enumerator SES_ADM
-
enumerator SES_DWN
-
enumerator SES_NB
-
enumerator SES_NONE
-
enumerator SES_INST
- 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
-
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
-
uint32_t SES_FLG
-
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:
SES_FLG_NONE – (see ses_flag_e::SES_FLG_NONE)
SES_FLG_ERROR – (see ses_flag_e::SES_FLG_ERROR)
SES_FLG_PING_SENT – (see ses_flag_e::SES_FLG_PING_SENT)
SES_FLG_PONG_RECV – (see ses_flag_e::SES_FLG_PONG_RECV)
SES_FLG_COMPLETE – (see ses_flag_e::SES_FLG_COMPLETE)
SES_FLG_FRM_PASSED – (see ses_flag_e::SES_FLG_FRM_PASSED)
SES_FLG_TIMEOUT – (see ses_flag_e::SES_FLG_TIMEOUT)
-
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:
SES_FLG_NONE – (see ses_flag_e::SES_FLG_NONE)
SES_FLG_ERROR – (see ses_flag_e::SES_FLG_ERROR)
SES_FLG_COMPLETE – (see ses_flag_e::SES_FLG_COMPLETE)
SES_FLG_BLK_RECV – (see ses_flag_e::SES_FLG_BLK_RECV)
SES_FLG_FRM_PASSED – (see ses_flag_e::SES_FLG_FRM_PASSED)
SES_FLG_TIMEOUT – (see ses_flag_e::SES_FLG_TIMEOUT)
-
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
-
enumerator NET_EVENT_NONE
-
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
-
enumerator NET_STATUS_OK
-
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
-
enumerator NET_LISTEN_TYPE_ONE
-
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:
NET_STATUS_OK – (see net_status_e::NET_STATUS_OK)
NET_STATUS_ERROR – (see net_status_e::NET_STATUS_ERROR)
NET_STATUS_BUSY – (see net_status_e::NET_STATUS_BUSY)
-
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:
NET_STATUS_OK – (see net_status_e::NET_STATUS_OK)
NET_STATUS_ERROR – (see net_status_e::NET_STATUS_ERROR)
NET_STATUS_BUSY – (see net_status_e::NET_STATUS_BUSY)
-
int32_t NetMgr_Close(void)
This function release the device.
- Return values:
NET_STATUS_OK – (see net_status_e::NET_STATUS_OK)
NET_STATUS_BUSY – (see net_status_e::NET_STATUS_BUSY)
-
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:
NET_STATUS_OK – (see net_status_e::NET_STATUS_OK)
NET_STATUS_ERROR – (see net_status_e::NET_STATUS_ERROR)
NET_STATUS_BUSY – (see net_status_e::NET_STATUS_BUSY)
-
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:
NET_STATUS_OK – (see net_status_e::NET_STATUS_OK)
NET_STATUS_ERROR – (see net_status_e::NET_STATUS_ERROR)
NET_STATUS_BUSY – (see net_status_e::NET_STATUS_BUSY)
-
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:
NET_STATUS_OK – (see net_status_e::NET_STATUS_OK)
NET_STATUS_ERROR – (see net_status_e::NET_STATUS_ERROR)
NET_STATUS_BUSY – (see net_status_e::NET_STATUS_BUSY)
-
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:
NET_STATUS_OK – (see net_status_e::NET_STATUS_OK)
NET_STATUS_ERROR – (see net_status_e::NET_STATUS_ERROR)
NET_STATUS_BUSY – (see net_status_e::NET_STATUS_BUSY)
-
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:
NET_STATUS_OK – (see net_status_e::NET_STATUS_OK)
NET_STATUS_ERROR – (see net_status_e::NET_STATUS_ERROR)
NET_STATUS_BUSY – (see net_status_e::NET_STATUS_BUSY)
-
int32_t NetMgr_ListenReady(void)
This function notify that previous listened net_msg_t buffer is no more pending.
- Return values:
NET_STATUS_OK – (see net_status_e::NET_STATUS_OK)
NET_STATUS_BUSY – (see net_status_e::NET_STATUS_BUSY)
-
int32_t NetMgr_Uninit(void)
This function de-initialize the NetMgr module.
- Return values:
NET_STATUS_OK – (see net_status_e::NET_STATUS_OK)
NET_STATUS_ERROR – (see net_status_e::NET_STATUS_ERROR)
NET_STATUS_BUSY – (see net_status_e::NET_STATUS_BUSY)
-
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:
NET_EVENT_SUCCESS – (see net_event_e::NET_EVENT_SUCCESS)
NET_EVENT_ERROR – (see net_event_e::NET_EVENT_ERROR)
NET_EVENT_SEND_DONE – (see net_event_e::NET_EVENT_SEND_DONE)
NET_EVENT_RECV_DONE – (see net_event_e::NET_EVENT_RECV_DONE)
NET_EVENT_FRM_PASSED – (see net_event_e::NET_EVENT_FRM_PASSED)
NET_EVENT_TIMEOUT – (see net_event_e::NET_EVENT_TIMEOUT)
-
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:
NET_STATUS_OK – (see net_status_e::NET_STATUS_OK)
NET_STATUS_ERROR – (see net_status_e::NET_STATUS_ERROR)
NET_STATUS_BUSY – (see net_status_e::NET_STATUS_BUSY)
-
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:
NET_STATUS_OK – (see net_status_e::NET_STATUS_OK)
NET_STATUS_ERROR – (see net_status_e::NET_STATUS_ERROR)
NET_STATUS_BUSY – (see net_status_e::NET_STATUS_BUSY)
-
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:
-
enumerator NETDEV_CTL_SET_UPLINK_CH
Set the up-link channel
-
enumerator NETDEV_CTL_SET_UPLINK_MOD
Set the up-link modulation
-
enumerator NETDEV_CTL_SET_DWLINK_CH
Set the down-link channel
-
enumerator NETDEV_CTL_SET_DWLINK_MOD
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
-
enumerator NETDEV_CTL_SET_UPLINK_CH
-
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
-
enumerator NETDEV_EVT_NONE
-
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
-
enumerator NETDEV_STATUS_OK
-
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
-
enumerator NETDEV_ERROR_NONE
-
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
-
enumerator NETDEV_STATE_UNKWON
-
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:
NETDEV_STATUS_OK – (see netdev_status_e::NETDEV_STATUS_OK)
NETDEV_STATUS_ERROR – (see netdev_status_e::NETDEV_STATUS_ERROR)
NETDEV_STATUS_BUSY – (see netdev_status_e::NETDEV_STATUS_BUSY)
-
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:
NETDEV_STATUS_OK – (see netdev_status_e::NETDEV_STATUS_OK)
NETDEV_STATUS_ERROR – (see netdev_status_e::NETDEV_STATUS_ERROR)
NETDEV_STATUS_BUSY – (see netdev_status_e::NETDEV_STATUS_BUSY)
-
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:
NETDEV_STATUS_OK – (see netdev_status_e::NETDEV_STATUS_OK)
NETDEV_STATUS_ERROR – (see netdev_status_e::NETDEV_STATUS_ERROR)
NETDEV_STATUS_BUSY – (see netdev_status_e::NETDEV_STATUS_BUSY)
-
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:
NETDEV_STATUS_OK – (see netdev_status_e::NETDEV_STATUS_OK)
NETDEV_STATUS_ERROR – (see netdev_status_e::NETDEV_STATUS_ERROR)
NETDEV_STATUS_BUSY – (see netdev_status_e::NETDEV_STATUS_BUSY)
-
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:
NETDEV_STATUS_OK – (see netdev_status_e::NETDEV_STATUS_OK)
NETDEV_STATUS_ERROR – (see netdev_status_e::NETDEV_STATUS_ERROR)
NETDEV_STATUS_BUSY – (see netdev_status_e::NETDEV_STATUS_BUSY)
-
int32_t WizeNet_Listen(netdev_t *pNetdev)
This function open a listen window.
- Parameters:
pNetdev – [in] Pointer on netdev_t device
- Return values:
NETDEV_STATUS_OK – (see netdev_status_e::NETDEV_STATUS_OK)
NETDEV_STATUS_ERROR – (see netdev_status_e::NETDEV_STATUS_ERROR)
NETDEV_STATUS_BUSY – (see netdev_status_e::NETDEV_STATUS_BUSY)
-
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:
NETDEV_STATUS_OK – (see netdev_status_e::NETDEV_STATUS_OK)
NETDEV_STATUS_ERROR – (see netdev_status_e::NETDEV_STATUS_ERROR)
NETDEV_STATUS_BUSY – (see netdev_status_e::NETDEV_STATUS_BUSY)
-
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:
NETDEV_STATUS_OK – (see netdev_status_e::NETDEV_STATUS_OK))
NETDEV_STATUS_ERROR – (see netdev_status_e::NETDEV_STATUS_ERROR)
NETDEV_STATUS_BUSY – (see netdev_status_e::NETDEV_STATUS_BUSY)
-
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]
-
uint8_t aDevInfo[8]
-
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
-
enumerator PHY_STATUS_OK
-
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_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_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
-
enumerator PHY_CTL_SET_TX_FREQ_OFF
-
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
-
enumerator PHY_TST_MODE_NONE
-
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
-
enumerator PHYDEV_EVT_NONE
-
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
-
enumerator PHY_CH100
-
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
-
enumerator PHY_WM2400
-
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
-
enumerator PHY_PMAX_minus_0db
-
typedef void (*phydev_evt_cb_t)(void *pCbParam, uint32_t eEvt)
PHY device event call-back.
-
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
-
enumerator APP_INSTALL
-
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
-
enumerator PROTO_SUCCESS
-
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
-
enumerator INSTPONG
-
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.
-
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:
PROTO_SUCCESS – (see ret_code_e::PROTO_SUCCESS)
PROTO_FRAME_SZ_ERR – (see ret_code_e::PROTO_FRAME_SZ_ERR)
PROTO_APP_MSG_SZ_ERR – (see ret_code_e::PROTO_APP_MSG_SZ_ERR)
PROTO_STACK_MISMATCH_ERR – (see ret_code_e::PROTO_STACK_MISMATCH_ERR)
PROTO_INTERNAL_CIPH_ERR – (see ret_code_e::PROTO_INTERNAL_CIPH_ERR)
PROTO_INTERNAL_HASH_ERR – (see ret_code_e::PROTO_INTERNAL_HASH_ERR)
PROTO_INTERNAL_CRC_ERR – (see ret_code_e::PROTO_INTERNAL_CRC_ERR)
-
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:
PROTO_SUCCESS – (see ret_code_e::PROTO_SUCCESS)
PROTO_FRAME_RS_ERR – (see ret_code_e::PROTO_FRAME_RS_ERR)
PROTO_DW_BLK_PASS_INF – (see ret_code_e::PROTO_DW_BLK_PASS_INF)
PROTO_DOWNLOAD_VER_WRN – (see ret_code_e::PROTO_DOWNLOAD_VER_WRN)
PROTO_FRAME_CRC_ERR – (see ret_code_e::PROTO_FRAME_CRC_ERR)
PROTO_HEAD_END_AUTH_ERR – (see ret_code_e::PROTO_HEAD_END_AUTH_ERR)
PROTO_GATEWAY_AUTH_WRN – (see ret_code_e::PROTO_GATEWAY_AUTH_WRN)
PROTO_PROTO_UNK_ERR – (see ret_code_e::PROTO_PROTO_UNK_ERR)
PROTO_KEYID_UNK_ERR – (see ret_code_e::PROTO_KEYID_UNK_ERR)
PROTO_NETWID_UNK_ERR – (see ret_code_e::PROTO_NETWID_UNK_ERR)
PROTO_FRAME_PASS_INF – (see ret_code_e::PROTO_FRAME_PASS_INF)
PROTO_FRAME_UNK_ERR – (see ret_code_e::PROTO_FRAME_UNK_ERR)
PROTO_FRAME_SZ_ERR – (see ret_code_e::PROTO_FRAME_SZ_ERR)
PROTO_APP_MSG_SZ_ERR – (see ret_code_e::PROTO_APP_MSG_SZ_ERR)
PROTO_STACK_MISMATCH_ERR – (see ret_code_e::PROTO_STACK_MISMATCH_ERR)
PROTO_INTERNAL_CRC_ERR – (see ret_code_e::PROTO_INTERNAL_CRC_ERR)
PROTO_INTERNAL_HASH_ERR – (see ret_code_e::PROTO_INTERNAL_HASH_ERR)
PROTO_INTERNAL_CIPH_ERR – (see ret_code_e::PROTO_INTERNAL_CIPH_ERR)
-
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:
PROTO_SUCCESS – (see ret_code_e::PROTO_SUCCESS)
PROTO_FRAME_RS_ERR – (see ret_code_e::PROTO_FRAME_RS_ERR)
PROTO_FRAME_CRC_ERR – (see ret_code_e::PROTO_FRAME_CRC_ERR)
PROTO_HEAD_END_AUTH_ERR – (see ret_code_e::PROTO_HEAD_END_AUTH_ERR)
PROTO_FRAME_PASS_INF – (see ret_code_e::PROTO_FRAME_PASS_INF)
PROTO_DW_BLK_PASS_INF – (see ret_code_e::PROTO_DW_BLK_PASS_INF)
PROTO_DOWNLOAD_VER_WRN – (see ret_code_e::PROTO_DOWNLOAD_VER_WRN)
PROTO_INTERNAL_CRC_ERR – (see ret_code_e::PROTO_INTERNAL_CRC_ERR)
PROTO_INTERNAL_HASH_ERR – (see ret_code_e::PROTO_INTERNAL_HASH_ERR)
PROTO_INTERNAL_CIPH_ERR – (see ret_code_e::PROTO_INTERNAL_CIPH_ERR)
-
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:
PROTO_SUCCESS – (see ret_code_e::PROTO_SUCCESS)
PROTO_FRAME_CRC_ERR – (see ret_code_e::PROTO_FRAME_CRC_ERR)
PROTO_HEAD_END_AUTH_ERR – (see ret_code_e::PROTO_HEAD_END_AUTH_ERR)
PROTO_GATEWAY_AUTH_WRN – (see ret_code_e::PROTO_GATEWAY_AUTH_WRN)
PROTO_PROTO_UNK_ERR – (see ret_code_e::PROTO_PROTO_UNK_ERR)
PROTO_KEYID_UNK_ERR – (see ret_code_e::PROTO_KEYID_UNK_ERR)
PROTO_NETWID_UNK_ERR – (see ret_code_e::PROTO_NETWID_UNK_ERR)
PROTO_FRAME_PASS_INF – (see ret_code_e::PROTO_FRAME_PASS_INF)
PROTO_FRAME_UNK_ERR – (see ret_code_e::PROTO_FRAME_UNK_ERR)
PROTO_APP_MSG_SZ_ERR – (see ret_code_e::PROTO_APP_MSG_SZ_ERR)
PROTO_STACK_MISMATCH_ERR – (see ret_code_e::PROTO_STACK_MISMATCH_ERR)
PROTO_INTERNAL_CRC_ERR – (see ret_code_e::PROTO_INTERNAL_CRC_ERR)
PROTO_INTERNAL_HASH_ERR – (see ret_code_e::PROTO_INTERNAL_HASH_ERR)
PROTO_INTERNAL_CIPH_ERR – (see ret_code_e::PROTO_INTERNAL_CIPH_ERR)
-
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:
PROTO_SUCCESS – (see ret_code_e::PROTO_SUCCESS)
PROTO_STACK_MISMATCH_ERR – (see ret_code_e::PROTO_STACK_MISMATCH_ERR)
PROTO_INTERNAL_CIPH_ERR – (see ret_code_e::PROTO_INTERNAL_CIPH_ERR)
PROTO_INTERNAL_HASH_ERR – (see ret_code_e::PROTO_INTERNAL_HASH_ERR)
PROTO_INTERNAL_CRC_ERR – (see ret_code_e::PROTO_INTERNAL_CRC_ERR)
-
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.
Demo (Nucleo L476RG)
Application
-
const uint8_t a_ParamDefault[]
This array define the parameter default value.
-
const uint16_t u16_ParamValueSz = PARAM_DEFAULT_SZ
The parameters values table size.
This external variable hold the parameters table value size.
-
const uint8_t u8_ParamAccessCfgSz = PARAM_ACCESS_CFG_SZ
The parameters access table size.
This external variable hold the parameters access table size.
-
const uint8_t u8_ParamRestrCfgSz = PARAM_RESTR_CFG_SZ
The restriction table size.
This external variable hold the parameters restriction table size.
- const key_s sDefaultKey [KEY_MAX_NB] ={[0] = {.key = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}},[KEY_ENC_MIN+1] = {.key = {0x55, 0x22, 0x19, 0xe2, 0x65, 0xeb, 0xb4, 0x8c,0x8a, 0xdf, 0x58, 0x71, 0x79, 0xd9, 0xc6, 0xb0,0x63, 0xd5, 0x7c, 0xa8, 0xd3, 0x7e, 0xd6, 0xcb,0x11, 0x51, 0xa7, 0x59, 0xcc, 0xad, 0xba, 0x40}},[KEY_MAC_ID] = {.key = {0x88, 0xe3, 0x35, 0x63, 0x8f, 0x52, 0x19, 0x46,0xc3, 0x8e, 0x32, 0xee, 0xba, 0xa3, 0xc9, 0x9f,0x4a, 0xe7, 0x0b, 0xfb, 0x2b, 0xb2, 0x53, 0x40,0x25, 0x04, 0x85, 0x76, 0xe3, 0x81, 0xfe, 0xad}}}
This define some hard-coded default keys.
-
void Storage_Init(uint8_t bForce)
-
void Storage_SetDefault(void)
Set to defaults device id, all parameters and all keys.
- Return values:
None –
-
void Sys_Init(void)
This function initialize the “system part”.
-
void Sys_Start(void)
-
void App_Init(void)
Called to initialize application before starting the scheduler.
-
void app_entry(void)
The application entry point.
- Return values:
None –
-
static void Main_Task(void const *argument)
This is the demo application task.
- PERM_SECTION (".param")
Table of parameters values.
This define hard-coded default device id
- KEY_SECTION (".data.keys")
Table of keys.
This initialize the storage area
- Parameters:
bForce – [in] Force to defaults.
- Return values:
None –
System
-
static fakeuart_device_t fakeuart_ctx
This is the context for the uart use as fake phy.
-
phydev_t sPhyDev
This store the phy device structure.
-
inline void _timer_set_handler(const uint8_t u8TimerId, pfTimeEvt_HandlerCB_t const pfCb)
Set the RTC Alarm callback handler.
- Parameters:
u8TimerId – [in] Alarm Id
pfCb – [in] Pointer on the callback function
-
inline void _timer_start(const uint8_t u8TimerId, uint64_t u64Value)
Start the RTC Alarm.
- Parameters:
u8TimerId – [in] Alarm Id
u64Value – [in] Time in millisecond until alarm occurs
-
inline void _timer_stop(const uint8_t u8TimerId)
Stop the RTC Alarm.
- Parameters:
u8TimerId – [in] Alarm Id
-
inline void _get_current_time_ms(uint64_t *u64MsTime)
Get the current epoch in millisecond.
- Parameters:
u64MsTime – [in] Pointer to hold epoch value
-
inline void _get_current_time(time_t *t)
Get the current epoch en second.
- Parameters:
t – [in] Pointer to hold epoch value
-
inline void _set_current_time(time_t t)
Set the current epoch in second.
- Parameters:
t – [in] Epoch value to set
-
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_update_set_handler(pfTimeEvt_HandlerCB_t const pfCb)
Set the time update callback handler.
- Parameters:
pfCb – [in] Pointer on the callback function
-
inline void _time_wakeup_force(void)
Force the RTC wake-up timer notify.
-
void Sys_Init(void)
This function initialize the “system part”.
-
void Sys_Fini(void)
This function finalize the “system part”.
- __attribute__ ((always_inline))
Start the RTOS scheduler.
Board Support Package
Common
-
enum dev_res_e
This enum define the common return code from devices.
Values:
-
enumerator DEV_SUCCESS
Generic success
-
enumerator DEV_FAILURE
Generic Failure
-
enumerator DEV_BUSY
Device is Busy
-
enumerator DEV_TIMEOUT
Device Timeout
-
enumerator DEV_INVALID_PARAM
Parameter is invalid
-
enumerator DEV_SUCCESS
-
boot_state_t gBootState
-
uint8_t ascii2hex(uint16_t u16Char)
Function convert a hexa represented as 2 bytes char into hexa value (1 byte).
- Parameters:
u16Char – [in] Two byte char to convert
- Returns:
converted one byte hex value
-
uint16_t hex2ascii(uint8_t u8Hex)
Function convert a hexa value (1 byte) into its 2 bytes char representation.
- Parameters:
u8Hex – [in] One byte hexa value to convert
- Returns:
converted two bytes char representation
-
void msleep(uint32_t milisecond)
Alias for HAL_Delay function.
- Parameters:
milisecond – [in] Number of milisecond to wait
-
void Error_Handler(void)
This function is executed in case of error occurrence.
- Return values:
None –
-
void BSP_Init(uint32_t u32BootState)
This function initialize the bsp.
- Parameters:
u32BootState – [in] The current boot state
- Returns:
None
Platform
-
enum uart_id_e
This enum define the UART device id.
Values:
-
enumerator UART_ID_CONSOLE
Concole id
-
enumerator UART_ID_COM
Communication Id
-
enumerator UART_ID_PHY
Phy id
-
enumerator UART_ID_MAX
-
enumerator UART_ID_CONSOLE
Boot
-
enum boot_reason_e
This enum define the reset (boot) reason as is in mcu reset register.
Values:
-
enumerator FW_RSTF
Firewall reset
-
enumerator OBL_RSTF
Option Byte reset
-
enumerator PIN_RSTF
Pin reset
-
enumerator BOR_RSTF
Power On Reset (power was lost or exit from Shutdown/Stdby LP)
-
enumerator SFT_RSTF
Software reset
-
enumerator IWWG_RSTF
Independent window watchdog reset
-
enumerator WWDG_RSTF
Window watchdog reset
-
enumerator LPWR_RSTF
Low power reset
-
enumerator FW_RSTF
-
void BSP_Boot_Reboot(uint8_t bReset)
Reboot.
- Parameters:
bReset – [in] Reset the backup domain (1 ;yes, 0: no)
- Returns:
None
-
uint32_t BSP_Boot_GetState(void)
Get the boot state.
- Returns:
the boot state as u32 (see boot_state_t)
-
union boot_state_t
- #include <bsp_boot.h>
This union hold the boot state.
Public Members
-
uint32_t state
Boot State
-
uint32_t reason
boot reason (see boot_reason_e)
-
uint32_t standby
wake-up from standby
-
uint32_t backup
backup-up domain has been cleared
-
uint32_t internal
wake-up from internal
-
uint32_t __pad0__
not used
-
uint32_t wkup_pin
wake-up from pin
-
uint32_t __pad1__
not used
-
uint32_t wkup_alra
wake-up from rtc alarm A
-
uint32_t wkup_alrb
wake-up from rtc alarm B
-
uint32_t wkup_timer
wake-up from rtc wake-up timer
-
uint32_t calendar
calendar configuration required
-
struct boot_state_t::[anonymous] [anonymous]
-
uint32_t state
Flash
-
dev_res_e BSP_Flash_Erase(uint32_t u32PageId)
Erase the given flash page area.
- Parameters:
u32PageId – Flash Page Id
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_FAILURE – if failed (see dev_res_e::DEV_FAILURE)
-
dev_res_e BSP_Flash_EraseArea(uint32_t u32Address, uint32_t u32NbBytes)
Erase the related flash memory area.
- Parameters:
u32Address – [in] Start address of area to erase
u32NbBytes – [in] Area size to erase
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_FAILURE – if failed (see dev_res_e::DEV_FAILURE)
-
dev_res_e BSP_Flash_Write(uint32_t u32Address, uint64_t *pData, uint32_t u32NbDword)
Write double-word aligned data.
- Parameters:
u32Address – Flash Address
pData – Pointer on data sto store
u32NbDword – The number of double-word of data to store
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_FAILURE – if failed (see dev_res_e::DEV_FAILURE)
-
uint32_t BSP_Flash_Store(uint32_t u32Address, void *pData, uint32_t u32NbBytes)
Store the given data into Flash memory.
Note
: If the number of byte to write is not double-word aligned, the rest is filled with padding (0xFF).
- Parameters:
u32Address – Flash Address
pData – Pointer on data to store
u32NbBytes – The number of byte of data to store
- Return values:
the – next 64 bits aligned flash address if everything is fine.
0xFFFFFFFF – if failed.
-
uint32_t BSP_Flash_GetPage(uint32_t u32Address)
Obtains the page id from the given address.
- Parameters:
u32Address – Flash Address
- Return values:
The – Flash page id
Gpio interrupt
-
enum gpio_irq_trg_cond_e
This enum define the GPIO trigger condition
Values:
-
enumerator GPIO_IRQ_NONE_EDGE
Trigger an interrupt on a none edge.
-
enumerator GPIO_IRQ_RISING_EDGE
Trigger an interrupt on a rising edge.
-
enumerator GPIO_IRQ_FALLING_EDGE
Trigger an interrupt on a falling edge.
-
enumerator GPIO_IRQ_EITHER_EDGE
Trigger an interrupt on either edge.
-
enumerator GPIO_IRQ_HIGH_LEVEL
Trigger an interrupt on a high level.
-
enumerator GPIO_IRQ_LOW_LEVEL
Trigger an interrupt on a low level.
-
enumerator GPIO_IRQ_EITHERLEVEL
Trigger an interrupt on a low level.
-
enumerator GPIO_IRQ_NONE_EDGE
-
enum gpio_port_e
This enum define GPIO port.
Values:
-
enumerator GPIO_PORTA
Port 000
-
enumerator GPIO_PORTB
Port 001
-
enumerator GPIO_PORTC
Port 010
-
enumerator GPIO_PORTD
Port 011
-
enumerator GPIO_PORTE
Port 100
-
enumerator GPIO_NUM_PORTS
maximum number of ports
-
enumerator GPIO_PORTA
-
int8_t BSP_GpioIt_GetLineId(const uint16_t u16Pin)
Get EXTI line id from gpio pin number.
- Parameters:
u16Pin – [in] Gpio pin number
- Returns:
the corresponding exti line
-
uint8_t BSP_GpioIt_ConfigLine(const uint32_t u32Port, const uint16_t u16Pin, const gpio_irq_trg_cond_e ePol)
Configure the gpio interruption.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
ePol – [in] Interrupt polarity
- Return values:
DEV_SUCCESS – if success (see dev_res_e::DEV_SUCCESS)
DEV_FAILURE – if fail (see dev_res_e::DEV_FAILURE)
-
uint8_t BSP_GpioIt_SetLine(const uint32_t u32Port, const uint16_t u16Pin, const bool bEnable)
Enable the gpio interruption.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
bEnable – [in] Enable/Disable interrupt
- Return values:
DEV_SUCCESS – if success (see dev_res_e::DEV_SUCCESS)
DEV_FAILURE – if fail (see dev_res_e::DEV_FAILURE)
-
uint8_t BSP_GpioIt_SetCallback(const uint32_t u32Port, const uint16_t u16Pin, pf_cb_t const pfCb, void *const pCbParam)
Set the gpio interruption callback.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
pfCb – [in] Pointer on the Callback function
pCbParam – [in] Pointer on the Callback parameter
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
-
uint8_t BSP_GpioIt_SetGpioCpy(const uint8_t u8ItLineId, const uint32_t u32Port, const uint16_t u16Pin)
Set/Enable the gpio as copy of interrupt of the given exti line.
- Parameters:
u8ItLineId – [in] EXTI line to copy
u32Port – [in] Gpio port on which to copy
u16Pin – [in] Gpio pin on which to copy
- Return values:
DEV_SUCCESS – if success (see dev_res_e::DEV_SUCCESS)
-
uint8_t BSP_GpioIt_ClrGpioCpy(const uint8_t u8ItLineId)
Clr/Disable the gpio as copy of interrupt of the given exti line.
- Parameters:
u8ItLineId – [in] EXTI line to disable the copy
- Return values:
DEV_SUCCESS – if success (see dev_res_e::DEV_SUCCESS)
-
void BSP_GpioIt_Handler(int8_t i8_ItLineId)
This is the gpio (exti) interrupt handler.
- Parameters:
i8_ItLineId – [in] The “interrupted” exti line
-
static uint32_t _bsp_gpioit_getport_(uint32_t u32Line)
Retrieve GPIO port address from exti line.
- Parameters:
u32Line – [in] EXTI line number
- Returns:
the gpio port address
-
static gpio_port_e _bsp_gpioit_getnumport_(const uint32_t u32Port)
Retrieve GPIO port number from port address.
- Parameters:
u32Port – [in] Gpio port address
- Returns:
the gpio port number
-
struct gpio_it_t
This struct define the gpio interrupt.
Gpio
-
uint8_t BSP_Gpio_InputEnable(const uint32_t u32Port, const uint16_t u16Pin, const uint8_t b_Flag)
This function set as input (or analog mode) the given gpio.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
b_Flag – [in] 1 : set as input, 0: set in analog mode
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
-
uint8_t BSP_Gpio_OutputEnable(const uint32_t u32Port, const uint16_t u16Pin, const uint8_t b_Flag)
This function set as output (or analog mode) the given gpio.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
b_Flag – [in] 1 : set as output, 0: set in analog mode
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
-
inline uint8_t BSP_Gpio_Get(const uint32_t u32Port, const uint16_t u16Pin, uint8_t *b_Level)
This function get the value of the given gpio.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
b_Level – [inout] Will hold the gpio current value
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
-
inline uint8_t BSP_Gpio_Set(const uint32_t u32Port, const uint16_t u16Pin, uint8_t b_Level)
This function set the value of the given gpio.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
b_Level – [in] The value to set
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
-
inline uint8_t BSP_Gpio_SetLow(const uint32_t u32Port, const uint16_t u16Pin)
This function set to 0 the given gpio.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
-
inline uint8_t BSP_Gpio_SetHigh(const uint32_t u32Port, const uint16_t u16Pin)
This function set to 1 the given gpio.
- Parameters:
u32Port – [in] Gpio port
u16Pin – [in] Gpio pin
- Return values:
DEV_SUCCESS – (see dev_res_e::DEV_SUCCESS)
Low Power
-
enum lp_mode_e
This enum define the sleep mode.
Values:
-
enumerator LP_SLEEP_MODE
Sleep mode (CPU is sleeping)
-
enumerator LP_STOP1_MODE
Stop 1 mode
-
enumerator LP_STOP2_MODE
Stop 2 mode
-
enumerator LP_STDBY_MODE
Standby mode
-
enumerator LP_SHTDWN_MODE
Shutdown mode
-
enumerator LP_SLEEP_MODE
-
RTC_HandleTypeDef hrtc
-
UART_HandleTypeDef *paUART_BusHandle[UART_ID_MAX]
-
void BSP_LowPower_Enter(lp_mode_e eLpMode)
This function enter in the given low power mode.
- Parameters:
eLpMode – [in] The low power mode (see lp_mode_e)
-
WAKEUP_PIN
This define the current wake-up pin.
RTC
-
RTC_HandleTypeDef hrtc
-
void BSP_Rtc_Setup_Clk(uint32_t clock_sel)
This function setup the RTC clock.
- Parameters:
clock_sel – [in] RTC clock selection
- Returns:
None
-
void BSP_Rtc_Setup(uint16_t div_s, uint8_t div_a)
This function setup the RTC divider.
- Parameters:
div_s – [in] DIV_S factor
div_a – [in] DIV_A factor
- Returns:
None
-
void BSP_Rtc_Backup_Write(uint32_t regNum, uint32_t data)
This function write to backup register.
- Parameters:
regNum – [in] The backup register numbre to write
data – [in] The value to write in
- Returns:
None
-
uint32_t BSP_Rtc_Backup_Read(uint32_t regNum)
This function read from backup register.
- Parameters:
regNum – [in] The backup register numbre to read from
- Returns:
The read value
-
void BSP_Rtc_Time_Write(time_t t)
This function set the current time.
- Parameters:
t – [in] The current time to set (in epoch)
- Returns:
None
-
void BSP_Rtc_Time_ReadMicro(struct timeval *tp)
This function read the current time.
- Parameters:
tp – [in] Pointer on timeval structure to hold the read time
- Returns:
None
-
uint64_t BSP_Rtc_Time_GetEpochMs(void)
This function get the millisecond epoch time.
- Returns:
the millisecond epoch time
-
time_t BSP_Rtc_Time_Read(void)
This function get the epoch time.
- Returns:
the epoch time
-
void BSP_Rtc_Time_UpdateDaylight(daylight_sav_e daylight_sav)
This function update the RTC clock with summer/winter time.
- Parameters:
daylight_sav – [in] The daylight
- Returns:
None
-
void BSP_Rtc_Time_Update(time_t t)
-
void BSP_Rtc_Time_ForceNotify(void)
This function force the RTC wake-up interrupt (in one second)
-
void BSP_Rtc_Alarm_ForceNotify(void)
This function is not implemented.
-
void BSP_Rtc_Time_Update_SetCallback(pfEventCB_t const pfCb)
This function set the callback for “time changed”.
- Parameters:
pfCb – [in] Callback function
-
void BSP_Rtc_WakeUpTimer_Enable(void)
This function enable the RTC wake-up timer.
-
void BSP_Rtc_WakeUpTimer_Disable(void)
This function disable the RTC wake-up timer.
-
void BSP_Rtc_WakeUptimer_Reload(void)
This function reload the RTC wake-up timer to the next wake-up event (i.e. the next midnight)
-
void BSP_Rtc_WakeUpTimer_SetCallback(pfEventCB_t const pfCb)
This function set the callback for the wake-up timer event.
- Parameters:
pfCb – [in] Callback funtion
-
void BSP_Rtc_WakeUpTimer_SetHandler(pfHandlerCB_t const pfCb)
This function set the RTC wake-up timer interrupt handler.
- Parameters:
pfCb – [in] Interrupt handler
-
void BSP_Rtc_Alarm_Start(const uint8_t u8AlarmId, uint32_t u32Elapse)
This function start the given alarm.
- Parameters:
u8AlarmId – [in] The alarm id to start
u32Elapse – [in] The elapse time in second before alarm occurs
-
void BSP_Rtc_Alarm_StartMs(const uint8_t u8AlarmId, uint64_t u64Elapse)
This function start the given alarm at milisecond scale.
- Parameters:
u8AlarmId – [in] The alarm id to start
u64Elapse – [in] The elapse time in millisecond before alarm occurs
-
void BSP_Rtc_Alarm_Stop(const uint8_t u8AlarmId)
This function stop the given alarm.
- Parameters:
u8AlarmId – [in] The alarm id to stop
-
void BSP_Rtc_Alarm_SetHandler(const uint8_t u8AlarmId, pfHandlerCB_t const pfCb)
This function set the alarm interrupt handler.
- Parameters:
u8AlarmId – [in] The alarm id
pfCb – [in] The interrupt handler
-
void Error_Handler(void)
This function is executed in case of error occurrence.
- Return values:
None –
-
static void _rtc_wakeUptimer_handler_(void)
This function is default RTC wake-up timer interrupt handler.
When wake-up interrupt occurs, both pfUpdateTimeCallBack and pfWakeUpTimerCallBack callback function will be called. The first one is intended to treat the time update (time management). The second one is free to be used.
UART
-
enum uart_evt_e
This enum define possible events from UART.
Values:
-
enumerator UART_EVT_NONE
None
-
enumerator UART_EVT_TX_CPLT
Transmition is complete
-
enumerator UART_EVT_RX_CPLT
Reception is complete
-
enumerator UART_EVT_RX_HCPLT
-
enumerator UART_EVT_RX_ABT
-
enumerator UART_EVT_NONE
-
enum uart_flag_e
This enum define flags … from UART.
Values:
-
enumerator UART_FLG_NONE
-
enumerator UART_FLG_RX_TMO
-
enumerator UART_FLG_RX_OVFL
-
enumerator UART_FLG_RX_SOB
-
enumerator UART_FLG_RX_EOB
-
enumerator UART_FLG_NONE
-
enum uart_mode_e
This enum define the “detection” mode for UART.
Values:
-
enumerator UART_MODE_NONE
None (wait until the buffer reach the geiven size)
-
enumerator UART_MODE_EOB
Event is sent when character match the end of block
-
enumerator UART_MODE_ADDR
Event is sent when character match the start of block
-
enumerator UART_MODE_NONE
-
typedef uart_dev_t *p_uart_dev_t
This type define a pointer on UART device structure.
-
uart_dev_t aDevUart[UART_ID_MAX]
-
int __io_putchar(int ch)
-
int __io_getchar(void)
-
void BSP_Console_SetTXCallback(pfHandlerCB_t const pfCb)
-
void BSP_Console_SetRXCallback(pfHandlerCB_t const pfCb)
-
void BSP_Console_SetWakupCallback(pfHandlerCB_t const pfCb)
-
uint8_t BSP_Console_Send(uint8_t *pData, uint16_t u16Length)
-
uint8_t BSP_Uart_SetCallback(uint8_t u8DevId, pfEvtCb_t const pfEvtCb, void *pCbParam)
Set the Uart interrupt callback.
- Parameters:
u8DevId – [in] Uart device id (see uart_id_e)
pfEvtCb – [in] Pointer on the callback function
pCbParam – [in] Pointer on the callback parameter
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given paramater is in valid (see dev_res_e::DEV_INVALID_PARAM)
-
uint8_t BSP_Uart_Init(uint8_t u8DevId, uint8_t u8CharMatch, uint8_t u8Mode, uint32_t u32Tmo)
Configure the given uart (interrupt mode)
- Parameters:
u8DevId – [in] Uart device id (see uart_id_e)
u8CharMatch – [in] Character to match
u8Mode – [in] Uart detection mode (see uart_mode_e)
u32Tmo – [in] Timeout (0 : timeout is not used)
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given parameter is invalid (see dev_res_e::DEV_INVALID_PARAM)
-
uint8_t BSP_Uart_Transmit(uint8_t u8DevId, uint8_t *pData, uint16_t u16Length)
Start to transmit on the given uart (interrupt mode)
- Parameters:
u8DevId – [in] Uart device id (see uart_id_e)
pData – [in] Pointer on the buffer to send
u16Length – [in] Size of the message
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given parameter is invalid (see dev_res_e::DEV_INVALID_PARAM)
DEV_BUSY – if the given device is busy (see dev_res_e::DEV_BUSY)
-
uint8_t BSP_Uart_Receive(uint8_t u8DevId, uint8_t *pData, uint16_t u16Length)
Start to receive on the given uart (interrupt mode)
- Parameters:
u8DevId – [in] Uart device id (see uart_id_e)
pData – [in] Pointer on receiving buffer
u16Length – [in] Size of expected message
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given parameter is invalid (see dev_res_e::DEV_INVALID_PARAM)
DEV_BUSY – if the given device is busy (see dev_res_e::DEV_BUSY)
-
uint8_t BSP_Uart_AbortReceive(uint8_t u8DevId)
Abort the UART receive (interrupt mode)
- Parameters:
u8DevId – [in] Uart device id (see uart_id_e)
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given parameter is invalid (see dev_res_e::DEV_INVALID_PARAM)
-
uint8_t BSP_Console_Init(void)
-
uint8_t BSP_Console_Received(uint8_t *pData, uint16_t u16Length)
-
static void _bsp_com_TxISR_8BIT(UART_HandleTypeDef *huart)
TX interrupt handler.
- Parameters:
huart – [in] Pointer on the uart handle
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given paramater is in valid (see dev_res_e::DEV_INVALID_PARAM)
-
static void _bsp_com_RxISR_8BIT(UART_HandleTypeDef *huart)
RX interrupt handler.
- Parameters:
huart – [in] Pointer on the uart handle
- Return values:
DEV_SUCCESS – if everything is fine (see dev_res_e::DEV_SUCCESS)
DEV_INVALID_PARAM – if the given paramater is in valid (see dev_res_e::DEV_INVALID_PARAM)
-
CONSOLE_TX_TIMEOUT
-
CONSOLE_RX_TIMEOUT
-
struct uart_dev_t
- #include <bsp_uart.h>
This structure define the UART device.
Board
Warning
doxygengroup: Cannot find group “nucleo_L476_board” in doxygen xml output for project “OpenWize Developer Documentation” from directory: _build/xml
Devices
PhyFake
-
enum fakeuart_state_e
This enum defines the PḧyFake state.
Values:
-
enumerator IDLE_STATE
-
enumerator INITIALIZED_STATE
-
enumerator CONFIGURED_STATE
-
enumerator TRANSMITTING_STATE
-
enumerator RECEIVING_STATE
-
enumerator IDLE_STATE
-
enum fakeuart_error_e
This enum defines the PhyFake error.
Values:
-
enumerator FAKEUART_ERR_NONE
-
enumerator FAKEUART_FAILURE
-
enumerator FAKEUART_BUSY
-
enumerator FAKEUART_TIMEOUT
-
enumerator FAKEUART_INVALID_PARAM
-
enumerator FAKEUART_ERR_NONE
- const char *const phyfake_error_msgs [] ={[FAKEUART_ERR_NONE] = "PhyFake ERR_NONE",[FAKEUART_FAILURE] = "PhyFake FAILURE",[FAKEUART_BUSY] = "PhyFake BUSY",[FAKEUART_TIMEOUT] = "PhyFake TIMEOUT",[FAKEUART_INVALID_PARAM] = "PhyFake INVALID_PARAM",}
This convenient table hold the human error representation.
- const char *const aChanStr [PHY_NB_CH] = {[PHY_CH100] = "100",[PHY_CH110] = "110",[PHY_CH120] = "120",[PHY_CH130] = "130",[PHY_CH140] = "140",[PHY_CH150] = "150",}
This convenient table hold the human channel representation.
- const char *const aModulationStr [PHY_NB_MOD] = {[PHY_WM2400] = "WM2400",[PHY_WM4800] = "WM4800",[PHY_WM6400] = "WM6400",}
This convenient table hold the human modulation representation.
- const char *const aTestModeStr [PHY_NB_TST_MODE] = {[PHY_TST_MODE_NONE] = "Disable",[PHY_TST_MODE_RX] = "RX",[PHY_TST_MODE_PER_RX] = "RX PER",[PHY_TST_MODE_TX] = "TX",}
This convenient table hold the human test mode representation.
- static const phy_if_t _phy_if = {.pfInit = _init,.pfUnInit = _uninit,.pfTx = _do_TX,.pfRx = _do_RX,.pfNoise = _do_CCA,.pfSetSend = _set_send,.pfGetRecv = _get_recv,.pfIoctl = _ioctl}
This structure hold the Phy device interface.
-
int32_t Phy_PhyFake_setup(phydev_t *pPhydev, fakeuart_device_t *pCtx)
This function prepare the Phy device with constant configuration.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
pCtx – [in] Pointer on the Phy device context
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _init(phydev_t *pPhydev)
This function initialize the Phy device.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _uninit(phydev_t *pPhydev)
This function un-initialize the Phy device. (Power OFF and Reset released)
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _do_TX(phydev_t *pPhydev, phy_chan_e eChannel, phy_mod_e eModulation)
This function execute a TX sequence.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
eChannel – [in] Channel use to TX
eModulation – [in] Modulation use to TX
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _do_RX(phydev_t *pPhydev, phy_chan_e eChannel, phy_mod_e eModulation)
This function execute an RX sequence.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
eChannel – [in] Channel use to RX
eModulation – [in] Modulation use to RX
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _do_CCA(phydev_t *pPhydev, phy_chan_e eChannel, phy_mod_e eModulation)
This function execute a Noise Measurement sequence.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
eChannel – [in] Channel on which the Noise must be measured
eModulation – [in] Modulation on which the Noise must be measured
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _set_send(phydev_t *pPhydev, uint8_t *pBuf, uint8_t u8Len)
This function set the packet to send.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
pBuf – [in] Pointer to get data to send
u8Len – [in] Reference on the data length to send
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _get_recv(phydev_t *pPhydev, uint8_t *pBuf, uint8_t *u8Len)
This function get the received packet.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
pBuf – [in] Pointer on buffer to get received data
u8Len – [in] Reference on received number of bytes
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _ioctl(phydev_t *pPhydev, uint32_t eCtl, uint32_t args)
This function Get/Set internal configuration variable.
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
eCtl – [in] Id of configuration variable to get/set (see phy_ctl_e)
args – [inout] scalar or pointer that hold the value to set/get
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static int32_t _do_cmd(phydev_t *pPhydev, uint8_t eCmd)
This is the main FSM.
This function ensure that transition between state are respected. … :
Wake-up, (re)configuration,
- Parameters:
pPhydev – [in] Pointer on the Phy device instance
eCmd – [in] Requested command to execute
- Return values:
PHY_STATUS_OK – (see phy_status_e::PHY_STATUS_OK)
PHY_STATUS_ERROR – (see phy_status_e::PHY_STATUS_ERROR)
PHY_STATUS_BUSY – (see phy_status_e::PHY_STATUS_BUSY)
-
static void _frame_it(void *p_CbParam, void *p_Arg)
Interruption handler to treat the frame event.
- Parameters:
p_CbParam – [in] Pointer on call-back parameter
p_Arg – [in] Pointer on call-back argument
- Returns:
None
-
struct fakeuart_device_t
- #include <phy_layer_private.h>
This struct defines PhyFake device context.