These tests verify API and operation of the USART driver management functions.
The driver management tests verify the following driver functions (USART Driver function documentation):
- GetVersion
ARM_DRIVER_VERSION GetVersion (void);
- GetCapabilities
ARM_USART_CAPABILITIES GetCapabilities (void);
- Initialize
int32_t Initialize (ARM_USART_SignalEvent_t cb_event);
- Uninitialize
int32_t Uninitialize (void);
- PowerControl
int32_t PowerControl (ARM_POWER_STATE state);
◆ USART_GetVersion()
void USART_GetVersion |
( |
void |
| ) |
|
The function UDSART_GetVersion verifies the GetVersion function.
ARM_DRIVER_VERSION GetVersion (void);
Testing sequence:
- Driver is uninitialized and peripheral is powered-off:
- Call GetVersion function
- Assert that GetVersion function returned version structure with API and implementation versions higher or equal to 1.0
◆ USART_GetCapabilities()
void USART_GetCapabilities |
( |
void |
| ) |
|
The function USART_GetCapabilities verifies the GetCapabilities function.
ARM_USART_CAPABILITIES GetCapabilities (void);
Testing sequence:
- Driver is uninitialized and peripheral is powered-off:
- Call GetCapabilities function
- Assert that GetCapabilities function returned capabilities structure with reserved field 0
◆ USART_Initialize_Uninitialize()
void USART_Initialize_Uninitialize |
( |
void |
| ) |
|
The function USART_Initialize_Uninitialize verifies the Initialize and Uninitialize functions.
int32_t Initialize (ARM_USART_SignalEvent_t cb_event);
int32_t Uninitialize (void);
Testing sequence:
- Driver is uninitialized and peripheral is powered-off:
- Call PowerControl(ARM_POWER_FULL) function and assert that it returned ARM_DRIVER_ERROR status
- Call PowerControl(ARM_POWER_LOW) function and assert that it returned ARM_DRIVER_ERROR status
- Call PowerControl(ARM_POWER_OFF) function and assert that it returned ARM_DRIVER_ERROR status
- Call Send function and assert that it returned ARM_DRIVER_ERROR status
- Call Receive function and assert that it returned ARM_DRIVER_ERROR status
- Call Transfer function and assert that it returned ARM_DRIVER_ERROR status
- Call GetTxCount function and assert that it returned 0
- Call GetRxCount function and assert that it returned 0
- Call Control function and assert that it returned ARM_DRIVER_ERROR status
- Call GetStatus function
- Assert that GetStatus function returned status structure with tx_busy flag 0
- Assert that GetStatus function returned status structure with rx_busy flag 0
- Assert that GetStatus function returned status structure with tx_underflow flag 0
- Assert that GetStatus function returned status structure with rx_overflow flag 0
- Assert that GetStatus function returned status structure with rx_break flag 0
- Assert that GetStatus function returned status structure with rx_framing_error flag 0
- Assert that GetStatus function returned status structure with rx_parity_error flag 0
- Assert that GetStatus function returned status structure with reserved field 0
- Call Initialize function (without callback specified) and assert that it returned ARM_DRIVER_OK status
- Driver is initialized and peripheral is powered-off:
- Call Initialize function (without callback specified) again and assert that it returned ARM_DRIVER_OK status
- Call Uninitialize function and assert that it returned ARM_DRIVER_OK status
- Driver is uninitialized and peripheral is powered-off:
- Call Initialize function (with callback specified) and assert that it returned ARM_DRIVER_OK status
- Driver is initialized and peripheral is powered-off:
- Call Initialize function (with callback specified) again and assert that it returned ARM_DRIVER_OK status
- Call Uninitialize function and assert that it returned ARM_DRIVER_OK status
- Driver is uninitialized and peripheral is powered-off:
- Call Uninitialize function again and assert that it returned ARM_DRIVER_OK status
- Call Initialize function (without callback specified) and assert that it returned ARM_DRIVER_OK status
- Driver is initialized and peripheral is powered-off:
- Call PowerControl(ARM_POWER_FULL) function and assert that it returned ARM_DRIVER_OK status
- Driver is initialized and peripheral is powered-on:
- Call Control function and assert that it returned ARM_DRIVER_OK status
- Call Uninitialize function and assert that it returned ARM_DRIVER_OK status
(this must unconditionally terminate active send/receive/transfer, power-off the peripheral and uninitialize the driver)
- Driver is uninitialized and peripheral is powered-off:
- Call GetStatus function
- Assert that GetStatus function returned status structure with tx_busy flag 0
- Assert that GetStatus function returned status structure with rx_busy flag 0
◆ USART_PowerControl()
void USART_PowerControl |
( |
void |
| ) |
|
The function USART_PowerControl verifies the PowerControl function.
int32_t PowerControl (ARM_POWER_STATE state);
Testing sequence:
- Driver is initialized and peripheral is powered-off:
- Call Send function and assert that it returned ARM_DRIVER_ERROR status
- Call Receive function and assert that it returned ARM_DRIVER_ERROR status
- Call Transfer function and assert that it returned ARM_DRIVER_ERROR status
- Call GetTxCount function and assert that it returned 0
- Call GetRxCount function and assert that it returned 0
- Call Control function and assert that it returned ARM_DRIVER_ERROR status
- Call GetStatus function
- Assert that GetStatus function returned status structure with tx_busy flag 0
- Assert that GetStatus function returned status structure with rx_busy flag 0
- Assert that GetStatus function returned status structure with tx_underflow flag 0
- Assert that GetStatus function returned status structure with rx_overflow flag 0
- Assert that GetStatus function returned status structure with rx_break flag 0
- Assert that GetStatus function returned status structure with rx_framing_error flag 0
- Assert that GetStatus function returned status structure with rx_parity_error flag 0
- Assert that GetStatus function returned status structure with reserved field 0
- Call PowerControl(ARM_POWER_OFF) and assert that it returned ARM_DRIVER_OK status
- Call PowerControl(ARM_POWER_OFF) again and assert that it returned ARM_DRIVER_OK status
- Call PowerControl(ARM_POWER_FULL) function and assert that it returned ARM_DRIVER_OK status
- Driver is initialized and peripheral is powered-on:
- Call PowerControl(ARM_POWER_FULL) function again and assert that it returned ARM_DRIVER_OK status
- Call PowerControl(ARM_POWER_OFF) and assert that it returned ARM_DRIVER_OK status
- Driver is initialized and peripheral is powered-off:
- Call PowerControl(ARM_POWER_OFF) again and assert that it returned ARM_DRIVER_OK status
- Call PowerControl(ARM_POWER_LOW) function
- Driver is initialized and peripheral is powered-on or in low-power mode:
- Assert that PowerControl(ARM_POWER_LOW) function returned ARM_DRIVER_OK or ARM_DRIVER_ERROR_UNSUPPORTED status
- Call PowerControl(ARM_POWER_FULL) function and assert that it returned ARM_DRIVER_OK status
- Driver is initialized and peripheral is powered-on:
- Call Control function and assert that it returned ARM_DRIVER_OK status
- Call PowerControl(ARM_POWER_OFF) function and assert that it returned ARM_DRIVER_OK status
(this must unconditionally terminate active send/receive/transfer and power-off the peripheral)
- Driver is initialized and peripheral is powered-off:
- Call GetStatus function
- Assert that GetStatus function returned status structure with tx_busy flag 0
- Assert that GetStatus function returned status structure with rx_busy flag 0