Skip to content

Commit

Permalink
Fix nasa#385, Deprecate interrupt related APIs
Browse files Browse the repository at this point in the history
Removes coverage test code completely
Marks OS_Int* API's as deprecated and implementations
removed if OSAL_OMIT_DEPRECATED defined
  • Loading branch information
skliper committed Mar 27, 2020
1 parent 20a83c4 commit 8f6f81d
Show file tree
Hide file tree
Showing 13 changed files with 114 additions and 857 deletions.
37 changes: 29 additions & 8 deletions src/os/inc/osapi-os-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1180,13 +1180,18 @@ int32 OS_FPUExcSetMask (uint32 mask);
int32 OS_FPUExcGetMask (uint32 *mask);
/**@}*/

#ifndef OSAL_OMIT_DEPRECATED

/** @defgroup OSAPIInterrupt OSAL Interrupt APIs
* @{
* @deprecated Platform dependencies
*/

/*-------------------------------------------------------------------------------------*/
/**
* @brief Associate an interrupt number to a specified handler routine
* @brief DEPRECATED; Associate an interrupt number to a specified handler routine
*
* @deprecated platform dependencies, removing from OSAL
*
* The call associates a specified C routine to a specified interrupt
* number. Upon occurring of the InterruptNumber, the InerruptHandler
Expand All @@ -1205,7 +1210,9 @@ int32 OS_IntAttachHandler (uint32 InterruptNumber, osal_task_entry InterruptHan

/*-------------------------------------------------------------------------------------*/
/**
* @brief Enable interrupts
* @brief DEPRECATED; Enable interrupts
*
* @deprecated platform dependencies, removing from OSAL
*
* @param[in] IntLevel value from previous call to OS_IntLock()
*
Expand All @@ -1217,7 +1224,9 @@ int32 OS_IntUnlock (int32 IntLevel);

/*-------------------------------------------------------------------------------------*/
/**
* @brief Disable interrupts
* @brief DEPRECATED; Disable interrupts
*
* @deprecated platform dependencies, removing from OSAL
*
* @return An key value to be passed to OS_IntUnlock() to restore interrupts or error
* status, see @ref OSReturnCodes
Expand All @@ -1228,7 +1237,9 @@ int32 OS_IntLock (void);

/*-------------------------------------------------------------------------------------*/
/**
* @brief Enables interrupts through Level
* @brief DEPRECATED; Enables interrupts through Level
*
* @deprecated platform dependencies, removing from OSAL
*
* @param[in] Level the interrupts to enable
*
Expand All @@ -1240,7 +1251,9 @@ int32 OS_IntEnable (int32 Level);

/*-------------------------------------------------------------------------------------*/
/**
* @brief Disable interrupts through Level
* @brief DEPRECATED; Disable interrupts through Level
*
* @deprecated platform dependencies, removing from OSAL
*
* @param[in] Level the interrupts to disable
*
Expand All @@ -1252,7 +1265,9 @@ int32 OS_IntDisable (int32 Level);

/*-------------------------------------------------------------------------------------*/
/**
* @brief Set the CPU interrupt mask register
* @brief DEPRECATED; Set the CPU interrupt mask register
*
* @deprecated platform dependencies, removing from OSAL
*
* @note The interrupt bits are architecture-specific.
*
Expand All @@ -1266,7 +1281,9 @@ int32 OS_IntSetMask (uint32 mask);

/*-------------------------------------------------------------------------------------*/
/**
* @brief Get the CPU interrupt mask register
* @brief DEPRECATED; Get the CPU interrupt mask register
*
* @deprecated platform dependencies, removing from OSAL
*
* @note The interrupt bits are architecture-specific.
*
Expand All @@ -1280,7 +1297,9 @@ int32 OS_IntGetMask (uint32 *mask);

/*-------------------------------------------------------------------------------------*/
/**
* @brief Acknowledge the corresponding interrupt number.
* @brief DEPRECATED; Acknowledge the corresponding interrupt number.
*
* @deprecated platform dependencies, removing from OSAL
*
* @note: placeholder; not currently implemented in sample implementations
*
Expand All @@ -1294,6 +1313,8 @@ int32 OS_IntGetMask (uint32 *mask);
int32 OS_IntAck (int32 InterruptNumber);
/**@}*/

#endif /* OSAL_OMIT_DEPRECATED */

/**
* @defgroup OSAPIShMem OSAL Shared memory APIs
* @deprecated Not in current implementations
Expand Down
34 changes: 18 additions & 16 deletions src/os/posix/osapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2131,6 +2131,7 @@ int32 OS_MutSemGetInfo_Impl (uint32 sem_id, OS_mut_sem_prop_t *mut_prop)

} /* end OS_MutSemGetInfo_Impl */

#ifndef OSAL_OMIT_DEPRECATED

/****************************************************************************************
INT API
Expand Down Expand Up @@ -2208,48 +2209,49 @@ int32 OS_IntDisable_Impl(int32 Level)

/*----------------------------------------------------------------
*
* Function: OS_HeapGetInfo_Impl
* Function: OS_IntSetMask_Impl
*
* Purpose: Implemented per internal OSAL API
* See prototype in os-impl.h for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_HeapGetInfo_Impl(OS_heap_prop_t *heap_prop)
int32 OS_IntSetMask_Impl ( uint32 MaskSetting )
{
/*
** Not implemented yet
*/
return (OS_ERR_NOT_IMPLEMENTED);
} /* end OS_HeapGetInfo_Impl */
return(OS_ERR_NOT_IMPLEMENTED);
} /* end OS_IntSetMask_Impl */


/*----------------------------------------------------------------
*
* Function: OS_IntSetMask_Impl
* Function: OS_IntGetMask_Impl
*
* Purpose: Implemented per internal OSAL API
* See prototype in os-impl.h for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_IntSetMask_Impl ( uint32 MaskSetting )
int32 OS_IntGetMask_Impl ( uint32 * MaskSettingPtr )
{
*MaskSettingPtr = 0;
return(OS_ERR_NOT_IMPLEMENTED);
} /* end OS_IntSetMask_Impl */
} /* end OS_IntGetMask_Impl */

#endif /* OSAL_OMIT_DEPRECATED */


/*----------------------------------------------------------------
*
* Function: OS_IntGetMask_Impl
* Function: OS_HeapGetInfo_Impl
*
* Purpose: Implemented per internal OSAL API
* See prototype in os-impl.h for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_IntGetMask_Impl ( uint32 * MaskSettingPtr )
int32 OS_HeapGetInfo_Impl(OS_heap_prop_t *heap_prop)
{
*MaskSettingPtr = 0;
return(OS_ERR_NOT_IMPLEMENTED);
} /* end OS_IntGetMask_Impl */
/*
** Not implemented yet
*/
return (OS_ERR_NOT_IMPLEMENTED);
} /* end OS_HeapGetInfo_Impl */

/*----------------------------------------------------------------
*
Expand Down
59 changes: 31 additions & 28 deletions src/os/rtems/osapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,8 @@ int32 OS_MutSemGetInfo_Impl (uint32 sem_id, OS_mut_sem_prop_t *mut_prop)
TICK API
***************************************************************************************/

#ifndef OSAL_OMIT_DEPRECATED

/****************************************************************************************
INT API
***************************************************************************************/
Expand Down Expand Up @@ -1539,60 +1541,61 @@ int32 OS_IntDisable_Impl (int32 Level)

/*----------------------------------------------------------------
*
* Function: OS_HeapGetInfo_Impl
* Function: OS_IntSetMask_Impl
*
* Purpose: Implemented per internal OSAL API
* See prototype in os-impl.h for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_HeapGetInfo_Impl (OS_heap_prop_t *heap_prop)
int32 OS_IntSetMask_Impl ( uint32 MaskSetting )
{
region_information_block info;
int status;

status = malloc_info( &info );

if ( status != 0 )
{
return(OS_ERROR);
}

heap_prop->free_bytes = (uint32) info.Free.total;
heap_prop->free_blocks = (uint32) info.Free.number;
heap_prop->largest_free_block = (uint32) info.Free.largest;

return (OS_SUCCESS);
} /* end OS_HeapGetInfo_Impl */
return(OS_ERR_NOT_IMPLEMENTED);
} /* end OS_IntSetMask_Impl */


/*----------------------------------------------------------------
*
* Function: OS_IntSetMask_Impl
* Function: OS_IntGetMask_Impl
*
* Purpose: Implemented per internal OSAL API
* See prototype in os-impl.h for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_IntSetMask_Impl ( uint32 MaskSetting )
int32 OS_IntGetMask_Impl ( uint32 * MaskSettingPtr )
{
*MaskSettingPtr = 0;
return(OS_ERR_NOT_IMPLEMENTED);
} /* end OS_IntSetMask_Impl */
} /* end OS_IntGetMask_Impl */

#endif /* OSAL_OMIT_DEPRECATED */


/*----------------------------------------------------------------
*
* Function: OS_IntGetMask_Impl
* Function: OS_HeapGetInfo_Impl
*
* Purpose: Implemented per internal OSAL API
* See prototype in os-impl.h for argument/return detail
*
*-----------------------------------------------------------------*/
int32 OS_IntGetMask_Impl ( uint32 * MaskSettingPtr )
int32 OS_HeapGetInfo_Impl (OS_heap_prop_t *heap_prop)
{
*MaskSettingPtr = 0;
return(OS_ERR_NOT_IMPLEMENTED);
} /* end OS_IntGetMask_Impl */

region_information_block info;
int status;

status = malloc_info( &info );

if ( status != 0 )
{
return(OS_ERROR);
}

heap_prop->free_bytes = (uint32) info.Free.total;
heap_prop->free_blocks = (uint32) info.Free.number;
heap_prop->largest_free_block = (uint32) info.Free.largest;

return (OS_SUCCESS);
} /* end OS_HeapGetInfo_Impl */

/*----------------------------------------------------------------
*
* Function: OS_FPUExcAttachHandler_Impl
Expand Down
3 changes: 3 additions & 0 deletions src/os/shared/os-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,7 @@ int32 OS_SocketAddrGetPort_Impl(uint16 *PortNum, const OS_SockAddr_t *Addr);
------------------------------------------------------------------*/
int32 OS_SocketAddrSetPort_Impl(OS_SockAddr_t *Addr, uint16 PortNum);

#ifndef OSAL_OMIT_DEPRECATED

/****************************************************************************************
INTERRUPT API LOW-LEVEL IMPLEMENTATION FUNCTIONS
Expand Down Expand Up @@ -1866,6 +1867,8 @@ int32 OS_IntSetMask_Impl ( uint32 MaskSetting );
------------------------------------------------------------------*/
int32 OS_IntGetMask_Impl ( uint32 * MaskSettingPtr );

#endif /* OSAL_OMIT_DEPRECATED */

/****************************************************************************************
FLOATING POINT CONFIG/EXCEPTION API LOW-LEVEL IMPLEMENTATION FUNCTIONS
****************************************************************************************/
Expand Down
3 changes: 3 additions & 0 deletions src/os/shared/osapi-interrupts.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "common_types.h"
#include "os-impl.h"

#ifndef OSAL_OMIT_DEPRECATED /* Remove file and remove from build when deleted */
/* Optionally remove from sources once source selection is in cmake options */

/*----------------------------------------------------------------
*
Expand Down Expand Up @@ -135,3 +137,4 @@ int32 OS_IntGetMask ( uint32 * MaskSettingPtr )
return OS_IntGetMask_Impl(MaskSettingPtr);
} /* end OS_IntGetMask */

#endif /* OSAL_OMIT_DEPRECATED */
Loading

0 comments on commit 8f6f81d

Please sign in to comment.