Appiko
S2LP_Csma.h
Go to the documentation of this file.
1 
52 /* Define to prevent recursive inclusion -------------------------------------*/
53 #ifndef __S2LP_CSMA_H
54 #define __S2LP_CSMA_H
55 
56 
57 /* Includes ------------------------------------------------------------------*/
58 #include "S2LP_Types.h"
59 #include "S2LP_Regs.h"
60 
61 
62 #ifdef __cplusplus
63  extern "C" {
64 #endif
65 
66 
90 typedef enum {
96 
97 
101 typedef struct {
104  uint8_t xCcaLength;
105  uint8_t cMaxNb;
106  uint16_t nBuCounterSeed;
107  uint8_t cBuPrescaler;
108 } SCsmaInit;
109 
110 
152 void S2LPCsmaInit(SCsmaInit* pxSCsmaInit);
153 void S2LPCsmaGetInfo(SCsmaInit* pxSCsmaInit);
154 void S2LPCsma(SFunctionalState xNewState);
160 void S2LPCsmaSetBuCounterSeed(uint16_t nBuCounterSeed);
161 uint16_t S2LPCsmaGetBuCounterSeed(void);
162 void S2LPCsmaSetBuPrescaler(uint8_t cBuPrescaler);
163 uint8_t S2LPCsmaGetBuPrescaler(void);
164 void S2LPCsmaSetCcaPeriod(SCsmaPeriod xMultiplierTbit);
165 uint8_t S2LPCsmaGetCcaPeriod(void);
166 void S2LPCsmaSetCcaLength(uint8_t xCcaLength);
167 uint8_t S2LPCsmaGetCcaLength(void);
168 void S2LPCsmaSetMaxNumberBackoff(uint8_t cMaxNb);
169 uint8_t S2LPCsmaGetMaxNumberBackoff(void);
170 
184 #ifdef __cplusplus
185 }
186 #endif
187 
188 #endif
189 
190 /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
void S2LPCsmaSetCcaPeriod(SCsmaPeriod xMultiplierTbit)
Set the CCA period.
Definition: S2LP_Csma.c:416
void S2LPCsmaGetInfo(SCsmaInit *pxSCsmaInit)
Return the fitted structure SCsmaInit starting from the registers values.
Definition: S2LP_Csma.c:164
uint8_t cBuPrescaler
Definition: S2LP_Csma.h:107
SFunctionalState xCsmaPersistentMode
Definition: S2LP_Csma.h:102
uint8_t xCcaLength
Definition: S2LP_Csma.h:104
void S2LPCsmaPersistentMode(SFunctionalState xNewState)
Enables or Disables the persistent CSMA mode.
Definition: S2LP_Csma.c:254
SFunctionalState
S2LP Functional state. Used to enable or disable a specific option.
Definition: S2LP_Types.h:67
SCsmaPeriod xMultiplierTbit
Definition: S2LP_Csma.h:103
uint16_t nBuCounterSeed
Definition: S2LP_Csma.h:106
uint16_t S2LPCsmaGetBuCounterSeed(void)
Return the BU counter seed (BU_COUNTER_SEED register).
Definition: S2LP_Csma.c:365
SFunctionalState S2LPCsmaGetCsma(void)
Gets the CSMA mode. Says if it is enabled or disabled.
Definition: S2LP_Csma.c:231
SCsmaPeriod
Multiplier for Tcca time enumeration (Tcca = Multiplier*Tbit).
Definition: S2LP_Csma.h:90
uint8_t S2LPCsmaGetCcaPeriod(void)
Return the CCA period.
Definition: S2LP_Csma.c:436
uint8_t S2LPCsmaGetMaxNumberBackoff(void)
Return the max number of back-off.
Definition: S2LP_Csma.c:506
void S2LPCsmaSeedReloadMode(SFunctionalState xNewState)
Enables or Disables the seed reload mode (if enabled it reloads the back-off generator seed using the...
Definition: S2LP_Csma.c:301
void S2LPCsmaSetCcaLength(uint8_t xCcaLength)
Set the CCA length.
Definition: S2LP_Csma.c:452
This file contains all the registers address and masks.
SFunctionalState S2LPCsmaGetPersistentMode(void)
Gets the persistent CSMA mode.
Definition: S2LP_Csma.c:279
void S2LPCsmaSetBuPrescaler(uint8_t cBuPrescaler)
Set the BU prescaler. The CSMA back off time is given by the formula: BO = rand(2^NB)*BU.
Definition: S2LP_Csma.c:381
SFunctionalState S2LPCsmaGetSeedReloadMode(void)
Gets the seed reload mode.
Definition: S2LP_Csma.c:326
uint8_t cMaxNb
Definition: S2LP_Csma.h:105
uint8_t S2LPCsmaGetCcaLength(void)
Return the CCA length.
Definition: S2LP_Csma.c:472
void S2LPCsmaInit(SCsmaInit *pxSCsmaInit)
Initialize the S2LP CSMA according to the specified parameters in the SCsmaInit.
Definition: S2LP_Csma.c:114
uint8_t S2LPCsmaGetBuPrescaler(void)
Return the BU prescaler.
Definition: S2LP_Csma.c:400
Header file for S2-LP types.
void S2LPCsmaSetMaxNumberBackoff(uint8_t cMaxNb)
Set the max number of back-off. If reached S2LP stops the transmission.
Definition: S2LP_Csma.c:488
void S2LPCsmaSetBuCounterSeed(uint16_t nBuCounterSeed)
Set the BU counter seed (BU_COUNTER_SEED register). The CSMA back off time is given by the formula: B...
Definition: S2LP_Csma.c:348
S2LP CSMA Init structure definition.
Definition: S2LP_Csma.h:101
void S2LPCsma(SFunctionalState xNewState)
Enable or Disables the CSMA.
Definition: S2LP_Csma.c:201