HAL PKA use cases

User application Polling mode, nominal case (no error), timeout case

@startuml
group #edf9ff System initialization
Application->"System Driver" : HAL_Init()
"System Driver"-->Application :
Application->"System Driver" : SystemClock_Config()
"System Driver"-->Application
end
group #edf9ff Initialisation
Application->"RNG Driver" : HAL_RNG_Init()
note right: Initialize the RNG handle and associate an instance.\nRNG clock is enabled in HAL_RNG_Init when USE_HAL_RNG_CLK_ENABLE_MODEL is set to HAL_CLK_ENABLE_RNG_ONLY \nOtherwise, it can be enabled outside using HAL RCC API at the application level.
"RNG Driver"-->Application
Application->"RNG Driver" : HAL_RNG_SetCandidateNISTConfig()
"RNG Driver"-->Application: HAL_OK
Application->"RNG Driver" : HAL_RNG_GenerateRandomNumber()
"RNG Driver"-->Application: HAL_OK
Application->"PKA Driver" : HAL_PKA_Init()
note right: Initialize the PKA handle and associate an instance.\nPKA clock is enabled in HAL_PKA_Init when USE_HAL_PKA_CLK_ENABLE_MODEL is set to HAL_CLK_ENABLE_PKA_ONLY \nOtherwise, it can be enabled outside using HAL RCC API at the application level.
"PKA Driver"-->Application
end
group #edf9ff Configuration
alt #LightSteelBlue
Application->"PKA Driver" : HAL_PKA_{SubBlock}_SetConfig[Operation]()
note right: Set the configuration of a \nspecific <b>operation
else #007c80ff
Application->"PKA Driver" : HAL_PKA_{SubBlock}_SetConfig[Operation]<b>Fast</b>()
note right: Set the configuration of a \n<b>fast mode operation</b> if it is supported
else #LightGray
Application->"PKA Driver" : HAL_PKA_{SubBlock}_SetConfig[Operation]<b>Protect</b>()
note right: Set the configuration of a \n<b>protected mode operation</b> if it is supported
end
"PKA Driver"-->Application: HAL_OK
end
group #edf9ff Computation
group #ebc0da without error
Application->"PKA Driver" : HAL_PKA_Compute()
note right: Start computation in polling\nmode
"PKA Driver"-->Application: HAL_OK
end
end
group #edf0bf Retrieve result
alt #LightSteelBlue
Application->"PKA Driver" : HAL_PKA_{SubBlock}_GetResult[Operation]()
note right: Retrieve the result of a specific \n<b>operation
else #007c80ff
Application->"PKA Driver" : HAL_PKA_{SubBlock}_GetResult[Operation]<b>Fast</b>()
note right: Retrieve the result of a \n<b>fast mode operation</b> if it is supported
else #LightGray
Application->"PKA Driver" : HAL_PKA_{SubBlock}_GetResult[Operation]<b>Protect</b>()
note right: Retrieve the result of a \n<b>protected mode operation</b> if it is supported
end
"PKA Driver"-->Application: Result value
end
group #edf9ff Configuration
alt #LightSteelBlue
Application->"PKA Driver" : HAL_PKA_{SubBlock}_SetConfig[Operation]()
note right: Set the configuration of a \nspecific <b>operation
else #007c80ff
Application->"PKA Driver" : HAL_PKA_{SubBlock}_SetConfig[Operation]<b>Fast</b>()
note right: Set the configuration of a \n<b>fast mode operation</b> if it is supported
else #LightGray
Application->"PKA Driver" : HAL_PKA_{SubBlock}_SetConfig[Operation]<b>Protect</b>()
note right: Set the configuration of a \n<b>protected mode operation</b> if it is supported
end
"PKA Driver"-->Application: HAL_OK
end
group #edf9ff Computation
group #ebdac0 with timeout error
Application->"PKA Driver" : HAL_PKA_Compute()
note right: Start computation in polling\nmode
"PKA Driver"-->Application: HAL_TIMEOUT
end
end
group #edf9ff Deinitialisation
Application->"PKA Driver" : HAL_PKA_DeInit()
note right: PKA driver deinitialisation
Application->"RNG Driver" : HAL_RNG_DeInit()
note right: RNG driver deinitialisation
end
@enduml

Called functions:

User application Interrupt mode, nominal case (no error), abort case

@startuml
group #edf9ff System initialization
Application->"System Driver" : HAL_Init()
"System Driver"-->Application :
Application->"System Driver" : SystemClock_Config()
"System Driver"-->Application
end
group #edf9ff Initialisation
Application->"RNG Driver" : HAL_RNG_Init()
note right: Initialize the RNG handle and associate an instance.\n RNG clock is enabled in HAL_RNG_Init when USE_HAL_RNG_CLK_ENABLE_MODEL is set to HAL_CLK_ENABLE_RNG_ONLY \n Otherwise, it can be enabled outside using HAL RCC API at the application level.
"RNG Driver"-->Application
Application->"RNG Driver" : HAL_RNG_SetCandidateNISTConfig()
"RNG Driver"-->Application: HAL_OK
Application->"RNG Driver" : HAL_RNG_GenerateRandomNumber()
"RNG Driver"-->Application: HAL_OK
Application->"PKA Driver" : HAL_PKA_Init()
note right: Initialize the PKA handle and associate an instance.\n PKA clock is enabled in HAL_PKA_Init when USE_HAL_PKA_CLK_ENABLE_MODEL is set to HAL_CLK_ENABLE_PKA_ONLY \n Otherwise, it can be enabled outside using HAL RCC API at the application level.
"PKA Driver"-->Application
end
group #edf9ff Configuration
alt #LightSteelBlue
Application->"PKA Driver" : HAL_PKA_{SubBlock}_SetConfig[Operation]()
note right: Set the configuration of a \nspecific <b>operation
else #007c80ff
Application->"PKA Driver" : HAL_PKA_{SubBlock}_SetConfig[Operation]<b>Fast</b>()
note right: Set the configuration of a \n<b>fast mode operation</b> if it is supported
else #LightGray
Application->"PKA Driver" : HAL_PKA_{SubBlock}_SetConfig[Operation]<b>Protect</b>()
note right: Set the configuration of a \n<b>protected mode operation</b> if it is supported
end
"PKA Driver"-->Application: HAL_OK
end
group #edf9ff Computation
group #ebc0da nominal case
Application->"PKA Driver" : HAL_PKA_Compute_IT()
note right: Start computation in interrupt\nmode
"PKA Driver"-->Application: HAL_OK
... Various time depending on computation complexity ...
"PKA_IRQHandler"<-] : PKA interruption
"PKA_IRQHandler"->"PKA Driver" : HAL_PKA_IRQHandler()
"PKA Driver"->Application : HAL_PKA_OperationCpltCallback()
end
end
group #edf0bf Retrieve result
alt #LightSteelBlue
Application->"PKA Driver" : HAL_PKA_{SubBlock}_GetResult[Operation]()
note right: Retrieve the result of a specific \n<b>operation
else #007c80ff
Application->"PKA Driver" : HAL_PKA_{SubBlock}_GetResult[Operation]<b>Fast</b>()
note right: Retrieve the result of a \n<b>fast mode operation</b> if it is supported
else #LightGray
Application->"PKA Driver" : HAL_PKA_{SubBlock}_GetResult[Operation]<b>Protect</b>()
note right: Retrieve the result of a \n<b>protected mode operation</b> if it is supported
end
"PKA Driver"-->Application: Result value
end
group #edf9ff Configuration
alt #LightSteelBlue
Application->"PKA Driver" : HAL_PKA_{SubBlock}_SetConfig[Operation]()
note right: Set the configuration of a \nspecific <b>operation
else #007c80ff
Application->"PKA Driver" : HAL_PKA_{SubBlock}_SetConfig[Operation]<b>Fast</b>()
note right: Set the configuration of a \n<b>fast mode operation</b> if it is supported
else #LightGray
Application->"PKA Driver" : HAL_PKA_{SubBlock}_SetConfig[Operation]<b>Protect</b>()
note right: Set the configuration of a \n<b>protected mode operation</b> if it is supported
end
"PKA Driver"-->Application: HAL_OK
end
group #edf9ff Computation
group #ebdac0 abort case
Application->"PKA Driver" : HAL_PKA_Compute_IT()
note right: Start computation in interrupt\nmode
"PKA Driver"-->Application: HAL_OK
... Too long time detected by Application ...
Application->"PKA Driver" : HAL_PKA_Abort
"PKA Driver"-->Application: HAL_OK
end
end
group #edf9ff Deinitialisation
Application->"PKA Driver" : HAL_PKA_DeInit()
note right: PKA driver deinitialisation
Application->"RNG Driver" : HAL_RNG_DeInit()
note right: RNG driver deinitialisation
end
@enduml

Called functions: