CMSIS-Driver Validation  
Driver Validation
 All Files Functions Variables Macros Groups Pages
Driver Management

Functions

void SPI_GetVersion (void)
 Function: Function SPI_GetVersion. More...
 
void SPI_GetCapabilities (void)
 Function: Function SPI_GetCapabilities. More...
 
void SPI_Initialize_Uninitialize (void)
 Function: Function SPI_Initialize_Uninitialize. More...
 
void SPI_PowerControl (void)
 Function: Function SPI_PowerControl. More...
 

Description

These tests verify API and operation of the SPI driver management functions.

The driver management tests verify the following driver functions (SPI Driver function documentation):

Function Documentation

void SPI_GetVersion ( void  )

The function SPI_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
void SPI_GetCapabilities ( void  )

The function SPI_GetCapabilities verifies the GetCapabilities function.

ARM_SPI_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
void SPI_Initialize_Uninitialize ( void  )

The function SPI_Initialize_Uninitialize verifies the Initialize and Uninitialize functions.

int32_t Initialize (ARM_SPI_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 GetDataCount 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 busy flag 0
    • Assert that GetStatus function returned status structure with data_lost flag 0
    • Assert that GetStatus function returned status structure with mode_fault 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 Transfer function and assert that it returned ARM_DRIVER_OK status
    • Call GetStatus function
    • Assert that GetStatus function returned status structure with busy flag 1
    • Call Uninitialize function with transfer active and assert that it returned ARM_DRIVER_OK status
      (this must unconditionally terminate active 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 busy flag 0
void SPI_PowerControl ( void  )

The function SPI_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 GetDataCount 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 busy flag 0
    • Assert that GetStatus function returned status structure with data_lost flag 0
    • Assert that GetStatus function returned status structure with mode_fault 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 Transfer function and assert that it returned ARM_DRIVER_OK status
    • Call GetStatus function
    • Assert that GetStatus function returned status structure with busy flag 1
    • Call PowerControl(ARM_POWER_OFF) function with transfer active and assert that it returned ARM_DRIVER_OK status
      (this must unconditionally terminate active 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 busy flag 0