HAL PSSI Use Cases

Prerequisite

@startuml

skinparam backgroundColor #FFFFFF

' To add a number by line

'autonumber



' Fix order of each column

participant "User Application" as User

participant System



== Prerequisite ==



User -> System:HAL_Init()

note right

Configure the Flash prefetch, the time base source and the NVIC

end note



System --> User:

note right

Return <color green> HAL_OK</color>

end note



User -> System:SystemClock_Config()

note right

Configure system clock

end note

User <-- System:

@enduml

Initialization

@startuml

skinparam backgroundColor #FFFFFF

participant "User Application" as User

participant "HAL PSSI Driver" as PSSI  #19DD3A

participant "System driver" as System



== PSSI HAL Initialization ==





User -> PSSI:HAL_PSSI_Init()

note over PSSI

Initialize the PSSI handle and associate an instance

end note

alt if (USE_HAL_PSSI_CLK_ENABLE_MODEL > HAL_CLK_ENABLE_NO)

PSSI -> System:Enable the PSSI clock

PSSI <-- System:

end

User <-- PSSI:<font color=green>Driver state is INIT

note right

Return<color green> HAL_OK</color>

end note



alt if (USE_HAL_PSSI_CLK_ENABLE_MODEL == HAL_CLK_ENABLE_NO)

User -> System:Enable the PSSI clock

User <-- System:

note left

User is free to Enable the PSSI clock before or after initialization

end note

end

== PSSI System Initialization ==



User -> System:Initialization of GPIOs

User <-- System:





User -> System:Initialization of DMA and Enabling the NVIC

User <-- System:

note right

When Using DMA

end note



== PSSI Configuration ==



User -> PSSI:HAL_PSSI_SetConfig()

note right

Configure the PSSI according to the user parameters

end note



User <-- PSSI:<font color=green>Driver state is IDLE

note right

Return <color green> HAL_OK</color>

end note

note left

<font color=green>User can start any process or execute any configuration

end note

@enduml

Called functions:

Polling Transfer

@startuml

skinparam backgroundColor #FFFFFF

participant "User Application" as User

participant "HAL PSSI Driver" as PSSI  #19DD3A



== Process: Polling mode ==



User -> PSSI:HAL_PSSI_Transmit()        <font color=blue>Driver state is ACTIVE_TX



activate PSSI #1000DA

hnote over PSSI

<font color=blue> transmission ongoing...

end note

note right

Transmits in master mode an amount of data in blocking mode

end note



User <-- PSSI:<font color=green>Driver state is IDLE.

deactivate PSSI

note right

Return<color green> HAL_OK</color>

end note

note left

<font color=green>User can start any process

<font color=green>or execute any configuration

end note

User -> PSSI:HAL_PSSI_Receive()        <font color=blue>Driver state is ACTIVE_RX

activate PSSI #1000DA

hnote over PSSI

<font color=blue> reception ongoing...

end note

note right

Receives an amount of data in blocking mode

end note



User <-- PSSI:<font color=green>Driver state is IDLE.

deactivate PSSI

note right

Return<color green> HAL_OK</color>

end note

note left

<font color=green>User can start any process

<font color=green>or execute any configuration

end note

@enduml

Called functions:

DMA Transmission

@startuml

skinparam backgroundColor #FFFFFF

participant "User Application" as User

participant "HAL PSSI Driver" as PSSI  #19DD3A

participant DMA

participant DMAx_IRQHandler



== Process: DMA mode ==



User -> PSSI:HAL_PSSI_Transmit_DMA()     <font color=blue>Driver state is ACTIVE_TX

PSSI -> DMA:HAL_DMA_StartPeriphXfer_Opt()

note right

<font color=Red>with optional interrupts disabled

end note

PSSI <-- DMA:



note right

Return <font color=green>HAL_OK

end note

User <-- PSSI:

activate User #1000DA

note right

Return <font color=green>HAL_OK

end note

hnote over User

<font color=blue>Transmission ongoing...

end note



DMAx_IRQHandler <-:DMAx complete interrupt

DMA <-DMAx_IRQHandler:HAL_DMA_IRQHandler

PSSI <-DMA:p_xfer_cplt_cb (PSSI_DMATransmitCplt)

User x<[#green]--:

deactivate User

User <-PSSI:<font color=green>Driver state is IDLE             <font color=BLACK>HAL_PSSI_TxCpltCallback



User -->PSSI

note left

<font color=green>User can start any process

<font color=green>or execute any configuration

end note

PSSI -->DMA

DMA -->DMAx_IRQHandler

DMAx_IRQHandler -->







@enduml

Called functions:

DMA Reception Abort

@startuml

skinparam backgroundColor #FFFFFF

participant "User Application" as User

participant "HAL PSSI Driver" as PSSI  #19DD3A

participant DMA

participant DMAx_IRQHandler



== Process: DMA mode ==



User -> PSSI:HAL_PSSI_Receive_DMA()     <font color=blue>Driver state is ACTIVE_RX

PSSI -> DMA:HAL_DMA_StartPeriphXfer_Opt()

note right

<font color=Red>with optional interrupts disabled

end note

PSSI <-- DMA:



note right

Return <font color=green>HAL_OK

end note

User <-- PSSI:

note right

Return <font color=green>HAL_OK

end note

activate User #1000DA

hnote over User

<font color=blue>reception ongoing...

end note



User -> PSSI:HAL_PSSI_Abort_IT()                <font color=orange>Driver state is ABORT

PSSI -> DMA:HAL_DMA_Abort_IT()

PSSI <-- DMA:

note right

Return <font color=green>HAL_OK

end note

User x<[#red]--:

deactivate User

User <-- PSSI:

activate User #FF9900

hnote over User

<font color=orange>abort process ongoing...

end note

note right

Return <font color=green>HAL_OK

end note

DMAx_IRQHandler <-:DMAx abort completion interrupt

DMA <-DMAx_IRQHandler:HAL_DMA_IRQHandler

PSSI <-DMA:p_xfer_abort_cb (PSSI_DMAAbort)

User x<[#green]--:

deactivate User

User <-PSSI:<font color=green>Driver state is IDLE             <font color=BLACK>HAL_PSSI_AbortCpltCallback



User -->PSSI

note left

<font color=green>User can start any process

<font color=green>or execute any configuration

end note

PSSI -->DMA

DMA -->DMAx_IRQHandler

DMAx_IRQHandler -->







@enduml

Called functions:

Overrun/Underrun Error

@startuml



participant "User Application" as User

participant "HAL PSSI Driver" as PSSI  #19DD3A

participant "PSSI_IRQHandler" as PSSI  #19DD3A_IRQHandler

participant DMA

participant DMAx_IRQHandler





== Process: DMA mode ==

alt Executing Transmission

User -> PSSI:HAL_PSSI_Transmit_DMA()     <font color=blue>Driver state is ACTIVE_TX

else Executing Reception

User -> PSSI:HAL_PSSI_Receive_DMA()     <font color=blue>Driver state is ACTIVE_RX

end

PSSI -> DMA:HAL_DMA_StartPeriphXfer_Opt()

note right

<font color=Red>with optional interrupts disabled

end note

PSSI <-- DMA:



note right

Return <font color=green>HAL_OK

end note

User <-- PSSI:

note right

Return <font color=green>HAL_OK

end note

activate User #1000DA

hnote over User

<font color=blue>transfer data ongoing...

end note



PSSI_IRQHandler <-:PSSI Overrun/underrun error interrupt

User x<[#red]--:

deactivate User

PSSI <-PSSI_IRQHandler:HAL_PSSI_IRQHandler

activate User #FF9900

PSSI -> DMA:HAL_DMA_Abort_IT()

PSSI <-- DMA:

note right

Return <font color=green>HAL_OK

end note

PSSI -->PSSI_IRQHandler

PSSI_IRQHandler -->



hnote over User

<font color=orange>abort process ongoing...

end note

DMAx_IRQHandler <-:DMAx abort completion interrupt

DMA <-DMAx_IRQHandler:HAL_DMA_IRQHandler

PSSI <-DMA:p_xfer_abort_cb (PSSI_DMAAbort)

User x<[#green]--:

deactivate User

User <-PSSI:<font color=green>Driver state is IDLE                  <font color=BLACK>HAL_PSSI_ErrorCallback



User -->PSSI

note left

<font color=green>User can start any process

<font color=green>or execute any configuration

end note

PSSI -->DMA

DMA -->DMAx_IRQHandler

DMAx_IRQHandler -->





@enduml

Called functions:

DMA Error Occurrence

@startuml

skinparam backgroundColor #FFFFFF

participant "User Application" as User

participant "HAL PSSI Driver" as PSSI  #19DD3A

participant DMA

participant DMAx_IRQHandler





== Process: DMA mode ==



alt Executing Transmission

User -> PSSI:HAL_PSSI_Transmit_DMA()     <font color=blue>Driver state is ACTIVE_TX

else Executing Reception

User -> PSSI:HAL_PSSI_Receive_DMA()     <font color=blue>Driver state is ACTIVE_RX

end

PSSI -> DMA:HAL_DMA_StartPeriphXfer_Opt()

note right

<font color=Red>with optional interrupts disabled

end note

PSSI <-- DMA:



note right

Return <font color=green>HAL_OK

end note

User <-- PSSI:

note right

Return <font color=green>HAL_OK

end note

activate User #1000DA

hnote over User

<font color=blue>transfer data ongoing...

end note



DMAx_IRQHandler <-:DMAx error interrupt



User x<[#red]--:

deactivate User

DMA <-DMAx_IRQHandler:HAL_DMA_IRQHandler



activate DMA #FF0000



hnote over DMA

<font color=red>error handling...

end note

PSSI <-DMA:p_xfer_error_cb (PSSI_Error)



deactivate DMA

User <-PSSI:<font color=green>Driver state is IDLE                  <font color=BLACK>HAL_PSSI_ErrorCallback



User -->PSSI

note left

<font color=green>User can start any process

<font color=green>or execute any configuration

end note

PSSI -->DMA

DMA -->DMAx_IRQHandler

DMAx_IRQHandler -->





@enduml

Called functions: