From 52ee87136d915a0c10547b15a88c39a253eca8bd Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Thu, 5 Nov 2020 09:38:35 -0500 Subject: [PATCH 1/9] fix #559 Refactoring UT_SetForceFail to UT_SetDefaultReturnValue --- .../portable/src/coveragetest-bsd-select.c | 6 +-- .../portable/src/coveragetest-posix-files.c | 14 +++---- .../portable/src/coveragetest-posix-gettime.c | 4 +- .../portable/src/coveragetest-posix-io.c | 14 +++---- .../shared/src/coveragetest-binsem.c | 4 +- .../shared/src/coveragetest-common.c | 10 ++--- .../shared/src/coveragetest-countsem.c | 4 +- .../shared/src/coveragetest-file.c | 14 +++---- .../shared/src/coveragetest-filesys.c | 40 +++++++++---------- .../shared/src/coveragetest-idmap.c | 4 +- .../shared/src/coveragetest-module.c | 8 ++-- .../shared/src/coveragetest-mutex.c | 4 +- .../shared/src/coveragetest-network.c | 4 +- .../shared/src/coveragetest-printf.c | 4 +- .../shared/src/coveragetest-queue.c | 4 +- .../shared/src/coveragetest-select.c | 2 +- .../shared/src/coveragetest-sockets.c | 6 +-- .../shared/src/coveragetest-task.c | 16 ++++---- .../shared/src/coveragetest-time.c | 22 +++++----- .../shared/src/coveragetest-timebase.c | 16 ++++---- .../vxworks/src/coveragetest-binsem.c | 10 ++--- .../vxworks/src/coveragetest-common.c | 6 +-- .../vxworks/src/coveragetest-console.c | 6 +-- .../vxworks/src/coveragetest-countsem.c | 4 +- .../vxworks/src/coveragetest-dirs.c | 8 ++-- .../vxworks/src/coveragetest-filesys.c | 18 ++++----- .../vxworks/src/coveragetest-heap.c | 2 +- .../vxworks/src/coveragetest-idmap.c | 6 +-- .../vxworks/src/coveragetest-loader.c | 8 ++-- .../vxworks/src/coveragetest-mutex.c | 2 +- .../vxworks/src/coveragetest-network.c | 6 +-- .../vxworks/src/coveragetest-no-module.c | 8 ++-- .../vxworks/src/coveragetest-queues.c | 10 ++--- .../vxworks/src/coveragetest-shell.c | 2 +- .../vxworks/src/coveragetest-symtab.c | 8 ++-- .../vxworks/src/coveragetest-tasks.c | 12 +++--- .../vxworks/src/coveragetest-timebase.c | 12 +++--- ut_assert/inc/utstubs.h | 24 +++++++++-- ut_assert/src/utstubs.c | 9 ++++- 39 files changed, 193 insertions(+), 168 deletions(-) diff --git a/src/unit-test-coverage/portable/src/coveragetest-bsd-select.c b/src/unit-test-coverage/portable/src/coveragetest-bsd-select.c index 5c0c90acc..388267b8e 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-bsd-select.c +++ b/src/unit-test-coverage/portable/src/coveragetest-bsd-select.c @@ -50,7 +50,7 @@ void Test_OS_SelectSingle_Impl(void) SelectFlags = 0; OSAPI_TEST_FUNCTION_RC(OS_SelectSingle_Impl, (StreamID, &SelectFlags, 0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_select), 0); + UT_SetDefaultReturnValue(UT_KEY(OCS_select), 0); SelectFlags = OS_STREAM_STATE_READABLE | OS_STREAM_STATE_WRITABLE; nowtime.tv_sec = 1; nowtime.tv_nsec = 500000000; @@ -60,7 +60,7 @@ void Test_OS_SelectSingle_Impl(void) UT_SetDataBuffer(UT_KEY(OCS_clock_gettime), &latertime, sizeof(latertime), false); OSAPI_TEST_FUNCTION_RC(OS_SelectSingle_Impl, (StreamID, &SelectFlags, 999), OS_ERROR_TIMEOUT); - UT_SetForceFail(UT_KEY(OCS_select), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_select), -1); SelectFlags = OS_STREAM_STATE_READABLE | OS_STREAM_STATE_WRITABLE; nowtime.tv_sec = 1; nowtime.tv_nsec = 0; @@ -84,7 +84,7 @@ void Test_OS_SelectMultiple_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_SelectMultiple_Impl, (&ReadSet, &WriteSet, 0), OS_SUCCESS); memset(&ReadSet, 0xff, sizeof(ReadSet)); memset(&WriteSet, 0, sizeof(WriteSet)); - UT_SetForceFail(UT_KEY(OCS_select), 0); + UT_SetDefaultReturnValue(UT_KEY(OCS_select), 0); OSAPI_TEST_FUNCTION_RC(OS_SelectMultiple_Impl, (&ReadSet, &WriteSet, 1), OS_ERROR_TIMEOUT); } /* end OS_SelectMultiple_Impl */ diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-files.c b/src/unit-test-coverage/portable/src/coveragetest-posix-files.c index 7f1080e27..34c9fa500 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-files.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-files.c @@ -47,7 +47,7 @@ void Test_OS_FileOpen_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (0, "local", 0, -1234), OS_ERROR); /* failure mode */ - UT_SetForceFail(UT_KEY(OCS_open), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (0, "local", 0, OS_READ_ONLY), OS_ERROR); } @@ -61,7 +61,7 @@ void Test_OS_FileStat_Impl(void) struct OCS_stat RefStat; /* failure mode */ - UT_SetForceFail(UT_KEY(OCS_stat), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_stat), -1); OSAPI_TEST_FUNCTION_RC(OS_FileStat_Impl, ("local", &FileStats), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_stat)); @@ -97,17 +97,17 @@ void Test_OS_FileChmod_Impl(void) struct OCS_stat RefStat; /* failure mode 0 (open) */ - UT_SetForceFail(UT_KEY(OCS_open), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_FileChmod_Impl, ("local", OS_READ_WRITE), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_open)); /* failure mode 1 (fstat) */ - UT_SetForceFail(UT_KEY(OCS_fstat), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_fstat), -1); OSAPI_TEST_FUNCTION_RC(OS_FileChmod_Impl, ("local", OS_READ_WRITE), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_fstat)); /* failure mode 2 (fchmod) */ - UT_SetForceFail(UT_KEY(OCS_fchmod), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_fchmod), -1); OSAPI_TEST_FUNCTION_RC(OS_FileChmod_Impl, ("local", OS_READ_WRITE), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_fchmod)); @@ -142,7 +142,7 @@ void Test_OS_FileRemove_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_FileRemove_Impl, ("local"), OS_SUCCESS); /* failure mode */ - UT_SetForceFail(UT_KEY(OCS_remove), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_remove), -1); OSAPI_TEST_FUNCTION_RC(OS_FileRemove_Impl, ("local"), OS_ERROR); } @@ -155,7 +155,7 @@ void Test_OS_FileRename_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_FileRename_Impl, ("old", "new"), OS_SUCCESS); /* failure mode */ - UT_SetForceFail(UT_KEY(OCS_rename), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_rename), -1); OSAPI_TEST_FUNCTION_RC(OS_FileRename_Impl, ("old", "new"), OS_ERROR); } diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-gettime.c b/src/unit-test-coverage/portable/src/coveragetest-posix-gettime.c index dc63e8d18..8dc31a951 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-gettime.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-gettime.c @@ -40,7 +40,7 @@ void Test_OS_GetLocalTime_Impl(void) timeval.microsecs = 1; OSAPI_TEST_FUNCTION_RC(OS_GetLocalTime_Impl, (&timeval), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_clock_gettime), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_clock_gettime), -1); OSAPI_TEST_FUNCTION_RC(OS_GetLocalTime_Impl, (&timeval), OS_ERROR); } @@ -55,7 +55,7 @@ void Test_OS_SetLocalTime_Impl(void) timeval.microsecs = 1; OSAPI_TEST_FUNCTION_RC(OS_SetLocalTime_Impl, (&timeval), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_clock_settime), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_clock_settime), -1); OSAPI_TEST_FUNCTION_RC(OS_SetLocalTime_Impl, (&timeval), OS_ERROR); } diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-io.c b/src/unit-test-coverage/portable/src/coveragetest-posix-io.c index 26fdf3059..71ef6f58e 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-io.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-io.c @@ -49,7 +49,7 @@ void Test_OS_GenericClose_Impl(void) * Test path where underlying close() fails. * Should still return success. */ - UT_SetForceFail(UT_KEY(OCS_close), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_close), -1); OSAPI_TEST_FUNCTION_RC(OS_GenericClose_Impl, (0), OS_SUCCESS); } @@ -61,18 +61,18 @@ void Test_OS_GenericSeek_Impl(void) */ /* note on success this wrapper returns the result of lseek(), not OS_SUCCESS */ - UT_SetForceFail(UT_KEY(OCS_lseek), 111); + UT_SetDefaultReturnValue(UT_KEY(OCS_lseek), 111); OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_CUR), 111); - UT_SetForceFail(UT_KEY(OCS_lseek), 222); + UT_SetDefaultReturnValue(UT_KEY(OCS_lseek), 222); OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_SET), 222); - UT_SetForceFail(UT_KEY(OCS_lseek), 333); + UT_SetDefaultReturnValue(UT_KEY(OCS_lseek), 333); OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_END), 333); /* bad whence */ OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, -1234), OS_ERROR); /* generic failure of lseek() */ - UT_SetForceFail(UT_KEY(OCS_lseek), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_lseek), -1); OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_END), OS_ERROR); /* The seek implementation also checks for this specific pipe errno */ @@ -102,7 +102,7 @@ void Test_OS_GenericRead_Impl(void) UtAssert_True(UT_GetStubCount(UT_KEY(OS_SelectSingle_Impl)) == 1, "OS_SelectSingle() called"); /* read() failure */ - UT_SetForceFail(UT_KEY(OCS_read), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_read), -1); OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (0, DestData, sizeof(DestData), 0), OS_ERROR); } @@ -128,7 +128,7 @@ void Test_OS_GenericWrite_Impl(void) UtAssert_True(UT_GetStubCount(UT_KEY(OS_SelectSingle_Impl)) == 1, "OS_SelectSingle() called"); /* write() failure */ - UT_SetForceFail(UT_KEY(OCS_write), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_write), -1); OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (0, DestData, sizeof(DestData), 0), OS_ERROR); } diff --git a/src/unit-test-coverage/shared/src/coveragetest-binsem.c b/src/unit-test-coverage/shared/src/coveragetest-binsem.c index 07c605722..801821f76 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-binsem.c +++ b/src/unit-test-coverage/shared/src/coveragetest-binsem.c @@ -62,7 +62,7 @@ void Test_OS_BinSemCreate(void) OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate(NULL, NULL, 0, 0), OS_INVALID_POINTER); - UT_SetForceFail(UT_KEY(OCS_strlen), 10 + OS_MAX_API_NAME); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 10 + OS_MAX_API_NAME); OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate(&objid, "UT", 0, 0), OS_ERR_NAME_TOO_LONG); } @@ -146,7 +146,7 @@ void Test_OS_BinSemGetIdByName(void) int32 actual = ~OS_SUCCESS; osal_id_t objid; - UT_SetForceFail(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); actual = OS_BinSemGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_BinSemGetIdByName() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); diff --git a/src/unit-test-coverage/shared/src/coveragetest-common.c b/src/unit-test-coverage/shared/src/coveragetest-common.c index c200e96be..a8c3d8706 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-common.c +++ b/src/unit-test-coverage/shared/src/coveragetest-common.c @@ -108,17 +108,17 @@ void Test_OS_API_Init(void) /* other error paths */ OS_SharedGlobalVars.Initialized = false; - UT_SetForceFail(UT_KEY(OS_ObjectIdInit), -222); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdInit), -222); OSAPI_TEST_FUNCTION_RC(OS_API_Init(), -222); UT_ResetState(UT_KEY(OS_ObjectIdInit)); OS_SharedGlobalVars.Initialized = false; - UT_SetForceFail(UT_KEY(OS_API_Impl_Init), -333); + UT_SetDefaultReturnValue(UT_KEY(OS_API_Impl_Init), -333); OSAPI_TEST_FUNCTION_RC(OS_API_Init(), -333); UT_ResetState(UT_KEY(OS_API_Impl_Init)); OS_SharedGlobalVars.Initialized = false; - UT_SetForceFail(UT_KEY(OS_TaskAPI_Init), -444); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskAPI_Init), -444); OSAPI_TEST_FUNCTION_RC(OS_API_Init(), -444); UT_ResetState(UT_KEY(OS_TaskAPI_Init)); } @@ -151,7 +151,7 @@ void Test_OS_CleanUpObject(void) while (objtype < OS_OBJECT_TYPE_USER) { UT_ResetState(0); - UT_SetForceFail(UT_KEY(OS_IdentifyObject), objtype); + UT_SetDefaultReturnValue(UT_KEY(OS_IdentifyObject), objtype); switch (objtype) { @@ -195,7 +195,7 @@ void Test_OS_CleanUpObject(void) /* note the return code here is ignored - * the goal is simply to defeat the default * check that the objid was valid (it isn't) */ - UT_SetForceFail(delhandler, OS_ERROR); + UT_SetDefaultReturnValue(delhandler, OS_ERROR); OS_CleanUpObject(OS_OBJECT_ID_UNDEFINED, &ActualObjs); CallCount = UT_GetStubCount(delhandler); diff --git a/src/unit-test-coverage/shared/src/coveragetest-countsem.c b/src/unit-test-coverage/shared/src/coveragetest-countsem.c index 5afc26277..7d4767515 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-countsem.c +++ b/src/unit-test-coverage/shared/src/coveragetest-countsem.c @@ -64,7 +64,7 @@ void Test_OS_CountSemCreate(void) #endif OSAPI_TEST_FUNCTION_RC(OS_CountSemCreate(NULL, NULL, 0, 0), OS_INVALID_POINTER); - UT_SetForceFail(UT_KEY(OCS_strlen), 10 + OS_MAX_API_NAME); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 10 + OS_MAX_API_NAME); OSAPI_TEST_FUNCTION_RC(OS_CountSemCreate(&objid, "UT", 0, 0), OS_ERR_NAME_TOO_LONG); } @@ -134,7 +134,7 @@ void Test_OS_CountSemGetIdByName(void) int32 actual = ~OS_SUCCESS; osal_id_t objid; - UT_SetForceFail(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); actual = OS_CountSemGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_CountSemGetIdByName() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); diff --git a/src/unit-test-coverage/shared/src/coveragetest-file.c b/src/unit-test-coverage/shared/src/coveragetest-file.c index 74893e81a..79e02584c 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-file.c +++ b/src/unit-test-coverage/shared/src/coveragetest-file.c @@ -78,7 +78,7 @@ void Test_OS_OpenCreate(void) UtAssert_True(actual == expected, "OS_OpenCreate() (%ld) == OS_ERROR (bad flags)", (long)actual); /* Test failure to convert path */ - UT_SetForceFail(UT_KEY(OS_TranslatePath), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_ERROR); expected = OS_ERROR; actual = OS_OpenCreate(&filedes, "/cf/file", OS_FILE_FLAG_NONE, OS_READ_WRITE); UtAssert_True(actual == OS_ERROR, "OS_OpenCreate() (%ld) == OS_ERROR (bad path)", (long)actual); @@ -267,19 +267,19 @@ void Test_OS_cp(void) UtAssert_True(actual == expected, "OS_cp() (%ld) == OS_SUCCESS", (long)actual); - UT_SetForceFail(UT_KEY(OS_GenericRead_Impl), -444); + UT_SetDefaultReturnValue(UT_KEY(OS_GenericRead_Impl), -444); expected = -444; actual = OS_cp("/cf/file1", "/cf/file2"); UtAssert_True(actual == expected, "OS_cp() (%ld) == -444", (long)actual); UT_ClearForceFail(UT_KEY(OS_GenericRead_Impl)); UT_SetDataBuffer(UT_KEY(OS_GenericRead_Impl), ReadBuf, sizeof(ReadBuf), false); - UT_SetForceFail(UT_KEY(OS_GenericWrite_Impl), -555); + UT_SetDefaultReturnValue(UT_KEY(OS_GenericWrite_Impl), -555); expected = -555; actual = OS_cp("/cf/file1", "/cf/file2"); UtAssert_True(actual == expected, "OS_cp() (%ld) == -555", (long)actual); - UT_SetForceFail(UT_KEY(OS_TranslatePath), OS_INVALID_POINTER); + UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_INVALID_POINTER); expected = OS_INVALID_POINTER; actual = OS_cp("/cf/file1", "/cf/file2"); UtAssert_True(actual == expected, "OS_cp() (%ld) == OS_INVALID_POINTER", (long)actual); @@ -299,7 +299,7 @@ void Test_OS_mv(void) /* In the default case, the implementation tries to rename first. * Force rename to fail so it does a full copy and remove */ - UT_SetForceFail(UT_KEY(OS_FileRename_Impl), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_FileRename_Impl), OS_ERROR); actual = OS_mv("/cf/file1", "/cf/file2"); UtAssert_True(actual == expected, "OS_mv() (%ld) == OS_SUCCESS", (long)actual); } @@ -344,7 +344,7 @@ void Test_OS_FileOpenCheck(void) UtAssert_True(actual == expected, "OS_FileOpenCheck() (%ld) == OS_ERROR", (long)actual); OS_global_stream_table[0].active_id = UT_OBJID_1; - UT_SetForceFail(UT_KEY(OCS_strcmp), 0); + UT_SetDefaultReturnValue(UT_KEY(OCS_strcmp), 0); expected = OS_SUCCESS; actual = OS_FileOpenCheck("/cf/file"); @@ -369,7 +369,7 @@ void Test_OS_CloseFileByName(void) /* setup for success */ expected = OS_SUCCESS; OS_global_stream_table[0].active_id = UT_OBJID_1; - UT_SetForceFail(UT_KEY(OCS_strcmp), 0); + UT_SetDefaultReturnValue(UT_KEY(OCS_strcmp), 0); actual = OS_CloseFileByName("/cf/file"); UtAssert_True(actual == expected, "OS_CloseFileByName() (%ld) == OS_SUCCESS", (long)actual); diff --git a/src/unit-test-coverage/shared/src/coveragetest-filesys.c b/src/unit-test-coverage/shared/src/coveragetest-filesys.c index 528d33886..433fb0c00 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-filesys.c +++ b/src/unit-test-coverage/shared/src/coveragetest-filesys.c @@ -64,7 +64,7 @@ void Test_OS_FileSysAddFixedMap(void) OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), OS_ERR_NAME_TOO_LONG); UT_ResetState(UT_KEY(OCS_strlen)); - UT_SetForceFail(UT_KEY(OCS_strrchr), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_strrchr), -1); UT_SetDeferredRetcode(UT_KEY(OCS_strlen), 3, 2 + OS_FS_DEV_NAME_LEN); OSAPI_TEST_FUNCTION_RC(OS_FileSysAddFixedMap(&id, "/phys", "/virt"), OS_ERR_NAME_TOO_LONG); UT_ResetState(UT_KEY(OCS_strlen)); @@ -99,7 +99,7 @@ void Test_OS_mkfs(void) actual = OS_mkfs(NULL, NULL, NULL, 0, 0); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_FS_DEV_NAME_LEN); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_FS_DEV_NAME_LEN); expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_mkfs(TestBuffer, "/ramdev0", "vol", 0, 0); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); @@ -111,13 +111,13 @@ void Test_OS_mkfs(void) UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_PATH_INVALID", (long)actual); /* set up for failure due to formatting */ - UT_SetForceFail(UT_KEY(OS_FileSysFormatVolume_Impl), OS_FS_ERR_DRIVE_NOT_CREATED); + UT_SetDefaultReturnValue(UT_KEY(OS_FileSysFormatVolume_Impl), OS_FS_ERR_DRIVE_NOT_CREATED); expected = OS_FS_ERR_DRIVE_NOT_CREATED; actual = OS_mkfs(TestBuffer, "/ramdev0", "vol", 0, 0); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_DRIVE_NOT_CREATED (format failure)", (long)actual); /* set up for failure due to no free slots */ - UT_SetForceFail(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS); expected = OS_FS_ERR_DEVICE_NOT_FREE; actual = OS_mkfs(TestBuffer, "/ramdev0", "vol", 0, 0); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_DEVICE_NOT_FREE", (long)actual); @@ -136,7 +136,7 @@ void Test_OS_rmfs(void) UtAssert_True(actual == expected, "OS_rmfs() (%ld) == OS_SUCCESS", (long)actual); /* check error paths */ - UT_SetForceFail(UT_KEY(OS_ObjectIdGetByName), OS_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetByName), OS_ERR_NAME_NOT_FOUND); expected = OS_ERR_NAME_NOT_FOUND; actual = OS_rmfs("/ramdev4"); UtAssert_True(actual == expected, "OS_rmfs() (%ld) == OS_ERR_NAME_NOT_FOUND", (long)actual); @@ -146,7 +146,7 @@ void Test_OS_rmfs(void) actual = OS_rmfs(NULL); UtAssert_True(actual == expected, "OS_rmfs() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_FS_DEV_NAME_LEN); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_FS_DEV_NAME_LEN); expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_rmfs("/ramdev4"); UtAssert_True(actual == expected, "OS_rmfs() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); @@ -174,14 +174,14 @@ void Test_OS_initfs(void) actual = OS_initfs(NULL, NULL, NULL, 0, 0); UtAssert_True(actual == expected, "OS_initfs() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_FS_DEV_NAME_LEN); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_FS_DEV_NAME_LEN); expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_initfs(TestBuffer, "/ramdev0", "vol", 0, 0); UtAssert_True(actual == expected, "OS_initfs() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); UT_ClearForceFail(UT_KEY(OCS_strlen)); /* set up for failure */ - UT_SetForceFail(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS); expected = OS_FS_ERR_DEVICE_NOT_FREE; actual = OS_initfs(TestBuffer, "/ramdev0", "vol", 0, 0); UtAssert_True(actual == expected, "OS_initfs() (%ld) == OS_FS_ERR_DEVICE_NOT_FREE", (long)actual); @@ -217,7 +217,7 @@ void Test_OS_mount(void) actual = OS_mount(NULL, NULL); UtAssert_True(actual == expected, "OS_mount() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_FS_DEV_NAME_LEN); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_FS_DEV_NAME_LEN); expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_mount("/ramdev0", "/ram0"); UtAssert_True(actual == expected, "OS_mount() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); @@ -247,7 +247,7 @@ void Test_OS_unmount(void) actual = OS_unmount(NULL); UtAssert_True(actual == expected, "OS_unmount() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_MAX_PATH_LEN); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_MAX_PATH_LEN); expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_unmount("/ram0"); UtAssert_True(actual == expected, "OS_unmount() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); @@ -277,13 +277,13 @@ void Test_OS_fsBlocksFree(void) actual = OS_fsBlocksFree(NULL); UtAssert_True(actual == expected, "OS_fsBlocksFree() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_MAX_PATH_LEN); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_MAX_PATH_LEN); expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_fsBlocksFree("/cf"); UtAssert_True(actual == expected, "OS_fsBlocksFree() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); UT_ClearForceFail(UT_KEY(OCS_strlen)); - UT_SetForceFail(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); expected = OS_FS_ERR_PATH_INVALID; actual = OS_fsBlocksFree("invalid"); UtAssert_True(actual == expected, "OS_fsBlocksFree() (%ld) == OS_FS_ERR_PATH_INVALID", (long)actual); @@ -316,13 +316,13 @@ void Test_OS_fsBytesFree(void) actual = OS_fsBytesFree(NULL, NULL); UtAssert_True(actual == expected, "OS_fsBytesFree() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_MAX_PATH_LEN); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_MAX_PATH_LEN); expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_fsBytesFree("/cf", &bytes_free); UtAssert_True(actual == expected, "OS_fsBytesFree() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); UT_ClearForceFail(UT_KEY(OCS_strlen)); - UT_SetForceFail(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); expected = OS_FS_ERR_PATH_INVALID; actual = OS_fsBytesFree("invalid", &bytes_free); UtAssert_True(actual == expected, "OS_fsBytesFree() (%ld) == OS_FS_ERR_PATH_INVALID", (long)actual); @@ -346,14 +346,14 @@ void Test_OS_chkfs(void) actual = OS_chkfs(NULL, false); UtAssert_True(actual == expected, "OS_fsBytesFree() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_MAX_PATH_LEN); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_MAX_PATH_LEN); expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_chkfs("/cf", false); UtAssert_True(actual == expected, "OS_fsBytesFree() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); UT_ClearForceFail(UT_KEY(OCS_strlen)); /* Test Fail due to no matching VolTab entry */ - UT_SetForceFail(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); expected = OS_ERR_NAME_NOT_FOUND; actual = OS_chkfs("none", true); UtAssert_True(actual == expected, "OS_chkfs() (%ld) == OS_ERR_NAME_NOT_FOUND", (long)actual); @@ -371,7 +371,7 @@ void Test_OS_FS_GetPhysDriveName(void) UtAssert_True(actual == expected, "OS_FS_GetPhysDriveName() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), OS_MAX_PATH_LEN + 10); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), OS_MAX_PATH_LEN + 10); expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_FS_GetPhysDriveName(NameBuf, "none"); UtAssert_True(actual == expected, "OS_FS_GetPhysDriveName() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); @@ -388,7 +388,7 @@ void Test_OS_FS_GetPhysDriveName(void) UtAssert_True(actual == expected, "OS_FS_GetPhysDriveName() (%ld) == OS_SUCCESS", (long)actual); /* Test Fail due to no matching VolTab entry */ - UT_SetForceFail(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); expected = OS_ERR_NAME_NOT_FOUND; actual = OS_FS_GetPhysDriveName(NameBuf, "none"); UtAssert_True(actual == expected, "OS_FS_GetPhysDriveName() (%ld) == OS_ERR_NAME_NOT_FOUND", (long)actual); @@ -451,7 +451,7 @@ void Test_OS_TranslatePath(void) actual = OS_TranslatePath(NULL, NULL); UtAssert_True(actual == expected, "OS_TranslatePath(NULL,NULL) (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), OS_MAX_PATH_LEN + 10); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), OS_MAX_PATH_LEN + 10); expected = OS_FS_ERR_PATH_TOO_LONG; actual = OS_TranslatePath("/cf/test", LocalBuffer); UtAssert_True(actual == expected, "OS_TranslatePath() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); @@ -472,7 +472,7 @@ void Test_OS_TranslatePath(void) actual = OS_TranslatePath("invalid/", LocalBuffer); UtAssert_True(actual == expected, "OS_TranslatePath() (%ld) == OS_FS_ERR_PATH_INVALID", (long)actual); - UT_SetForceFail(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch), OS_ERR_NAME_NOT_FOUND); actual = OS_TranslatePath("/cf/test", LocalBuffer); UtAssert_True(actual == expected, "OS_TranslatePath() (%ld) == OS_FS_ERR_PATH_INVALID", (long)actual); UT_ClearForceFail(UT_KEY(OS_ObjectIdGetBySearch)); diff --git a/src/unit-test-coverage/shared/src/coveragetest-idmap.c b/src/unit-test-coverage/shared/src/coveragetest-idmap.c index 07fc471de..67250a778 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-idmap.c +++ b/src/unit-test-coverage/shared/src/coveragetest-idmap.c @@ -96,7 +96,7 @@ void Test_OS_LockUnlockGlobal(void) OS_Lock_Global(55555); OS_Unlock_Global(55555); - UT_SetForceFail(UT_KEY(OS_TaskGetId), 0); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId), 0); OS_Lock_Global(OS_OBJECT_TYPE_OS_BINSEM); OS_Unlock_Global(OS_OBJECT_TYPE_OS_BINSEM); } @@ -294,7 +294,7 @@ void Test_OS_ObjectIdFindByName(void) /* * Pass in a name that is beyond OS_MAX_API_NAME */ - UT_SetForceFail(UT_KEY(OCS_strlen), OS_MAX_API_NAME + 10); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), OS_MAX_API_NAME + 10); expected = OS_ERR_NAME_TOO_LONG; actual = OS_ObjectIdFindByName(OS_OBJECT_TYPE_OS_TASK, TaskName, &objid); UtAssert_True(actual == expected, "OS_ObjectFindIdByName(%s) (%ld) == OS_ERR_NAME_TOO_LONG", TaskName, diff --git a/src/unit-test-coverage/shared/src/coveragetest-module.c b/src/unit-test-coverage/shared/src/coveragetest-module.c index 7cd0146b3..62ec81860 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-module.c +++ b/src/unit-test-coverage/shared/src/coveragetest-module.c @@ -87,13 +87,13 @@ void Test_OS_ModuleLoad(void) expected = OS_INVALID_POINTER; UtAssert_True(actual == expected, "OS_ModuleLoad() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_MAX_API_NAME); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_MAX_API_NAME); actual = OS_ModuleLoad(&objid, "UTS", "File2"); expected = OS_ERR_NAME_TOO_LONG; UtAssert_True(actual == expected, "OS_ModuleLoad() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); UT_ResetState(UT_KEY(OCS_strlen)); - UT_SetForceFail(UT_KEY(OS_TranslatePath), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_ERROR); actual = OS_ModuleLoad(&objid, "UT", "FileBad"); expected = OS_ERROR; UtAssert_True(actual == expected, "OS_ModuleLoad() (%ld) == OS_ERROR", (long)actual); @@ -128,7 +128,7 @@ void Test_OS_SymbolLookup(void) UtAssert_True(actual == expected, "OS_SymbolLookup(name=%s) (%ld) == OS_SUCCESS", "uttestsym0", (long)actual); UT_ResetState(UT_KEY(OS_SymbolLookup_Impl)); - UT_SetForceFail(UT_KEY(OS_SymbolLookup_Impl), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_SymbolLookup_Impl), OS_ERROR); /* this lookup should always fail */ symaddr = 0; @@ -197,7 +197,7 @@ void Test_OS_SymbolTableDump(void) actual = OS_SymbolTableDump(NULL, 555); UtAssert_True(actual == expected, "OS_SymbolTableDump() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OS_TranslatePath), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TranslatePath), OS_ERROR); expected = OS_ERROR; actual = OS_SymbolTableDump("test", 555); UtAssert_True(actual == expected, "OS_SymbolTableDump() (%ld) == OS_ERROR", (long)actual); diff --git a/src/unit-test-coverage/shared/src/coveragetest-mutex.c b/src/unit-test-coverage/shared/src/coveragetest-mutex.c index ad13a1539..1c9d74d80 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-mutex.c +++ b/src/unit-test-coverage/shared/src/coveragetest-mutex.c @@ -61,7 +61,7 @@ void Test_OS_MutSemCreate(void) OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); OSAPI_TEST_FUNCTION_RC(OS_MutSemCreate(NULL, NULL, 0), OS_INVALID_POINTER); - UT_SetForceFail(UT_KEY(OCS_strlen), 10 + OS_MAX_API_NAME); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 10 + OS_MAX_API_NAME); OSAPI_TEST_FUNCTION_RC(OS_MutSemCreate(&objid, "UT", 0), OS_ERR_NAME_TOO_LONG); } @@ -117,7 +117,7 @@ void Test_OS_MutSemGetIdByName(void) int32 actual = ~OS_SUCCESS; osal_id_t objid; - UT_SetForceFail(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); actual = OS_MutSemGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_MutSemGetIdByName() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); diff --git a/src/unit-test-coverage/shared/src/coveragetest-network.c b/src/unit-test-coverage/shared/src/coveragetest-network.c index 871992d1f..a48a75589 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-network.c +++ b/src/unit-test-coverage/shared/src/coveragetest-network.c @@ -52,7 +52,7 @@ void Test_OS_NetworkGetHostName(void) actual = OS_NetworkGetHostName(Buffer, sizeof(Buffer)); UtAssert_True(actual == expected, "OS_NetworkGetHostName() (%ld) == OS_SUCCESS", (long)actual); - UT_SetForceFail(UT_KEY(OS_NetworkGetHostName_Impl), -4444); + UT_SetDefaultReturnValue(UT_KEY(OS_NetworkGetHostName_Impl), -4444); expected = -4444; actual = OS_NetworkGetHostName(Buffer, sizeof(Buffer)); UtAssert_True(actual == expected, "OS_NetworkGetHostName(impl error) (%ld) == -4444", (long)actual); @@ -79,7 +79,7 @@ void Test_OS_NetworkGetID(void) actual = OS_NetworkGetID(); UtAssert_True(actual == expected, "OS_NetworkGetID(nominal) (%ld) == 42", (long)actual); - UT_SetForceFail(UT_KEY(OS_NetworkGetID_Impl), -5555); + UT_SetDefaultReturnValue(UT_KEY(OS_NetworkGetID_Impl), -5555); expected = -1; actual = OS_NetworkGetID(); UtAssert_True(actual == expected, "OS_NetworkGetID(error) (%ld) == -1", (long)actual); diff --git a/src/unit-test-coverage/shared/src/coveragetest-printf.c b/src/unit-test-coverage/shared/src/coveragetest-printf.c index 8d6a888d6..c7f0fb9ac 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-printf.c +++ b/src/unit-test-coverage/shared/src/coveragetest-printf.c @@ -93,10 +93,10 @@ void Test_OS_printf(void) /* * For coverage, exercise different paths depending on the return value */ - UT_SetForceFail(UT_KEY(OCS_vsnprintf), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_vsnprintf), -1); OS_printf("UnitTest6"); - UT_SetForceFail(UT_KEY(OCS_vsnprintf), OS_BUFFER_SIZE + 10); + UT_SetDefaultReturnValue(UT_KEY(OCS_vsnprintf), OS_BUFFER_SIZE + 10); OS_printf("UnitTest7"); } diff --git a/src/unit-test-coverage/shared/src/coveragetest-queue.c b/src/unit-test-coverage/shared/src/coveragetest-queue.c index 4c8bfa89a..d7c03cc48 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-queue.c +++ b/src/unit-test-coverage/shared/src/coveragetest-queue.c @@ -65,7 +65,7 @@ void Test_OS_QueueCreate(void) actual = OS_QueueCreate(NULL, "UT", 0, 0, 0); UtAssert_True(actual == expected, "OS_QueueCreate() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_MAX_API_NAME); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_MAX_API_NAME); expected = OS_ERR_NAME_TOO_LONG; actual = OS_QueueCreate(&objid, "UT", 0, 0, 0); UtAssert_True(actual == expected, "OS_QueueCreate() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); @@ -146,7 +146,7 @@ void Test_OS_QueueGetIdByName(void) int32 actual = ~OS_SUCCESS; osal_id_t objid; - UT_SetForceFail(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); actual = OS_QueueGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_QueueGetIdByName() (%ld) == OS_SUCCESS", (long)actual); UT_ClearForceFail(UT_KEY(OS_ObjectIdFindByName)); diff --git a/src/unit-test-coverage/shared/src/coveragetest-select.c b/src/unit-test-coverage/shared/src/coveragetest-select.c index 79c43f004..bb27e6451 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-select.c +++ b/src/unit-test-coverage/shared/src/coveragetest-select.c @@ -107,7 +107,7 @@ void Test_OS_SelectFdAddClearOps(void) UtAssert_True(!OS_SelectFdIsSet(&UtSet, UT_OBJID_2), "OS_SelectFdIsSet(2) == false"); expected = -42; - UT_SetForceFail(UT_KEY(OS_ObjectIdToArrayIndex), expected); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdToArrayIndex), expected); actual = OS_SelectFdAdd(&UtSet, UT_OBJID_2); UtAssert_True(actual == expected, "OS_SelectFdAdd() (%ld) == %ld", (long)actual, (long)expected); actual = OS_SelectFdClear(&UtSet, UT_OBJID_1); diff --git a/src/unit-test-coverage/shared/src/coveragetest-sockets.c b/src/unit-test-coverage/shared/src/coveragetest-sockets.c index 13c7314a6..482a5e95a 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-sockets.c +++ b/src/unit-test-coverage/shared/src/coveragetest-sockets.c @@ -60,7 +60,7 @@ void Test_OS_CreateSocketName(void) */ OS_SockAddr_t testaddr; - UT_SetForceFail(UT_KEY(OS_SocketAddrToString_Impl), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_SocketAddrToString_Impl), OS_ERROR); OS_CreateSocketName(0, &testaddr, "ut"); /* @@ -191,7 +191,7 @@ void Test_OS_SocketAccept(void) */ OS_stream_table[1].stream_state = OS_STREAM_STATE_BOUND; expected = -1234; - UT_SetForceFail(UT_KEY(OS_SocketAccept_Impl), -1234); + UT_SetDefaultReturnValue(UT_KEY(OS_SocketAccept_Impl), -1234); actual = OS_SocketAccept(UT_OBJID_1, &connsock_id, &Addr, 0); UtAssert_True(actual == expected, "OS_SocketAccept() underlying failure (%ld) == -1234", (long)actual); } @@ -353,7 +353,7 @@ void Test_OS_SocketGetIdByName(void) int32 actual = ~OS_SUCCESS; osal_id_t objid; - UT_SetForceFail(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); actual = OS_SocketGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_SocketGetIdByName() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); diff --git a/src/unit-test-coverage/shared/src/coveragetest-task.c b/src/unit-test-coverage/shared/src/coveragetest-task.c index f1e640c6d..da9d81abb 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-task.c +++ b/src/unit-test-coverage/shared/src/coveragetest-task.c @@ -115,7 +115,7 @@ void Test_OS_TaskCreate(void) OSAPI_TEST_FUNCTION_RC(OS_TaskCreate(&objid, "UT", UT_TestHook, NULL, 0, 0, 0), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_TaskCreate(&objid, "UT", UT_TestHook, NULL, 128, 10 + OS_MAX_TASK_PRIORITY, 0), OS_ERR_INVALID_PRIORITY); - UT_SetForceFail(UT_KEY(OCS_strlen), 10 + OS_MAX_API_NAME); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 10 + OS_MAX_API_NAME); OSAPI_TEST_FUNCTION_RC(OS_TaskCreate(&objid, "UT", UT_TestHook, NULL, 128, 0, 0), OS_ERR_NAME_TOO_LONG); } @@ -135,7 +135,7 @@ void Test_OS_TaskDelete(void) UtAssert_True(actual == expected, "OS_TaskDelete() (%ld) == OS_SUCCESS", (long)actual); UtAssert_True(UT_TestHook_Count == 1, "UT_TestHook_Count (%lu) == 1", (unsigned long)UT_TestHook_Count); - UT_SetForceFail(UT_KEY(OS_TaskDelete_Impl), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete_Impl), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_TaskDelete(UT_OBJID_1), OS_ERROR); UtAssert_True(UT_TestHook_Count == 1, "UT_TestHook_Count (%lu) == 1", (unsigned long)UT_TestHook_Count); @@ -207,11 +207,11 @@ void Test_OS_TaskGetId(void) osal_id_t objid; idbuf.val = 5555; - UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), idbuf.val); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), idbuf.val); objid = OS_TaskGetId(); OSAPI_TEST_OBJID(objid, ==, idbuf.id); - UT_SetForceFail(UT_KEY(OS_ObjectIdGetById), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERROR); objid = OS_TaskGetId(); OSAPI_TEST_OBJID(objid, ==, OS_OBJECT_ID_UNDEFINED); } @@ -226,7 +226,7 @@ void Test_OS_TaskGetIdByName(void) int32 actual = ~OS_SUCCESS; osal_id_t objid = OS_OBJECT_ID_UNDEFINED; - UT_SetForceFail(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); actual = OS_TaskGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_TaskGetIdByName() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); @@ -283,7 +283,7 @@ void Test_OS_TaskInstallDeleteHandler(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; - UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), 1); actual = OS_TaskInstallDeleteHandler(UT_TestHook); UtAssert_True(actual == expected, "OS_TaskInstallDeleteHandler() (%ld) == OS_SUCCESS", (long)actual); UtAssert_True(OS_task_table[1].delete_hook_pointer == UT_TestHook, @@ -325,14 +325,14 @@ void Test_OS_TaskFindIdBySystemData(void) actual = OS_TaskFindIdBySystemData(NULL, &test_sysdata, sizeof(test_sysdata)); UtAssert_True(actual == expected, "OS_TaskFindIdBySystemData() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OS_TaskValidateSystemData_Impl), expected); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskValidateSystemData_Impl), expected); actual = OS_TaskFindIdBySystemData(&task_id, &test_sysdata, sizeof(test_sysdata)); UtAssert_True(actual == expected, "OS_TaskFindIdBySystemData() (%ld) == OS_INVALID_POINTER", (long)actual); UT_ClearForceFail(UT_KEY(OS_TaskValidateSystemData_Impl)); /* Test search failure */ expected = OS_ERR_NAME_NOT_FOUND; - UT_SetForceFail(UT_KEY(OS_ObjectIdGetBySearch), expected); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetBySearch), expected); actual = OS_TaskFindIdBySystemData(&task_id, &test_sysdata, sizeof(test_sysdata)); UtAssert_True(actual == expected, "OS_TaskFindIdBySystemData() (%ld) == OS_ERR_NAME_NOT_FOUND", (long)actual); UT_ClearForceFail(UT_KEY(OS_ObjectIdGetBySearch)); diff --git a/src/unit-test-coverage/shared/src/coveragetest-time.c b/src/unit-test-coverage/shared/src/coveragetest-time.c index d62a28fb1..391c3acbc 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-time.c +++ b/src/unit-test-coverage/shared/src/coveragetest-time.c @@ -81,7 +81,7 @@ void Test_OS_TimerAdd(void) actual = OS_TimerAdd(NULL, "UT", UT_OBJID_1, UT_TimerArgCallback, &arg); UtAssert_True(actual == expected, "OS_TimerAdd() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_MAX_API_NAME); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_MAX_API_NAME); expected = OS_ERR_NAME_TOO_LONG; actual = OS_TimerAdd(&objid, "UT", UT_OBJID_1, UT_TimerArgCallback, &arg); UtAssert_True(actual == expected, "OS_TimerAdd() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); @@ -91,19 +91,19 @@ void Test_OS_TimerAdd(void) actual = OS_TimerAdd(&objid, "UT", UT_OBJID_1, NULL, &arg); UtAssert_True(actual == expected, "OS_TimerAdd() (%ld) == OS_TIMER_ERR_INVALID_ARGS", (long)actual); - UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimerAdd(&objid, "UT", UT_OBJID_1, UT_TimerArgCallback, &arg); UtAssert_True(actual == expected, "OS_TimerAdd() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); UT_ClearForceFail(UT_KEY(OS_TaskGetId_Impl)); - UT_SetForceFail(UT_KEY(OS_ObjectIdGetById), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERROR); expected = OS_ERROR; actual = OS_TimerAdd(&objid, "UT", UT_OBJID_1, UT_TimerArgCallback, &arg); UtAssert_True(actual == expected, "OS_TimerAdd() (%ld) == OS_ERROR", (long)actual); UT_ClearForceFail(UT_KEY(OS_ObjectIdGetById)); - UT_SetForceFail(UT_KEY(OS_ObjectIdAllocateNew), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdAllocateNew), OS_ERROR); expected = OS_ERROR; actual = OS_TimerAdd(&objid, "UT", UT_OBJID_1, UT_TimerArgCallback, &arg); UtAssert_True(actual == expected, "OS_TimerAdd() (%ld) == OS_ERROR", (long)actual); @@ -143,13 +143,13 @@ void Test_OS_TimerCreate(void) actual = OS_TimerCreate(&objid, "UT", &accuracy, NULL); UtAssert_True(actual == expected, "OS_TimerSet() (%ld) == OS_TIMER_ERR_INVALID_ARGS", (long)actual); - UT_SetForceFail(UT_KEY(OS_TimeBaseCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_TimeBaseCreate), OS_ERROR); expected = OS_ERROR; actual = OS_TimerCreate(&objid, "UT", &accuracy, UT_TimerCallback); UtAssert_True(actual == expected, "OS_TimerCreate() (%ld) == OS_ERROR", (long)actual); UT_ClearForceFail(UT_KEY(OS_TimeBaseCreate)); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_MAX_API_NAME); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_MAX_API_NAME); expected = OS_ERR_NAME_TOO_LONG; actual = OS_TimerCreate(&objid, "UT", &accuracy, UT_TimerCallback); UtAssert_True(actual == expected, "OS_TimerCreate() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); @@ -181,7 +181,7 @@ void Test_OS_TimerSet(void) actual = OS_TimerSet(UT_OBJID_2, UINT32_MAX, UINT32_MAX); UtAssert_True(actual == expected, "OS_TimerSet() (%ld) == OS_TIMER_ERR_INVALID_ARGS", (long)actual); - UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimerSet(UT_OBJID_2, 0, 1); UtAssert_True(actual == expected, "OS_TimerSet() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); @@ -223,7 +223,7 @@ void Test_OS_TimerDelete(void) memset(OS_timecb_table, 0, sizeof(OS_timecb_table)); memset(OS_timebase_table, 0, sizeof(OS_timebase_table)); - UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimerDelete(UT_OBJID_2); UtAssert_True(actual == expected, "OS_TimerDelete() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); @@ -240,7 +240,7 @@ void Test_OS_TimerGetIdByName(void) int32 actual = ~OS_SUCCESS; osal_id_t objid; - UT_SetForceFail(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); actual = OS_TimerGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_TimerGetIdByName() (%ld) == OS_SUCCESS", (long)actual); UT_ClearForceFail(UT_KEY(OS_ObjectIdFindByName)); @@ -253,7 +253,7 @@ void Test_OS_TimerGetIdByName(void) actual = OS_TimerGetIdByName(NULL, "NF"); UtAssert_True(actual == expected, "OS_TimerGetIdByName() (%ld) == %ld", (long)actual, (long)expected); - UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimerGetIdByName(&objid, "NF"); UtAssert_True(actual == expected, "OS_TimerGetIdByName() (%ld) == %ld", (long)actual, (long)expected); @@ -293,7 +293,7 @@ void Test_OS_TimerGetInfo(void) actual = OS_TimerGetInfo(UT_OBJID_1, NULL); UtAssert_True(actual == expected, "OS_TimerGetInfo() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimerGetInfo(UT_OBJID_1, &timer_prop); UtAssert_True(actual == expected, "OS_TimerGetInfo() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); diff --git a/src/unit-test-coverage/shared/src/coveragetest-timebase.c b/src/unit-test-coverage/shared/src/coveragetest-timebase.c index 9484cb9c0..bf37a52cd 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-timebase.c +++ b/src/unit-test-coverage/shared/src/coveragetest-timebase.c @@ -99,13 +99,13 @@ void Test_OS_TimeBaseCreate(void) actual = OS_TimeBaseCreate(NULL, NULL, NULL); UtAssert_True(actual == expected, "OS_TimeBaseCreate() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_MAX_API_NAME); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), 2 + OS_MAX_API_NAME); expected = OS_ERR_NAME_TOO_LONG; actual = OS_TimeBaseCreate(&objid, "UT", UT_TimerSync); UtAssert_True(actual == expected, "OS_TimeBaseCreate() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); UT_ClearForceFail(UT_KEY(OCS_strlen)); - UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimeBaseCreate(&objid, "UT", UT_TimerSync); UtAssert_True(actual == expected, "OS_TimeBaseCreate() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); @@ -128,7 +128,7 @@ void Test_OS_TimeBaseSet(void) UtAssert_True(actual == expected, "OS_TimeBaseSet() (%ld) == OS_TIMER_ERR_INVALID_ARGS", (long)actual); /* test error paths */ - UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimeBaseSet(UT_OBJID_1, 1000, 1000); UtAssert_True(actual == expected, "OS_TimeBaseSet() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); @@ -146,7 +146,7 @@ void Test_OS_TimeBaseDelete(void) UtAssert_True(actual == expected, "OS_TimeBaseDelete() (%ld) == OS_SUCCESS", (long)actual); /* test error paths */ - UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimeBaseDelete(UT_OBJID_1); UtAssert_True(actual == expected, "OS_TimeBaseDelete() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); @@ -162,7 +162,7 @@ void Test_OS_TimeBaseGetIdByName(void) int32 actual = ~OS_SUCCESS; osal_id_t objid; - UT_SetForceFail(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdFindByName), OS_SUCCESS); actual = OS_TimeBaseGetIdByName(&objid, "UT"); UtAssert_True(actual == expected, "OS_TimeBaseGetIdByName() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); @@ -177,7 +177,7 @@ void Test_OS_TimeBaseGetIdByName(void) actual = OS_TimeBaseGetIdByName(NULL, NULL); UtAssert_True(actual == expected, "OS_TimeBaseGetIdByName() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimeBaseGetIdByName(&objid, "NF"); UtAssert_True(actual == expected, "OS_TimeBaseGetIdByName() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); @@ -222,7 +222,7 @@ void Test_OS_TimeBaseGetInfo(void) actual = OS_TimeBaseGetInfo(UT_OBJID_1, NULL); UtAssert_True(actual == expected, "OS_TimeBaseGetInfo() (%ld) == OS_INVALID_POINTER", (long)actual); - UT_SetForceFail(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); + UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId_Impl), 1 | (OS_OBJECT_TYPE_OS_TIMEBASE << OS_OBJECT_TYPE_SHIFT)); expected = OS_ERR_INCORRECT_OBJ_STATE; actual = OS_TimeBaseGetInfo(UT_OBJID_1, &timebase_prop); UtAssert_True(actual == expected, "OS_TimeBaseGetInfo() (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); @@ -281,7 +281,7 @@ void Test_OS_TimeBase_CallbackThread(void) /* Check that the TimeCB function was called */ UtAssert_True(TimeCB > 0, "TimeCB (%lu) > 0", (unsigned long)TimeCB); - UT_SetForceFail(UT_KEY(OS_ObjectIdGetById), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdGetById), OS_ERROR); OS_TimeBase_CallbackThread(UT_OBJID_2); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-binsem.c b/src/unit-test-coverage/vxworks/src/coveragetest-binsem.c index 931f7f37d..715704301 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-binsem.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-binsem.c @@ -52,7 +52,7 @@ void Test_OS_BinSemCreate_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate_Impl(0, 0, 0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_semBInitialize), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_semBInitialize), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate_Impl(0, 0, 0), OS_SEM_FAILURE); } @@ -73,7 +73,7 @@ void Test_OS_BinSemGive_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_BinSemGive_Impl(0), OS_SUCCESS); - UT_SetForceFail(UT_StubKey_GenericSemGive, OS_SEM_FAILURE); + UT_SetDefaultReturnValue(UT_StubKey_GenericSemGive, OS_SEM_FAILURE); OSAPI_TEST_FUNCTION_RC(OS_BinSemGive_Impl(0), OS_SEM_FAILURE); } @@ -85,7 +85,7 @@ void Test_OS_BinSemFlush_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_BinSemFlush_Impl(0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_semFlush), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_semFlush), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_BinSemFlush_Impl(0), OS_SEM_FAILURE); } @@ -106,10 +106,10 @@ void Test_OS_BinSemTimedWait_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_BinSemTimedWait_Impl(0, 100), OS_SUCCESS); - UT_SetForceFail(UT_StubKey_GenericSemTake, OS_SEM_FAILURE); + UT_SetDefaultReturnValue(UT_StubKey_GenericSemTake, OS_SEM_FAILURE); OSAPI_TEST_FUNCTION_RC(OS_BinSemTimedWait_Impl(0, 100), OS_SEM_FAILURE); - UT_SetForceFail(UT_KEY(OS_Milli2Ticks), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_Milli2Ticks), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_BinSemTimedWait_Impl(0, 100), OS_ERROR); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-common.c b/src/unit-test-coverage/vxworks/src/coveragetest-common.c index 874ac2ae7..e8737479d 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-common.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-common.c @@ -42,7 +42,7 @@ void Test_OS_API_Impl_Init(void) * int32 OS_API_Impl_Init(uint32 idtype) */ OSAPI_TEST_FUNCTION_RC(OS_API_Impl_Init(0), OS_SUCCESS); - UT_SetForceFail(UT_StubKey_OS_VxWorks_TableMutex_Init, OS_ERROR); + UT_SetDefaultReturnValue(UT_StubKey_OS_VxWorks_TableMutex_Init, OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_API_Impl_Init(OS_OBJECT_TYPE_OS_TASK), OS_ERROR); UT_ClearForceFail(UT_StubKey_OS_VxWorks_TableMutex_Init); OSAPI_TEST_FUNCTION_RC(OS_API_Impl_Init(OS_OBJECT_TYPE_OS_TASK), OS_SUCCESS); @@ -85,7 +85,7 @@ void Test_OS_VxWorks_GenericSemGive(void) OCS_SEM_ID SemID = NULL; OSAPI_TEST_FUNCTION_RC(OS_VxWorks_GenericSemGive(SemID), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_semGive), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_semGive), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_VxWorks_GenericSemGive(SemID), OS_SEM_FAILURE); } /* end OS_VxWorks_GenericSemGive */ @@ -98,7 +98,7 @@ void Test_OS_VxWorks_GenericSemTake(void) OCS_SEM_ID SemID = NULL; OSAPI_TEST_FUNCTION_RC(OS_VxWorks_GenericSemTake(SemID, 10), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_semTake), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_semTake), OCS_ERROR); OCS_errno = OCS_S_objLib_OBJ_TIMEOUT; OSAPI_TEST_FUNCTION_RC(OS_VxWorks_GenericSemTake(SemID, 0), OS_SEM_TIMEOUT); OCS_errno = OCS_S_objLib_OBJ_ID_ERROR; diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-console.c b/src/unit-test-coverage/vxworks/src/coveragetest-console.c index c39910841..f3a358f32 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-console.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-console.c @@ -47,7 +47,7 @@ void Test_OS_ConsoleWakeup_Impl(void) OS_ConsoleWakeup_Impl(0); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_semGive)) == 1, "semGive() called in async mode"); - UT_SetForceFail(UT_KEY(OCS_semGive), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_semGive), -1); OS_ConsoleWakeup_Impl(0); UT_ConsoleTest_SetConsoleAsync(0, false); @@ -61,11 +61,11 @@ void Test_OS_ConsoleCreate_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_ConsoleCreate_Impl(0), OS_SUCCESS); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_taskSpawn)) == 1, "taskSpawn() called"); - UT_SetForceFail(UT_KEY(OCS_semCInitialize), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_semCInitialize), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ConsoleCreate_Impl(0), OS_SEM_FAILURE); UT_ClearForceFail(UT_KEY(OCS_semCInitialize)); - UT_SetForceFail(UT_KEY(OCS_taskSpawn), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_taskSpawn), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ConsoleCreate_Impl(0), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_taskSpawn)); diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-countsem.c b/src/unit-test-coverage/vxworks/src/coveragetest-countsem.c index f29a015c4..8773d065e 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-countsem.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-countsem.c @@ -48,7 +48,7 @@ void Test_OS_CountSemCreate_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_CountSemCreate_Impl(0, 0, 0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_semCInitialize), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_semCInitialize), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_CountSemCreate_Impl(0, 0, 0), OS_SEM_FAILURE); } @@ -87,7 +87,7 @@ void Test_OS_CountSemTimedWait_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_CountSemTimedWait_Impl(0, 100), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OS_Milli2Ticks), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_Milli2Ticks), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_CountSemTimedWait_Impl(0, 100), OS_ERROR); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-dirs.c b/src/unit-test-coverage/vxworks/src/coveragetest-dirs.c index f896cb598..0251f01be 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-dirs.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-dirs.c @@ -53,7 +53,7 @@ void Test_OS_DirCreate_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_DirCreate_Impl("dir", 0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_mkdir), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_mkdir), -1); OSAPI_TEST_FUNCTION_RC(OS_DirCreate_Impl("dir", 0), OS_ERROR); } @@ -64,7 +64,7 @@ void Test_OS_DirOpen_Impl(void) * int32 OS_DirOpen_Impl(uint32 local_id, const char *local_path) */ OSAPI_TEST_FUNCTION_RC(OS_DirOpen_Impl(0, "dir"), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_opendir), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_opendir), -1); OSAPI_TEST_FUNCTION_RC(OS_DirOpen_Impl(0, "dir"), OS_ERROR); } @@ -87,7 +87,7 @@ void Test_OS_DirRead_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_DirRead_Impl(0, &dirent_buff), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_readdir), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_readdir), -1); OSAPI_TEST_FUNCTION_RC(OS_DirRead_Impl(0, &dirent_buff), OS_ERROR); } @@ -108,7 +108,7 @@ void Test_OS_DirRemove_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_DirRemove_Impl("dir"), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_rmdir), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_rmdir), -1); OSAPI_TEST_FUNCTION_RC(OS_DirRemove_Impl("dir"), OS_ERROR); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-filesys.c b/src/unit-test-coverage/vxworks/src/coveragetest-filesys.c index 6cdf934ec..f10632e2b 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-filesys.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-filesys.c @@ -70,11 +70,11 @@ void Test_OS_FileSysStartVolume_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_FileSysStartVolume_Impl(2), expected); /* Failure to create XBD layer */ - UT_SetForceFail(UT_KEY(OCS_xbdBlkDevCreateSync), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_xbdBlkDevCreateSync), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysStartVolume_Impl(1), OS_FS_ERR_DRIVE_NOT_CREATED); /* Failure to create low level block dev */ - UT_SetForceFail(UT_KEY(OCS_ramDevCreate), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_ramDevCreate), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysStartVolume_Impl(1), OS_FS_ERR_DRIVE_NOT_CREATED); } @@ -110,7 +110,7 @@ void Test_OS_FileSysFormatVolume_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_FileSysFormatVolume_Impl(0), OS_SUCCESS); /* Failure of the dosFsVolFormat() call */ - UT_SetForceFail(UT_KEY(OCS_dosFsVolFormat), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_dosFsVolFormat), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysFormatVolume_Impl(0), OS_FS_ERR_DRIVE_NOT_CREATED); } @@ -122,7 +122,7 @@ void Test_OS_FileSysMountVolume_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_FileSysMountVolume_Impl(0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_open), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysMountVolume_Impl(0), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_open)); } @@ -135,11 +135,11 @@ void Test_OS_FileSysUnmountVolume_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_FileSysUnmountVolume_Impl(0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_open), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysUnmountVolume_Impl(0), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_open)); - UT_SetForceFail(UT_KEY(OCS_ioctl), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_ioctl), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysUnmountVolume_Impl(0), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_ioctl)); } @@ -153,7 +153,7 @@ void Test_OS_FileSysStatVolume_Impl(void) OS_statvfs_t stat; OSAPI_TEST_FUNCTION_RC(OS_FileSysStatVolume_Impl(0, &stat), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_statvfs), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_statvfs), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysStatVolume_Impl(0, &stat), OS_ERROR); } @@ -165,11 +165,11 @@ void Test_OS_FileSysCheckVolume_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_FileSysCheckVolume_Impl(0, true), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_open), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysCheckVolume_Impl(0, false), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_open)); - UT_SetForceFail(UT_KEY(OCS_ioctl), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_ioctl), -1); OSAPI_TEST_FUNCTION_RC(OS_FileSysCheckVolume_Impl(0, false), OS_ERROR); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-heap.c b/src/unit-test-coverage/vxworks/src/coveragetest-heap.c index 10d68a79a..06b04b7a5 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-heap.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-heap.c @@ -40,7 +40,7 @@ void Test_OS_HeapGetInfo_Impl(void) memset(&heap_prop, 0xEE, sizeof(heap_prop)); OSAPI_TEST_FUNCTION_RC(OS_HeapGetInfo_Impl(&heap_prop), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_memPartInfoGet), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_memPartInfoGet), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_HeapGetInfo_Impl(&heap_prop), OS_ERROR); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-idmap.c b/src/unit-test-coverage/vxworks/src/coveragetest-idmap.c index 124f7d322..89f140b4c 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-idmap.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-idmap.c @@ -55,7 +55,7 @@ void Test_OS_Lock_Global_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_Lock_Global_Impl(OS_OBJECT_TYPE_OS_TASK), OS_SUCCESS); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_semTake)) == 1, "semTake() called"); - UT_SetForceFail(UT_KEY(OCS_semTake), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_semTake), -1); OSAPI_TEST_FUNCTION_RC(OS_Lock_Global_Impl(OS_OBJECT_TYPE_OS_TASK), OS_ERROR); } @@ -68,7 +68,7 @@ void Test_OS_Unlock_Global_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_Unlock_Global_Impl(10000), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_Unlock_Global_Impl(0), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_Unlock_Global_Impl(OS_OBJECT_TYPE_OS_TASK), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_semGive), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_semGive), -1); OSAPI_TEST_FUNCTION_RC(OS_Unlock_Global_Impl(OS_OBJECT_TYPE_OS_TASK), OS_ERROR); } @@ -79,7 +79,7 @@ void Test_OS_API_Impl_Init(void) * int32 OS_API_Impl_Init(uint32 idtype) */ OSAPI_TEST_FUNCTION_RC(UT_Call_OS_VxWorks_TableMutex_Init(0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_semMInitialize), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_semMInitialize), -1); OSAPI_TEST_FUNCTION_RC(UT_Call_OS_VxWorks_TableMutex_Init(OS_OBJECT_TYPE_OS_TASK), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_semMInitialize)); OSAPI_TEST_FUNCTION_RC(UT_Call_OS_VxWorks_TableMutex_Init(OS_OBJECT_TYPE_OS_TASK), OS_SUCCESS); diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-loader.c b/src/unit-test-coverage/vxworks/src/coveragetest-loader.c index 4fede680c..1a1c1171c 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-loader.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-loader.c @@ -51,10 +51,10 @@ void Test_OS_ModuleLoad_Impl(void) * int32 OS_ModuleLoad_Impl ( uint32 module_id, char *translated_path ) */ OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(0, "local"), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_open), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(0, "local"), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_open)); - UT_SetForceFail(UT_KEY(OCS_loadModule), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_loadModule), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(0, "local"), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_loadModule)); } @@ -65,7 +65,7 @@ void Test_OS_ModuleUnload_Impl(void) * int32 OS_ModuleUnload_Impl ( uint32 module_id ) */ OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl(0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_unldByModuleId), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_unldByModuleId), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl(0), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_unldByModuleId)); } @@ -86,7 +86,7 @@ void Test_OS_ModuleGetInfo_Impl(void) * but the boolean in the output struct should be false. */ memset(&module_prop, 0, sizeof(module_prop)); - UT_SetForceFail(UT_KEY(OCS_moduleInfoGet), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_moduleInfoGet), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleGetInfo_Impl(0, &module_prop), OS_SUCCESS); UT_ClearForceFail(UT_KEY(OCS_moduleInfoGet)); UtAssert_True(!module_prop.addr.valid, "addresses in output not valid"); diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-mutex.c b/src/unit-test-coverage/vxworks/src/coveragetest-mutex.c index bceac85b3..993d8c1b8 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-mutex.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-mutex.c @@ -45,7 +45,7 @@ void Test_OS_MutSemCreate_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_MutSemCreate_Impl(0, 0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_semMInitialize), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_semMInitialize), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_MutSemCreate_Impl(0, 0), OS_SEM_FAILURE); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-network.c b/src/unit-test-coverage/vxworks/src/coveragetest-network.c index e196dc5cc..e241c74f2 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-network.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-network.c @@ -49,7 +49,7 @@ void Test_OS_NetworkGetHostName_Impl(void) char buffer[16]; OSAPI_TEST_FUNCTION_RC(OS_NetworkGetHostName_Impl(buffer, sizeof(buffer)), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_gethostname), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_gethostname), -1); OSAPI_TEST_FUNCTION_RC(OS_NetworkGetHostName_Impl(buffer, sizeof(buffer)), OS_ERROR); } /* end OS_NetworkGetHostName_Impl */ @@ -63,10 +63,10 @@ void Test_OS_NetworkGetID_Impl(void) */ int32 IdBuf; - UT_SetForceFail(UT_KEY(OCS_hostGetByName), 1234); + UT_SetDefaultReturnValue(UT_KEY(OCS_hostGetByName), 1234); OSAPI_TEST_FUNCTION_RC(OS_NetworkGetID_Impl(&IdBuf), OS_SUCCESS); UtAssert_True(IdBuf == 1234, "IdBuf (%ld) == 1234", (long)IdBuf); - UT_SetForceFail(UT_KEY(OCS_hostGetByName), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_hostGetByName), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_NetworkGetID_Impl(&IdBuf), OS_ERROR); } /* end OS_NetworkGetID_Impl */ diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-no-module.c b/src/unit-test-coverage/vxworks/src/coveragetest-no-module.c index 7983ad49e..ed9b3083d 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-no-module.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-no-module.c @@ -49,10 +49,10 @@ void Test_OS_ModuleLoad_Impl(void) * int32 OS_ModuleLoad_Impl ( uint32 module_id, char *translated_path ) */ OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(0, "local"), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_open), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(0, "local"), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_open)); - UT_SetForceFail(UT_KEY(OCS_loadModule), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_loadModule), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(0, "local"), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_loadModule)); } @@ -63,7 +63,7 @@ void Test_OS_ModuleUnload_Impl(void) * int32 OS_ModuleUnload_Impl ( uint32 module_id ) */ OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl(0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_unldByModuleId), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_unldByModuleId), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl(0), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_unldByModuleId)); } @@ -84,7 +84,7 @@ void Test_OS_ModuleGetInfo_Impl(void) * but the boolean in the output struct should be false. */ memset(&module_prop, 0, sizeof(module_prop)); - UT_SetForceFail(UT_KEY(OCS_moduleInfoGet), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_moduleInfoGet), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleGetInfo_Impl(0, &module_prop), OS_SUCCESS); UT_ClearForceFail(UT_KEY(OCS_moduleInfoGet)); UtAssert_True(!module_prop.addr.valid, "addresses in output not valid"); diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-queues.c b/src/unit-test-coverage/vxworks/src/coveragetest-queues.c index 7c059a148..1d1311142 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-queues.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-queues.c @@ -49,7 +49,7 @@ void Test_OS_QueueCreate_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_QueueCreate_Impl(0, 0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_msgQCreate), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_msgQCreate), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_QueueCreate_Impl(0, 0), OS_ERROR); } @@ -61,7 +61,7 @@ void Test_OS_QueueDelete_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_QueueDelete_Impl(0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_msgQDelete), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_msgQDelete), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_QueueDelete_Impl(0), OS_ERROR); } @@ -78,10 +78,10 @@ void Test_OS_QueueGet_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(0, &Data, sizeof(Data), &ActSz, OS_CHECK), OS_SUCCESS); OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(0, &Data, sizeof(Data), &ActSz, 100), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OS_Milli2Ticks), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_Milli2Ticks), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(0, &Data, sizeof(Data), &ActSz, 100), OS_ERROR); - UT_SetForceFail(UT_KEY(OCS_msgQReceive), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_msgQReceive), OCS_ERROR); OCS_errno = OCS_S_objLib_OBJ_TIMEOUT; OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(0, &Data, sizeof(Data), &ActSz, OS_CHECK), OS_QUEUE_TIMEOUT); OCS_errno = OCS_S_objLib_OBJ_UNAVAILABLE; @@ -99,7 +99,7 @@ void Test_OS_QueuePut_Impl(void) char Data[16] = "Test"; OSAPI_TEST_FUNCTION_RC(OS_QueuePut_Impl(0, Data, sizeof(Data), 0), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_msgQSend), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_msgQSend), OCS_ERROR); OCS_errno = OCS_S_objLib_OBJ_UNAVAILABLE; OSAPI_TEST_FUNCTION_RC(OS_QueuePut_Impl(0, Data, sizeof(Data), 0), OS_QUEUE_FULL); OCS_errno = 0; diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-shell.c b/src/unit-test-coverage/vxworks/src/coveragetest-shell.c index af2897453..ea0110f41 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-shell.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-shell.c @@ -53,7 +53,7 @@ void Test_OS_ShellOutputToFile_Impl(void) UtAssert_True(UT_GetStubCount(UT_KEY(OCS_shellGenericInit)) == 1, "shellGenericInit() called"); /* failure to open the output file */ - UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); expected = OS_ERROR; actual = OS_ShellOutputToFile_Impl(0, "TestCmd"); UtAssert_True(actual == expected, "OS_ShellOutputToFile_Impl() (%ld) == OS_ERROR", (long)actual); diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c b/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c index 890fd480d..3e729ed60 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c @@ -41,7 +41,7 @@ void Test_OS_SymbolLookup_Impl(void) cpuaddr SymAddr; OSAPI_TEST_FUNCTION_RC(OS_SymbolLookup_Impl(&SymAddr, "symname"), OS_SUCCESS); OSAPI_TEST_FUNCTION_RC(OS_SymbolLookup_Impl(NULL, NULL), OS_INVALID_POINTER); - UT_SetForceFail(UT_KEY(OCS_symFind), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_symFind), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_SymbolLookup_Impl(&SymAddr, "symname"), OS_ERROR); } @@ -54,10 +54,10 @@ void Test_OS_SymTableIterator_Impl(void) OSAPI_TEST_FUNCTION_RC(UT_SymTabTest_CallIteratorFunc("ut", &Data, 100, 1000), true); OSAPI_TEST_FUNCTION_RC(UT_SymTabTest_CallIteratorFunc("ut", &Data, 100, 101), false); - UT_SetForceFail(UT_KEY(OCS_strlen), OS_MAX_SYM_LEN + 10); + UT_SetDefaultReturnValue(UT_KEY(OCS_strlen), OS_MAX_SYM_LEN + 10); OSAPI_TEST_FUNCTION_RC(UT_SymTabTest_CallIteratorFunc("ut", &Data, 100, 1000), false); UT_ClearForceFail(UT_KEY(OCS_strlen)); - UT_SetForceFail(UT_KEY(OCS_write), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_write), -1); OSAPI_TEST_FUNCTION_RC(UT_SymTabTest_CallIteratorFunc("ut", &Data, 100, 1000), false); UT_ClearForceFail(UT_KEY(OCS_write)); } @@ -68,7 +68,7 @@ void Test_OS_SymbolTableDump_Impl(void) * int32 OS_SymbolTableDump_Impl ( const char *filename, uint32 SizeLimit ) */ OSAPI_TEST_FUNCTION_RC(OS_SymbolTableDump_Impl("file", 10000), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_open), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_SymbolTableDump_Impl("file", 10000), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_open)); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c b/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c index 0fd7b96ab..720f5edeb 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c @@ -70,7 +70,7 @@ void Test_OS_TaskCreate_Impl(void) /* create task with stack size of 250 - this should invoke malloc() to get the stack. * The first call checks the failure path and ensures that a malloc failure gets handled */ OS_task_table[0].stack_size = 250; - UT_SetForceFail(UT_KEY(OCS_malloc), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_malloc), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(0, 0), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_malloc)); @@ -97,7 +97,7 @@ void Test_OS_TaskCreate_Impl(void) UtAssert_True(UT_GetStubCount(UT_KEY(OCS_taskActivate)) == 3, "taskActivate() called"); /* other failure modes */ - UT_SetForceFail(UT_KEY(OCS_taskInit), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_taskInit), -1); OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(0, 0), OS_ERROR); } @@ -122,7 +122,7 @@ void Test_OS_TaskDelete_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_TaskDelete_Impl(0), OS_SUCCESS); /* failure mode */ - UT_SetForceFail(UT_KEY(OCS_taskDelete), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_taskDelete), -1); OSAPI_TEST_FUNCTION_RC(OS_TaskDelete_Impl(0), OS_ERROR); } @@ -144,10 +144,10 @@ void Test_OS_TaskDelay_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_TaskDelay_Impl(100), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_taskDelay), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_taskDelay), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_TaskDelay_Impl(100), OS_ERROR); - UT_SetForceFail(UT_KEY(OS_Milli2Ticks), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OS_Milli2Ticks), OS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_TaskDelay_Impl(100), OS_ERROR); } @@ -159,7 +159,7 @@ void Test_OS_TaskSetPriority_Impl(void) */ OSAPI_TEST_FUNCTION_RC(OS_TaskSetPriority_Impl(0, 100), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_taskPrioritySet), OCS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_taskPrioritySet), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_TaskSetPriority_Impl(0, 100), OS_ERROR); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c b/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c index 92ad9198a..4e3fed283 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c @@ -41,7 +41,7 @@ void Test_OS_VxWorks_TimeBaseAPI_Impl_Init(void) * int32 OS_VxWorks_TimeBaseAPI_Impl_Init(void) */ OSAPI_TEST_FUNCTION_RC(UT_Call_OS_VxWorks_TimeBaseAPI_Impl_Init(), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_sysClkRateGet), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_sysClkRateGet), -1); OSAPI_TEST_FUNCTION_RC(UT_Call_OS_VxWorks_TimeBaseAPI_Impl_Init(), OS_ERROR); } @@ -110,17 +110,17 @@ void Test_OS_TimeBaseCreate_Impl(void) memset(&id, 0x01, sizeof(id)); OS_global_timebase_table[1].active_id = id; UT_TimeBaseTest_Setup(1, OCS_SIGRTMIN, false); - UT_SetForceFail(UT_KEY(OCS_sigismember), true); + UT_SetDefaultReturnValue(UT_KEY(OCS_sigismember), true); OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(0), OS_TIMER_ERR_UNAVAILABLE); UT_ResetState(UT_KEY(OCS_sigismember)); /* fail to initialize the sem */ - UT_SetForceFail(UT_KEY(OCS_semMInitialize), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_semMInitialize), -1); OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(0), OS_TIMER_ERR_INTERNAL); UT_ClearForceFail(UT_KEY(OCS_semMInitialize)); /* fail to spawn the task */ - UT_SetForceFail(UT_KEY(OCS_taskSpawn), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_taskSpawn), -1); OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(0), OS_TIMER_ERR_INTERNAL); UT_ClearForceFail(UT_KEY(OCS_taskSpawn)); @@ -152,7 +152,7 @@ void Test_OS_TimeBaseCreate_Impl(void) UtAssert_True(UT_TimeBaseTest_CheckTimeBaseRegisteredState(0), "timer successfully registered"); UT_TimeBaseTest_ClearTimeBaseRegState(0); - UT_SetForceFail(UT_KEY(OCS_timer_create), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_timer_create), -1); UT_TimeBaseTest_CallRegisterTimer(0); UtAssert_True(UT_TimeBaseTest_CheckTimeBaseErrorState(0), "timer registration failure state"); } @@ -200,7 +200,7 @@ void Test_OS_TimeBaseSet_Impl(void) UT_TimeBaseTest_Setup(0, OCS_SIGRTMIN, false); OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(0, 1, 1), OS_SUCCESS); - UT_SetForceFail(UT_KEY(OCS_timer_settime), -1); + UT_SetDefaultReturnValue(UT_KEY(OCS_timer_settime), -1); OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(0, 1, 1), OS_TIMER_ERR_INVALID_ARGS); } diff --git a/ut_assert/inc/utstubs.h b/ut_assert/inc/utstubs.h index 429c7519b..74e3c6fb3 100644 --- a/ut_assert/inc/utstubs.h +++ b/ut_assert/inc/utstubs.h @@ -191,12 +191,30 @@ void UT_GetDataBuffer(UT_EntryKey_t FuncKey, void **DataBuffer, uint32 *MaxSize, * \param FuncKey The stub function to add the return code to. * \param Value Arbitrary failure mode value (may or may not be used by the stub) */ +void UT_SetDefaultReturnValue(UT_EntryKey_t FuncKey, int32 Value); + +#ifndef OSAL_OMIT_DEPRECATED +/** + * Enable or disable the forced failure mode for the given stub function + * + * This triggers a constant failure mode from the stub function, if implemented. + * The stub function will invoke a given failure path as defined by + * the stub implementation. + * + * A count of the number of times the failure mode is invoked will be maintained. + * + * \param FuncKey The stub function to add the return code to. + * \param Value Arbitrary failure mode value (may or may not be used by the stub) + * + * @deprecated replaced by UT_SetDefaultReturnValue + */ void UT_SetForceFail(UT_EntryKey_t FuncKey, int32 Value); +#endif /** * Disable the forced failure mode for the given stub function * - * This undoes the action of UT_SetForceFail() + * This undoes the action of UT_SetDefaultReturnValue() * * \param FuncKey The stub function entry to clear. */ @@ -293,11 +311,11 @@ bool UT_Stub_CheckDeferredRetcode(UT_EntryKey_t FuncKey, int32 *Retcode); /** * Check for a forced failure mode entry for the given stub function * - * If a UT_SetForceFail() option is in place for the given function this + * If a UT_SetDefaultReturnValue() option is in place for the given function this * will return true and increment the internal usage counter. * * \param FuncKey The stub function to check the return code. - * \param Value Set to the value supplied to UT_SetForceFail() + * \param Value Set to the value supplied to UT_SetDefaultReturnValue() * \returns true if force fail mode is active */ bool UT_Stub_CheckForceFail(UT_EntryKey_t FuncKey, int32 *Value); diff --git a/ut_assert/src/utstubs.c b/ut_assert/src/utstubs.c index 79693e2f6..b97404d3e 100644 --- a/ut_assert/src/utstubs.c +++ b/ut_assert/src/utstubs.c @@ -308,7 +308,7 @@ bool UT_Stub_CheckDeferredRetcode(UT_EntryKey_t FuncKey, int32 *Retcode) return (Result); } -void UT_SetForceFail(UT_EntryKey_t FuncKey, int32 Value) +void UT_SetDefaultReturnValue(UT_EntryKey_t FuncKey, int32 Value) { UT_StubTableEntry_t *Rc; @@ -335,6 +335,13 @@ void UT_SetForceFail(UT_EntryKey_t FuncKey, int32 Value) } } +#ifndef OSAL_OMIT_DEPRECATED +void UT_SetForceFail(UT_EntryKey_t FuncKey, int32 Value) +{ + UT_SetDefaultReturnValue(FuncKey, Value); +} +#endif + void UT_ClearForceFail(UT_EntryKey_t FuncKey) { UT_StubTableEntry_t *StubPtr; From 2899dfec30cf31aa3d2c49ec43eef3cc2fc55373 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 29 Oct 2020 10:24:20 -0400 Subject: [PATCH 2/9] Fix #635, add typedefs for osal stack and priority Adds typedefs for: - osal_priority_t - osal_stackptr_t - osal_index_t - osal_objtype_t - osal_blockcount_t Note that by using `uint8` as the priority type, all values are valid and it is no longer possible to pass a value which is out of range. Checks/tests for this are no longer valid and would cause compiler warnings. --- src/bsp/generic-linux/src/bsp_console.c | 2 +- src/bsp/generic-linux/src/bsp_start.c | 2 +- src/bsp/generic-vxworks/src/bsp_console.c | 2 +- src/bsp/shared/inc/bsp-impl.h | 10 +- src/os/inc/common_types.h | 36 ++++++ src/os/inc/osapi-os-core.h | 57 ++++++--- src/os/inc/osapi-os-filesys.h | 14 +-- src/os/inc/osapi-os-loader.h | 2 +- src/os/inc/osapi-os-net.h | 10 +- src/os/inc/osapi-os-timer.h | 4 +- src/os/portable/os-impl-bsd-select.c | 24 ++-- src/os/portable/os-impl-bsd-sockets.c | 21 ++-- src/os/portable/os-impl-console-bsp.c | 8 +- src/os/portable/os-impl-no-loader.c | 6 +- src/os/portable/os-impl-no-network.c | 2 +- src/os/portable/os-impl-no-shell.c | 2 +- src/os/portable/os-impl-no-sockets.c | 4 +- src/os/portable/os-impl-no-symtab.c | 2 +- src/os/portable/os-impl-posix-dirs.c | 8 +- src/os/portable/os-impl-posix-dl-loader.c | 8 +- src/os/portable/os-impl-posix-dl-symtab.c | 6 +- src/os/portable/os-impl-posix-files.c | 2 +- src/os/portable/os-impl-posix-io.c | 8 +- src/os/portable/os-impl-posix-network.c | 2 +- src/os/posix/inc/os-impl-io.h | 4 +- src/os/posix/inc/os-posix.h | 8 +- src/os/posix/src/os-impl-binsem.c | 14 +-- src/os/posix/src/os-impl-common.c | 2 +- src/os/posix/src/os-impl-console.c | 12 +- src/os/posix/src/os-impl-countsem.c | 12 +- src/os/posix/src/os-impl-files.c | 4 +- src/os/posix/src/os-impl-filesys.c | 20 ++-- src/os/posix/src/os-impl-idmap.c | 6 +- src/os/posix/src/os-impl-mutex.c | 10 +- src/os/posix/src/os-impl-queues.c | 14 +-- src/os/posix/src/os-impl-shell.c | 2 +- src/os/posix/src/os-impl-tasks.c | 20 ++-- src/os/posix/src/os-impl-timebase.c | 33 ++--- src/os/rtems/inc/os-rtems.h | 2 +- src/os/rtems/src/os-impl-binsem.c | 14 +-- src/os/rtems/src/os-impl-common.c | 2 +- src/os/rtems/src/os-impl-console.c | 4 +- src/os/rtems/src/os-impl-countsem.c | 12 +- src/os/rtems/src/os-impl-filesys.c | 14 +-- src/os/rtems/src/os-impl-idmap.c | 6 +- src/os/rtems/src/os-impl-loader.c | 6 +- src/os/rtems/src/os-impl-mutex.c | 10 +- src/os/rtems/src/os-impl-queues.c | 10 +- src/os/rtems/src/os-impl-tasks.c | 12 +- src/os/rtems/src/os-impl-timebase.c | 16 +-- src/os/shared/inc/os-shared-binsem.h | 14 +-- src/os/shared/inc/os-shared-common.h | 2 +- src/os/shared/inc/os-shared-countsem.h | 12 +- src/os/shared/inc/os-shared-dir.h | 8 +- src/os/shared/inc/os-shared-file.h | 12 +- src/os/shared/inc/os-shared-filesys.h | 36 +++--- src/os/shared/inc/os-shared-globaldefs.h | 2 +- src/os/shared/inc/os-shared-idmap.h | 41 ++++--- src/os/shared/inc/os-shared-module.h | 10 +- src/os/shared/inc/os-shared-mutex.h | 10 +- src/os/shared/inc/os-shared-network.h | 2 +- src/os/shared/inc/os-shared-printf.h | 12 +- src/os/shared/inc/os-shared-queue.h | 16 +-- src/os/shared/inc/os-shared-select.h | 2 +- src/os/shared/inc/os-shared-shell.h | 2 +- src/os/shared/inc/os-shared-sockets.h | 19 +-- src/os/shared/inc/os-shared-task.h | 20 ++-- src/os/shared/inc/os-shared-time.h | 6 +- src/os/shared/inc/os-shared-timebase.h | 12 +- src/os/shared/src/osapi-binsem.c | 14 +-- src/os/shared/src/osapi-common.c | 6 +- src/os/shared/src/osapi-countsem.c | 12 +- src/os/shared/src/osapi-dir.c | 8 +- src/os/shared/src/osapi-file.c | 44 +++---- src/os/shared/src/osapi-filesys.c | 40 +++---- src/os/shared/src/osapi-idmap.c | 82 +++++++------ src/os/shared/src/osapi-module.c | 10 +- src/os/shared/src/osapi-mutex.c | 10 +- src/os/shared/src/osapi-network.c | 2 +- src/os/shared/src/osapi-printf.c | 10 +- src/os/shared/src/osapi-queue.c | 17 +-- src/os/shared/src/osapi-select.c | 14 +-- src/os/shared/src/osapi-shell.c | 2 +- src/os/shared/src/osapi-sockets.c | 27 +++-- src/os/shared/src/osapi-task.c | 59 ++++----- src/os/shared/src/osapi-time.c | 40 ++++--- src/os/shared/src/osapi-timebase.c | 44 +++---- src/os/vxworks/inc/os-impl-io.h | 4 +- src/os/vxworks/inc/os-impl-symtab.h | 4 +- src/os/vxworks/inc/os-vxworks.h | 6 +- src/os/vxworks/src/os-impl-binsem.c | 14 +-- src/os/vxworks/src/os-impl-common.c | 2 +- src/os/vxworks/src/os-impl-console.c | 6 +- src/os/vxworks/src/os-impl-countsem.c | 12 +- src/os/vxworks/src/os-impl-dirs.c | 8 +- src/os/vxworks/src/os-impl-files.c | 4 +- src/os/vxworks/src/os-impl-filesys.c | 20 ++-- src/os/vxworks/src/os-impl-heap.c | 6 +- src/os/vxworks/src/os-impl-idmap.c | 6 +- src/os/vxworks/src/os-impl-loader.c | 6 +- src/os/vxworks/src/os-impl-mutex.c | 10 +- src/os/vxworks/src/os-impl-network.c | 2 +- src/os/vxworks/src/os-impl-queues.c | 12 +- src/os/vxworks/src/os-impl-shell.c | 12 +- src/os/vxworks/src/os-impl-symtab.c | 12 +- src/os/vxworks/src/os-impl-tasks.c | 22 ++-- src/os/vxworks/src/os-impl-timebase.c | 27 +++-- .../bin-sem-flush-test/bin-sem-flush-test.c | 9 +- src/tests/bin-sem-test/bin-sem-test.c | 3 +- .../bin-sem-timeout-test.c | 3 +- src/tests/count-sem-test/count-sem-test.c | 9 +- src/tests/file-api-test/file-api-test.c | 47 ++++---- src/tests/idmap-api-test/idmap-api-test.c | 11 +- src/tests/mutex-test/mutex-test.c | 9 +- src/tests/network-api-test/network-api-test.c | 25 ++-- src/tests/osal-core-test/osal-core-test.c | 44 ++++--- .../queue-timeout-test/queue-timeout-test.c | 9 +- src/tests/sem-speed-test/sem-speed-test.c | 6 +- .../time-base-api-test/time-base-api-test.c | 2 +- src/tests/timer-test/timer-test.c | 22 ++-- .../inc/ut-adaptor-portable-posix-io.h | 2 +- .../src/ut-adaptor-portable-posix-io.c | 2 +- .../portable/src/coveragetest-bsd-select.c | 8 +- .../portable/src/coveragetest-no-loader.c | 6 +- .../portable/src/coveragetest-no-shell.c | 2 +- .../portable/src/coveragetest-posix-files.c | 10 +- .../portable/src/coveragetest-posix-io.c | 36 +++--- .../portable/src/os-portable-coveragetest.h | 11 ++ .../shared/src/coveragetest-binsem.c | 2 +- .../shared/src/coveragetest-countsem.c | 2 +- .../shared/src/coveragetest-file.c | 2 +- .../shared/src/coveragetest-filesys.c | 36 +++--- .../shared/src/coveragetest-idmap.c | 69 +++++------ .../shared/src/coveragetest-module.c | 9 +- .../shared/src/coveragetest-mutex.c | 2 +- .../shared/src/coveragetest-queue.c | 12 +- .../shared/src/coveragetest-sockets.c | 32 ++--- .../shared/src/coveragetest-task.c | 36 +++--- .../shared/src/coveragetest-time.c | 26 ++-- .../shared/src/coveragetest-timebase.c | 13 +- .../shared/src/os-shared-coveragetest.h | 4 + .../ut-stubs/inc/OCS_bsp-impl.h | 2 +- .../ut-stubs/src/bsp-console-impl-stubs.c | 2 +- .../ut-stubs/src/libc-stdio-stubs.c | 2 +- .../ut-stubs/src/libc-stdlib-stubs.c | 4 +- .../ut-stubs/src/osapi-binsem-impl-stubs.c | 14 +-- .../ut-stubs/src/osapi-common-impl-stubs.c | 2 +- .../ut-stubs/src/osapi-console-impl-stubs.c | 4 +- .../ut-stubs/src/osapi-countsem-impl-stubs.c | 12 +- .../ut-stubs/src/osapi-file-impl-stubs.c | 20 ++-- .../ut-stubs/src/osapi-filesys-impl-stubs.c | 14 +-- .../ut-stubs/src/osapi-idmap-impl-stubs.c | 4 +- .../ut-stubs/src/osapi-loader-impl-stubs.c | 10 +- .../ut-stubs/src/osapi-mutex-impl-stubs.c | 10 +- .../ut-stubs/src/osapi-network-impl-stubs.c | 21 ++-- .../ut-stubs/src/osapi-queue-impl-stubs.c | 10 +- .../ut-stubs/src/osapi-select-impl-stubs.c | 2 +- .../ut-stubs/src/osapi-task-impl-stubs.c | 14 +-- .../ut-stubs/src/osapi-timer-impl-stubs.c | 14 +-- .../src/portable-console-bsp-impl-stubs.c | 2 +- .../ut-stubs/src/posix-unistd-stubs.c | 4 +- .../ut-stubs/src/vxworks-intLib-stubs.c | 2 +- .../vxworks/adaptors/inc/ut-adaptor-console.h | 2 +- .../vxworks/adaptors/inc/ut-adaptor-files.h | 2 +- .../vxworks/adaptors/inc/ut-adaptor-filesys.h | 2 +- .../vxworks/adaptors/inc/ut-adaptor-idmap.h | 4 +- .../vxworks/adaptors/inc/ut-adaptor-symtab.h | 2 +- .../vxworks/adaptors/inc/ut-adaptor-tasks.h | 4 +- .../adaptors/inc/ut-adaptor-timebase.h | 14 +-- .../vxworks/adaptors/src/ut-adaptor-console.c | 2 +- .../vxworks/adaptors/src/ut-adaptor-files.c | 2 +- .../vxworks/adaptors/src/ut-adaptor-filesys.c | 2 +- .../adaptors/src/ut-adaptor-filetable-stub.c | 2 +- .../vxworks/adaptors/src/ut-adaptor-idmap.c | 4 +- .../vxworks/adaptors/src/ut-adaptor-symtab.c | 2 +- .../vxworks/adaptors/src/ut-adaptor-tasks.c | 4 +- .../adaptors/src/ut-adaptor-timebase.c | 14 +-- .../vxworks/src/coveragetest-binsem.c | 24 ++-- .../vxworks/src/coveragetest-countsem.c | 16 +-- .../vxworks/src/coveragetest-dirs.c | 12 +- .../vxworks/src/coveragetest-loader.c | 14 +-- .../vxworks/src/coveragetest-mutex.c | 12 +- .../vxworks/src/coveragetest-queues.c | 32 ++--- .../vxworks/src/coveragetest-shell.c | 4 +- .../vxworks/src/coveragetest-symtab.c | 6 +- .../vxworks/src/coveragetest-tasks.c | 36 +++--- .../vxworks/src/coveragetest-timebase.c | 56 ++++----- .../vxworks/src/os-vxworks-coveragetest.h | 4 + .../src/vxworks-os-impl-common-stubs.c | 2 +- .../oscore-test/ut_oscore_misc_test.c | 14 ++- .../oscore-test/ut_oscore_queue_test.c | 90 +++++++------- .../oscore-test/ut_oscore_select_test.c | 2 +- .../oscore-test/ut_oscore_task_test.c | 113 ++++++++---------- .../osfile-test/ut_osfile_fileio_test.c | 5 +- src/unit-tests/osfile-test/ut_osfile_test.c | 2 +- .../osfilesys-test/ut_osfilesys_diskio_test.c | 12 +- .../osfilesys-test/ut_osfilesys_test.c | 4 +- src/ut-stubs/osapi-utstub-dir.c | 2 +- src/ut-stubs/osapi-utstub-file.c | 22 ++-- src/ut-stubs/osapi-utstub-filesys.c | 4 +- src/ut-stubs/osapi-utstub-heap.c | 6 +- src/ut-stubs/osapi-utstub-idmap.c | 64 ++++++---- src/ut-stubs/osapi-utstub-module.c | 2 +- src/ut-stubs/osapi-utstub-network.c | 2 +- src/ut-stubs/osapi-utstub-printf.c | 2 +- src/ut-stubs/osapi-utstub-queue.c | 7 +- src/ut-stubs/osapi-utstub-sockets.c | 12 +- src/ut-stubs/osapi-utstub-task.c | 12 +- ut_assert/inc/utstubs.h | 8 +- ut_assert/src/utstubs.c | 20 ++-- 210 files changed, 1439 insertions(+), 1321 deletions(-) diff --git a/src/bsp/generic-linux/src/bsp_console.c b/src/bsp/generic-linux/src/bsp_console.c index 766640952..ddae03c99 100644 --- a/src/bsp/generic-linux/src/bsp_console.c +++ b/src/bsp/generic-linux/src/bsp_console.c @@ -72,7 +72,7 @@ static void OS_BSP_ExecTput(const char *cap, const char *param) OS_BSP_ConsoleOutput_Impl See full description in header ------------------------------------------------------------------*/ -void OS_BSP_ConsoleOutput_Impl(const char *Str, uint32 DataLen) +void OS_BSP_ConsoleOutput_Impl(const char *Str, size_t DataLen) { ssize_t WriteLen; diff --git a/src/bsp/generic-linux/src/bsp_start.c b/src/bsp/generic-linux/src/bsp_start.c index 0254ec8e0..1267b18d3 100644 --- a/src/bsp/generic-linux/src/bsp_start.c +++ b/src/bsp/generic-linux/src/bsp_start.c @@ -69,7 +69,7 @@ void OS_BSP_Initialize(void) { if (fgets(buffer, sizeof(buffer), fp) != NULL) { - OS_BSP_Global.MaxQueueDepth = strtoul(buffer, NULL, 10); + OS_BSP_Global.MaxQueueDepth = OSAL_BLOCKCOUNT_C(strtoul(buffer, NULL, 10)); BSP_DEBUG("Maximum user msg queue depth = %u\n", (unsigned int)OS_BSP_Global.MaxQueueDepth); } fclose(fp); diff --git a/src/bsp/generic-vxworks/src/bsp_console.c b/src/bsp/generic-vxworks/src/bsp_console.c index b96ffe13b..660d8319b 100644 --- a/src/bsp/generic-vxworks/src/bsp_console.c +++ b/src/bsp/generic-vxworks/src/bsp_console.c @@ -40,7 +40,7 @@ OS_BSP_ConsoleOutput_Impl See full description in header ------------------------------------------------------------------*/ -void OS_BSP_ConsoleOutput_Impl(const char *Str, uint32 DataLen) +void OS_BSP_ConsoleOutput_Impl(const char *Str, size_t DataLen) { while (DataLen > 0) { diff --git a/src/bsp/shared/inc/bsp-impl.h b/src/bsp/shared/inc/bsp-impl.h index 1f67853a6..4c26a9b63 100644 --- a/src/bsp/shared/inc/bsp-impl.h +++ b/src/bsp/shared/inc/bsp-impl.h @@ -90,10 +90,10 @@ */ typedef struct { - uint32 ArgC; /* number of boot/startup parameters in ArgV */ - char **ArgV; /* strings for boot/startup parameters */ - int32 AppStatus; /* value which can be returned to the OS (0=nominal) */ - uint32 MaxQueueDepth; /* Queue depth limit supported by BSP (0=no limit) */ + uint32 ArgC; /* number of boot/startup parameters in ArgV */ + char ** ArgV; /* strings for boot/startup parameters */ + int32 AppStatus; /* value which can be returned to the OS (0=nominal) */ + osal_blockcount_t MaxQueueDepth; /* Queue depth limit supported by BSP (0=no limit) */ } OS_BSP_GlobalData_t; /* @@ -118,7 +118,7 @@ extern OS_BSP_GlobalData_t OS_BSP_Global; Note: This should write the string as-is without buffering. ------------------------------------------------------------------*/ -void OS_BSP_ConsoleOutput_Impl(const char *Str, uint32 DataLen); +void OS_BSP_ConsoleOutput_Impl(const char *Str, size_t DataLen); /*---------------------------------------------------------------- Function: OS_BSP_ConsoleSetMode_Impl diff --git a/src/os/inc/common_types.h b/src/os/inc/common_types.h index a9bc35762..258f55a3b 100644 --- a/src/os/inc/common_types.h +++ b/src/os/inc/common_types.h @@ -101,6 +101,28 @@ extern "C" */ typedef uint32_t osal_id_t; + /** + * A type used to represent a number of blocks or buffers + * + * This is used with file system and queue implementations. + */ + typedef size_t osal_blockcount_t; + + /** + * A type used to represent an index into a table structure + * + * This is used when referring directly to a table index as + * opposed to an object ID. It is primarily intended for + * internal use, but is also output from public APIs such as + * OS_ObjectIdToArrayIndex(). + */ + typedef uint32 osal_index_t; + + /** + * A type used to represent the runtime type or category of an OSAL object + */ + typedef uint32 osal_objtype_t; + #ifndef NULL /* pointer to nothing */ #define NULL ((void *)0) #endif @@ -150,4 +172,18 @@ extern "C" } #endif +/* + * Type macros for literals + * + * These macros enforce that a literal or other value is + * interpreted as the intended type. Although implicit + * conversions between these types are often possible, using + * this makes it explicit in the code where a type conversion + * is expected. + */ +#define OSAL_SIZE_C(X) ((size_t) {X}) +#define OSAL_BLOCKCOUNT_C(X) ((osal_blockcount_t) {X}) +#define OSAL_INDEX_C(X) ((osal_index_t) {X}) +#define OSAL_OBJTYPE_C(X) ((osal_objtype_t) {X}) + #endif /* _common_types_ */ diff --git a/src/os/inc/osapi-os-core.h b/src/os/inc/osapi-os-core.h index a6fa0d47c..befa5583f 100644 --- a/src/os/inc/osapi-os-core.h +++ b/src/os/inc/osapi-os-core.h @@ -86,15 +86,34 @@ */ #define OS_ERROR_NAME_LENGTH 35 +/** + * @brief Type to be used for OSAL task priorities. + * + * OSAL priorities are in reverse order, and range + * from 0 (highest; will preempt all other tasks) to + * 255 (lowest; will not preempt any other task). + */ +typedef uint8_t osal_priority_t; + +#define OSAL_PRIORITY_C(X) ((osal_priority_t) {X}) + +/** + * @brief Type to be used for OSAL stack pointer. + */ +typedef void *osal_stackptr_t; + +#define OSAL_STACKPTR_C(X) ((osal_stackptr_t) {X}) +#define OSAL_TASK_STACK_ALLOCATE OSAL_STACKPTR_C(NULL) + /* Object property structures */ /** @brief OSAL task properties */ typedef struct { - char name[OS_MAX_API_NAME]; - osal_id_t creator; - uint32 stack_size; - uint32 priority; + char name[OS_MAX_API_NAME]; + osal_id_t creator; + size_t stack_size; + osal_priority_t priority; } OS_task_prop_t; /** @brief OSAL queue properties */ @@ -140,9 +159,9 @@ typedef struct */ typedef struct { - uint32 free_bytes; - uint32 free_blocks; - uint32 largest_free_block; + size_t free_bytes; + osal_blockcount_t free_blocks; + size_t largest_free_block; } OS_heap_prop_t; /** @@ -467,7 +486,7 @@ static inline bool OS_ObjectIdDefined(osal_id_t object_id) * #OS_INVALID_POINTER if the passed-in buffer is invalid * #OS_ERR_NAME_TOO_LONG if the name will not fit in the buffer provided */ -int32 OS_GetResourceName(osal_id_t object_id, char *buffer, uint32 buffer_size); +int32 OS_GetResourceName(osal_id_t object_id, char *buffer, size_t buffer_size); /*-------------------------------------------------------------------------------------*/ /** @@ -480,7 +499,7 @@ int32 OS_GetResourceName(osal_id_t object_id, char *buffer, uint32 buffer_size); * @return The object type portion of the object_id, see @ref OSObjectTypes for * expected values */ -uint32 OS_IdentifyObject(osal_id_t object_id); +osal_objtype_t OS_IdentifyObject(osal_id_t object_id); /*-------------------------------------------------------------------------------------*/ /** @@ -506,7 +525,7 @@ uint32 OS_IdentifyObject(osal_id_t object_id); * @retval #OS_SUCCESS @copybrief OS_SUCCESS * @retval #OS_ERR_INCORRECT_OBJ_TYPE @copybrief OS_ERR_INCORRECT_OBJ_TYPE */ -int32 OS_ConvertToArrayIndex(osal_id_t object_id, uint32 *ArrayIndex); +int32 OS_ConvertToArrayIndex(osal_id_t object_id, osal_index_t *ArrayIndex); /*-------------------------------------------------------------------------------------*/ /** @@ -537,7 +556,7 @@ int32 OS_ConvertToArrayIndex(osal_id_t object_id, uint32 *ArrayIndex); * @retval #OS_SUCCESS @copybrief OS_SUCCESS * @retval #OS_ERR_INCORRECT_OBJ_TYPE @copybrief OS_ERR_INCORRECT_OBJ_TYPE * */ -int32 OS_ObjectIdToArrayIndex(uint32 idtype, osal_id_t object_id, uint32 *ArrayIndex); +int32 OS_ObjectIdToArrayIndex(osal_objtype_t idtype, osal_id_t object_id, osal_index_t *ArrayIndex); /*-------------------------------------------------------------------------------------*/ /** @@ -566,7 +585,8 @@ void OS_ForEachObject(osal_id_t creator_id, OS_ArgCallback_t callback_ptr, void * @param[in] callback_ptr Function to invoke for each matching object ID * @param[in] callback_arg Opaque Argument to pass to callback function */ -void OS_ForEachObjectOfType(uint32 objtype, osal_id_t creator_id, OS_ArgCallback_t callback_ptr, void *callback_arg); +void OS_ForEachObjectOfType(osal_objtype_t objtype, osal_id_t creator_id, OS_ArgCallback_t callback_ptr, + void *callback_arg); /*-------------------------------------------------------------------------------------*/ /** @@ -617,8 +637,8 @@ int32 OS_RegisterEventHandler(OS_EventHandler_t handler); * @retval #OS_ERR_NAME_TAKEN if the name specified is already used by a task * @retval #OS_ERROR if an unspecified/other error occurs */ -int32 OS_TaskCreate(osal_id_t *task_id, const char *task_name, osal_task_entry function_pointer, uint32 *stack_pointer, - uint32 stack_size, uint32 priority, uint32 flags); +int32 OS_TaskCreate(osal_id_t *task_id, const char *task_name, osal_task_entry function_pointer, + osal_stackptr_t stack_pointer, size_t stack_size, osal_priority_t priority, uint32 flags); /*-------------------------------------------------------------------------------------*/ /** @@ -687,7 +707,7 @@ int32 OS_TaskDelay(uint32 millisecond); * @retval #OS_ERR_INVALID_PRIORITY if the priority is greater than the max allowed * @retval #OS_ERROR if the OS call to change the priority fails */ -int32 OS_TaskSetPriority(osal_id_t task_id, uint32 new_priority); +int32 OS_TaskSetPriority(osal_id_t task_id, osal_priority_t new_priority); /*-------------------------------------------------------------------------------------*/ /** @@ -797,7 +817,8 @@ int32 OS_TaskFindIdBySystemData(osal_id_t *task_id, const void *sysdata, size_t * @retval #OS_QUEUE_INVALID_SIZE if the queue depth exceeds the limit * @retval #OS_ERROR if the OS create call fails */ -int32 OS_QueueCreate(osal_id_t *queue_id, const char *queue_name, uint32 queue_depth, uint32 data_size, uint32 flags); +int32 OS_QueueCreate(osal_id_t *queue_id, const char *queue_name, osal_blockcount_t queue_depth, size_t data_size, + uint32 flags); /*-------------------------------------------------------------------------------------*/ /** @@ -839,7 +860,7 @@ int32 OS_QueueDelete(osal_id_t queue_id); * @retval #OS_QUEUE_TIMEOUT if the timeout was OS_PEND and the time expired * @retval #OS_QUEUE_INVALID_SIZE if the size copied from the queue was not correct */ -int32 OS_QueueGet(osal_id_t queue_id, void *data, uint32 size, uint32 *size_copied, int32 timeout); +int32 OS_QueueGet(osal_id_t queue_id, void *data, size_t size, size_t *size_copied, int32 timeout); /*-------------------------------------------------------------------------------------*/ /** @@ -857,7 +878,7 @@ int32 OS_QueueGet(osal_id_t queue_id, void *data, uint32 size, uint32 *size_copi * @retval #OS_QUEUE_FULL if the queue cannot accept another message * @retval #OS_ERROR if the OS call returns an error */ -int32 OS_QueuePut(osal_id_t queue_id, const void *data, uint32 size, uint32 flags); +int32 OS_QueuePut(osal_id_t queue_id, const void *data, size_t size, uint32 flags); /*-------------------------------------------------------------------------------------*/ /** diff --git a/src/os/inc/osapi-os-filesys.h b/src/os/inc/osapi-os-filesys.h index 764ae0d4e..d09c2616d 100644 --- a/src/os/inc/osapi-os-filesys.h +++ b/src/os/inc/osapi-os-filesys.h @@ -112,7 +112,7 @@ typedef struct { uint32 FileModeBits; int32 FileTime; - uint32 FileSize; + size_t FileSize; } os_fstat_t; /** @@ -285,7 +285,7 @@ int32 OS_close(osal_id_t filedes); * @retval #OS_ERROR if OS call failed * @retval #OS_ERR_INVALID_ID if the file descriptor passed in is invalid */ -int32 OS_read(osal_id_t filedes, void *buffer, uint32 nbytes); +int32 OS_read(osal_id_t filedes, void *buffer, size_t nbytes); /*-------------------------------------------------------------------------------------*/ /** @@ -306,7 +306,7 @@ int32 OS_read(osal_id_t filedes, void *buffer, uint32 nbytes); * @retval #OS_ERROR if OS call failed * @retval #OS_ERR_INVALID_ID if the file descriptor passed in is invalid */ -int32 OS_write(osal_id_t filedes, const void *buffer, uint32 nbytes); +int32 OS_write(osal_id_t filedes, const void *buffer, size_t nbytes); /*-------------------------------------------------------------------------------------*/ /** @@ -337,7 +337,7 @@ int32 OS_write(osal_id_t filedes, const void *buffer, uint32 nbytes); * @return Byte count on success, zero for timeout, or appropriate error code, * see @ref OSReturnCodes */ -int32 OS_TimedRead(osal_id_t filedes, void *buffer, uint32 nbytes, int32 timeout); +int32 OS_TimedRead(osal_id_t filedes, void *buffer, size_t nbytes, int32 timeout); /*-------------------------------------------------------------------------------------*/ /** @@ -368,7 +368,7 @@ int32 OS_TimedRead(osal_id_t filedes, void *buffer, uint32 nbytes, int32 timeout * @return Byte count on success, zero for timeout, or appropriate error code, * see @ref OSReturnCodes */ -int32 OS_TimedWrite(osal_id_t filedes, const void *buffer, uint32 nbytes, int32 timeout); +int32 OS_TimedWrite(osal_id_t filedes, const void *buffer, size_t nbytes, int32 timeout); /*-------------------------------------------------------------------------------------*/ /** @@ -715,7 +715,7 @@ int32 OS_FileSysAddFixedMap(osal_id_t *filesys_id, const char *phys_path, const * @retval #OS_FS_ERR_DEVICE_NOT_FREE if the volume table is full * @retval #OS_SUCCESS on creating the disk */ -int32 OS_mkfs(char *address, const char *devname, const char *volname, uint32 blocksize, uint32 numblocks); +int32 OS_mkfs(char *address, const char *devname, const char *volname, size_t blocksize, osal_blockcount_t numblocks); /*-------------------------------------------------------------------------------------*/ /** * @brief Mounts a file system @@ -754,7 +754,7 @@ int32 OS_mount(const char *devname, const char *mountpoint); * @retval #OS_FS_ERR_DEVICE_NOT_FREE if the volume table is full * @retval #OS_FS_ERR_DRIVE_NOT_CREATED on error */ -int32 OS_initfs(char *address, const char *devname, const char *volname, uint32 blocksize, uint32 numblocks); +int32 OS_initfs(char *address, const char *devname, const char *volname, size_t blocksize, osal_blockcount_t numblocks); /*-------------------------------------------------------------------------------------*/ /** diff --git a/src/os/inc/osapi-os-loader.h b/src/os/inc/osapi-os-loader.h index c5a49053e..8aff625fc 100644 --- a/src/os/inc/osapi-os-loader.h +++ b/src/os/inc/osapi-os-loader.h @@ -176,7 +176,7 @@ int32 OS_ModuleSymbolLookup(osal_id_t module_id, cpuaddr *symbol_address, const * @retval #OS_ERR_NOT_IMPLEMENTED @copybrief OS_ERR_NOT_IMPLEMENTED * @retval #OS_ERROR if the symbol table could not be read or dumped */ -int32 OS_SymbolTableDump(const char *filename, uint32 size_limit); +int32 OS_SymbolTableDump(const char *filename, size_t size_limit); /*-------------------------------------------------------------------------------------*/ /** diff --git a/src/os/inc/osapi-os-net.h b/src/os/inc/osapi-os-net.h index 5a270266f..2283ef2d6 100644 --- a/src/os/inc/osapi-os-net.h +++ b/src/os/inc/osapi-os-net.h @@ -102,7 +102,7 @@ typedef union */ typedef struct { - uint32 ActualLength; /**< @brief Length of the actual address data */ + size_t ActualLength; /**< @brief Length of the actual address data */ OS_SockAddrData_t AddrData; /**< @brief Abstract Address data */ } OS_SockAddr_t; @@ -162,7 +162,7 @@ int32 OS_SocketAddrInit(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain); * * @return Execution status, see @ref OSReturnCodes */ -int32 OS_SocketAddrToString(char *buffer, uint32 buflen, const OS_SockAddr_t *Addr); +int32 OS_SocketAddrToString(char *buffer, size_t buflen, const OS_SockAddr_t *Addr); /*-------------------------------------------------------------------------------------*/ /** @@ -317,7 +317,7 @@ int32 OS_SocketAccept(osal_id_t sock_id, osal_id_t *connsock_id, OS_SockAddr_t * * * @return Count of actual bytes received or error status, see @ref OSReturnCodes */ -int32 OS_SocketRecvFrom(osal_id_t sock_id, void *buffer, uint32 buflen, OS_SockAddr_t *RemoteAddr, int32 timeout); +int32 OS_SocketRecvFrom(osal_id_t sock_id, void *buffer, size_t buflen, OS_SockAddr_t *RemoteAddr, int32 timeout); /*-------------------------------------------------------------------------------------*/ /** @@ -334,7 +334,7 @@ int32 OS_SocketRecvFrom(osal_id_t sock_id, void *buffer, uint32 buflen, OS_SockA * * @return Count of actual bytes sent or error status, see @ref OSReturnCodes */ -int32 OS_SocketSendTo(osal_id_t sock_id, const void *buffer, uint32 buflen, const OS_SockAddr_t *RemoteAddr); +int32 OS_SocketSendTo(osal_id_t sock_id, const void *buffer, size_t buflen, const OS_SockAddr_t *RemoteAddr); /*-------------------------------------------------------------------------------------*/ /** @@ -400,7 +400,7 @@ int32 OS_NetworkGetID(void); * * @return Execution status, see @ref OSReturnCodes */ -int32 OS_NetworkGetHostName(char *host_name, uint32 name_len); +int32 OS_NetworkGetHostName(char *host_name, size_t name_len); /**@}*/ #endif diff --git a/src/os/inc/osapi-os-timer.h b/src/os/inc/osapi-os-timer.h index 8cf2a2d58..e9b7ef3c6 100644 --- a/src/os/inc/osapi-os-timer.h +++ b/src/os/inc/osapi-os-timer.h @@ -33,8 +33,8 @@ /* ** Typedefs */ -typedef void (*OS_TimerCallback_t)(osal_id_t timer_id); /**< @brief Timer callback */ -typedef uint32 (*OS_TimerSync_t)(uint32 timer_id); /**< @brief Timer sync */ +typedef void (*OS_TimerCallback_t)(osal_id_t timer_id); /**< @brief Timer callback */ +typedef uint32 (*OS_TimerSync_t)(osal_index_t timer_id); /**< @brief Timer sync */ /** @brief Timer properties */ typedef struct diff --git a/src/os/portable/os-impl-bsd-select.c b/src/os/portable/os-impl-bsd-select.c index 67ae82bed..145d603fb 100644 --- a/src/os/portable/os-impl-bsd-select.c +++ b/src/os/portable/os-impl-bsd-select.c @@ -74,12 +74,12 @@ *-----------------------------------------------------------------*/ static int OS_FdSet_ConvertIn_Impl(fd_set *os_set, OS_FdSet *OSAL_set) { - uint32 offset; - uint32 bit; - uint32 id; - uint8 objids; - int osfd; - int maxfd; + size_t offset; + size_t bit; + osal_index_t id; + uint8 objids; + int osfd; + int maxfd; maxfd = -1; for (offset = 0; offset < sizeof(OSAL_set->object_ids); ++offset) @@ -122,11 +122,11 @@ static int OS_FdSet_ConvertIn_Impl(fd_set *os_set, OS_FdSet *OSAL_set) *-----------------------------------------------------------------*/ static void OS_FdSet_ConvertOut_Impl(fd_set *output, OS_FdSet *Input) { - uint32 offset; - uint32 bit; - uint32 id; - uint8 objids; - int osfd; + size_t offset; + size_t bit; + osal_index_t id; + uint8 objids; + int osfd; for (offset = 0; offset < sizeof(Input->object_ids); ++offset) { @@ -249,7 +249,7 @@ static int32 OS_DoSelect(int maxfd, fd_set *rd_set, fd_set *wr_set, int32 msecs) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SelectSingle_Impl(uint32 stream_id, uint32 *SelectFlags, int32 msecs) +int32 OS_SelectSingle_Impl(osal_index_t stream_id, uint32 *SelectFlags, int32 msecs) { int32 return_code; fd_set wr_set; diff --git a/src/os/portable/os-impl-bsd-sockets.c b/src/os/portable/os-impl-bsd-sockets.c index 524fe42a3..655dc0287 100644 --- a/src/os/portable/os-impl-bsd-sockets.c +++ b/src/os/portable/os-impl-bsd-sockets.c @@ -84,7 +84,7 @@ typedef union * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SocketOpen_Impl(uint32 sock_id) +int32 OS_SocketOpen_Impl(osal_index_t sock_id) { int os_domain; int os_type; @@ -175,7 +175,7 @@ int32 OS_SocketOpen_Impl(uint32 sock_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SocketBind_Impl(uint32 sock_id, const OS_SockAddr_t *Addr) +int32 OS_SocketBind_Impl(osal_index_t sock_id, const OS_SockAddr_t *Addr) { int os_result; socklen_t addrlen; @@ -231,7 +231,7 @@ int32 OS_SocketBind_Impl(uint32 sock_id, const OS_SockAddr_t *Addr) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SocketConnect_Impl(uint32 sock_id, const OS_SockAddr_t *Addr, int32 timeout) +int32 OS_SocketConnect_Impl(osal_index_t sock_id, const OS_SockAddr_t *Addr, int32 timeout) { int32 return_code; int os_status; @@ -309,7 +309,7 @@ int32 OS_SocketConnect_Impl(uint32 sock_id, const OS_SockAddr_t *Addr, int32 tim * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SocketAccept_Impl(uint32 sock_id, uint32 connsock_id, OS_SockAddr_t *Addr, int32 timeout) +int32 OS_SocketAccept_Impl(osal_index_t sock_id, osal_index_t connsock_id, OS_SockAddr_t *Addr, int32 timeout) { int32 return_code; uint32 operation; @@ -370,7 +370,8 @@ int32 OS_SocketAccept_Impl(uint32 sock_id, uint32 connsock_id, OS_SockAddr_t *Ad * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SocketRecvFrom_Impl(uint32 sock_id, void *buffer, uint32 buflen, OS_SockAddr_t *RemoteAddr, int32 timeout) +int32 OS_SocketRecvFrom_Impl(osal_index_t sock_id, void *buffer, size_t buflen, OS_SockAddr_t *RemoteAddr, + int32 timeout) { int32 return_code; int os_result; @@ -458,7 +459,7 @@ int32 OS_SocketRecvFrom_Impl(uint32 sock_id, void *buffer, uint32 buflen, OS_Soc * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SocketSendTo_Impl(uint32 sock_id, const void *buffer, uint32 buflen, const OS_SockAddr_t *RemoteAddr) +int32 OS_SocketSendTo_Impl(osal_index_t sock_id, const void *buffer, size_t buflen, const OS_SockAddr_t *RemoteAddr) { int os_result; socklen_t addrlen; @@ -503,7 +504,7 @@ int32 OS_SocketSendTo_Impl(uint32 sock_id, const void *buffer, uint32 buflen, co * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SocketGetInfo_Impl(uint32 sock_id, OS_socket_prop_t *sock_prop) +int32 OS_SocketGetInfo_Impl(osal_index_t sock_id, OS_socket_prop_t *sock_prop) { return OS_SUCCESS; } /* end OS_SocketGetInfo_Impl */ @@ -539,7 +540,7 @@ int32 OS_SocketAddrInit_Impl(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain) #endif default: sa_family = 0; - addrlen = 0; + addrlen = 0; break; } @@ -548,7 +549,7 @@ int32 OS_SocketAddrInit_Impl(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain) return OS_ERR_NOT_IMPLEMENTED; } - Addr->ActualLength = addrlen; + Addr->ActualLength = OSAL_SIZE_C(addrlen); Accessor->sockaddr.sa_family = sa_family; return OS_SUCCESS; @@ -562,7 +563,7 @@ int32 OS_SocketAddrInit_Impl(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SocketAddrToString_Impl(char *buffer, uint32 buflen, const OS_SockAddr_t *Addr) +int32 OS_SocketAddrToString_Impl(char *buffer, size_t buflen, const OS_SockAddr_t *Addr) { const void * addrbuffer; const OS_SockAddr_Accessor_t *Accessor; diff --git a/src/os/portable/os-impl-console-bsp.c b/src/os/portable/os-impl-console-bsp.c index ddc6369eb..815c423d5 100644 --- a/src/os/portable/os-impl-console-bsp.c +++ b/src/os/portable/os-impl-console-bsp.c @@ -52,11 +52,11 @@ * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -void OS_ConsoleOutput_Impl(uint32 local_id) +void OS_ConsoleOutput_Impl(osal_index_t local_id) { - uint32 StartPos; - uint32 EndPos; - long WriteSize; + size_t StartPos; + size_t EndPos; + size_t WriteSize; OS_console_internal_record_t *console; console = &OS_console_table[local_id]; diff --git a/src/os/portable/os-impl-no-loader.c b/src/os/portable/os-impl-no-loader.c index 37713589a..046fe3419 100644 --- a/src/os/portable/os-impl-no-loader.c +++ b/src/os/portable/os-impl-no-loader.c @@ -38,7 +38,7 @@ * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleLoad_Impl(uint32 module_id, const char *translated_path) +int32 OS_ModuleLoad_Impl(osal_index_t module_id, const char *translated_path) { return OS_ERR_NOT_IMPLEMENTED; @@ -52,7 +52,7 @@ int32 OS_ModuleLoad_Impl(uint32 module_id, const char *translated_path) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleUnload_Impl(uint32 module_id) +int32 OS_ModuleUnload_Impl(osal_index_t module_id) { return OS_ERR_NOT_IMPLEMENTED; @@ -66,7 +66,7 @@ int32 OS_ModuleUnload_Impl(uint32 module_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleGetInfo_Impl(uint32 module_id, OS_module_prop_t *module_prop) +int32 OS_ModuleGetInfo_Impl(osal_index_t module_id, OS_module_prop_t *module_prop) { return OS_ERR_NOT_IMPLEMENTED; diff --git a/src/os/portable/os-impl-no-network.c b/src/os/portable/os-impl-no-network.c index b7dba2fb0..30d725937 100644 --- a/src/os/portable/os-impl-no-network.c +++ b/src/os/portable/os-impl-no-network.c @@ -56,7 +56,7 @@ int32 OS_NetworkGetID_Impl(int32 *IdBuf) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_NetworkGetHostName_Impl(char *host_name, uint32 name_len) +int32 OS_NetworkGetHostName_Impl(char *host_name, size_t name_len) { return OS_ERR_NOT_IMPLEMENTED; } /* end OS_NetworkGetHostName_Impl */ diff --git a/src/os/portable/os-impl-no-shell.c b/src/os/portable/os-impl-no-shell.c index 31bead6e3..5f86dc1af 100644 --- a/src/os/portable/os-impl-no-shell.c +++ b/src/os/portable/os-impl-no-shell.c @@ -34,7 +34,7 @@ * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ShellOutputToFile_Impl(uint32 file_id, const char *Cmd) +int32 OS_ShellOutputToFile_Impl(osal_index_t file_id, const char *Cmd) { return OS_ERR_NOT_IMPLEMENTED; } diff --git a/src/os/portable/os-impl-no-sockets.c b/src/os/portable/os-impl-no-sockets.c index f2ed25204..b87bb3395 100644 --- a/src/os/portable/os-impl-no-sockets.c +++ b/src/os/portable/os-impl-no-sockets.c @@ -101,7 +101,7 @@ int32 OS_SocketAccept_Impl(uint32 sock_id, uint32 connsock_id, OS_SockAddr_t *Ad * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SocketRecvFrom_Impl(uint32 sock_id, void *buffer, uint32 buflen, OS_SockAddr_t *RemoteAddr, int32 timeout) +int32 OS_SocketRecvFrom_Impl(uint32 sock_id, void *buffer, size_t buflen, OS_SockAddr_t *RemoteAddr, int32 timeout) { return OS_ERR_NOT_IMPLEMENTED; } /* end OS_SocketRecvFrom_Impl */ @@ -114,7 +114,7 @@ int32 OS_SocketRecvFrom_Impl(uint32 sock_id, void *buffer, uint32 buflen, OS_Soc * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SocketSendTo_Impl(uint32 sock_id, const void *buffer, uint32 buflen, const OS_SockAddr_t *RemoteAddr) +int32 OS_SocketSendTo_Impl(uint32 sock_id, const void *buffer, size_t buflen, const OS_SockAddr_t *RemoteAddr) { return OS_ERR_NOT_IMPLEMENTED; } /* end OS_SocketSendTo_Impl */ diff --git a/src/os/portable/os-impl-no-symtab.c b/src/os/portable/os-impl-no-symtab.c index 72fe4f1b2..3525d5b81 100644 --- a/src/os/portable/os-impl-no-symtab.c +++ b/src/os/portable/os-impl-no-symtab.c @@ -66,7 +66,7 @@ int32 OS_ModuleSymbolLookup_Impl(uint32 local_id, cpuaddr *SymbolAddress, const * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SymbolTableDump_Impl(const char *filename, uint32 SizeLimit) +int32 OS_SymbolTableDump_Impl(const char *filename, size_t SizeLimit) { return (OS_ERR_NOT_IMPLEMENTED); diff --git a/src/os/portable/os-impl-posix-dirs.c b/src/os/portable/os-impl-posix-dirs.c index 740a8fb73..e840ed089 100644 --- a/src/os/portable/os-impl-posix-dirs.c +++ b/src/os/portable/os-impl-posix-dirs.c @@ -104,7 +104,7 @@ int32 OS_DirCreate_Impl(const char *local_path, uint32 access) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_DirOpen_Impl(uint32 local_id, const char *local_path) +int32 OS_DirOpen_Impl(osal_index_t local_id, const char *local_path) { DIR *dp = opendir(local_path); if (dp == NULL) @@ -123,7 +123,7 @@ int32 OS_DirOpen_Impl(uint32 local_id, const char *local_path) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_DirClose_Impl(uint32 local_id) +int32 OS_DirClose_Impl(osal_index_t local_id) { closedir(OS_impl_dir_table[local_id].dp); OS_impl_dir_table[local_id].dp = NULL; @@ -138,7 +138,7 @@ int32 OS_DirClose_Impl(uint32 local_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_DirRead_Impl(uint32 local_id, os_dirent_t *dirent) +int32 OS_DirRead_Impl(osal_index_t local_id, os_dirent_t *dirent) { struct dirent *de; @@ -171,7 +171,7 @@ int32 OS_DirRead_Impl(uint32 local_id, os_dirent_t *dirent) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_DirRewind_Impl(uint32 local_id) +int32 OS_DirRewind_Impl(osal_index_t local_id) { rewinddir(OS_impl_dir_table[local_id].dp); return OS_SUCCESS; diff --git a/src/os/portable/os-impl-posix-dl-loader.c b/src/os/portable/os-impl-posix-dl-loader.c index a946eb65a..2a8036dcc 100644 --- a/src/os/portable/os-impl-posix-dl-loader.c +++ b/src/os/portable/os-impl-posix-dl-loader.c @@ -61,10 +61,10 @@ * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleLoad_Impl(uint32 module_id, const char *translated_path) +int32 OS_ModuleLoad_Impl(osal_index_t module_id, const char *translated_path) { int32 status = OS_ERROR; - int dl_mode; + int dl_mode; /* * RTLD_NOW should instruct dlopen() to resolve all the symbols in the @@ -117,7 +117,7 @@ int32 OS_ModuleLoad_Impl(uint32 module_id, const char *translated_path) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleUnload_Impl(uint32 module_id) +int32 OS_ModuleUnload_Impl(osal_index_t module_id) { int32 status = OS_ERROR; @@ -147,7 +147,7 @@ int32 OS_ModuleUnload_Impl(uint32 module_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleGetInfo_Impl(uint32 module_id, OS_module_prop_t *module_prop) +int32 OS_ModuleGetInfo_Impl(osal_index_t module_id, OS_module_prop_t *module_prop) { /* * Limiting strictly to POSIX-defined API means there is no defined diff --git a/src/os/portable/os-impl-posix-dl-symtab.c b/src/os/portable/os-impl-posix-dl-symtab.c index 2ce8e1acc..ff78c19d5 100644 --- a/src/os/portable/os-impl-posix-dl-symtab.c +++ b/src/os/portable/os-impl-posix-dl-symtab.c @@ -87,7 +87,7 @@ int32 OS_GenericSymbolLookup_Impl(void *dl_handle, cpuaddr *SymbolAddress, const char *SymbolName) { const char *dlError; /* Pointer to error string */ - void *Function; + void * Function; int32 status; status = OS_ERROR; @@ -157,7 +157,7 @@ int32 OS_GlobalSymbolLookup_Impl(cpuaddr *SymbolAddress, const char *SymbolName) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleSymbolLookup_Impl(uint32 local_id, cpuaddr *SymbolAddress, const char *SymbolName) +int32 OS_ModuleSymbolLookup_Impl(osal_index_t local_id, cpuaddr *SymbolAddress, const char *SymbolName) { int32 status; @@ -177,7 +177,7 @@ int32 OS_ModuleSymbolLookup_Impl(uint32 local_id, cpuaddr *SymbolAddress, const * POSIX DL does not provide * *-----------------------------------------------------------------*/ -int32 OS_SymbolTableDump_Impl(const char *filename, uint32 SizeLimit) +int32 OS_SymbolTableDump_Impl(const char *filename, size_t SizeLimit) { /* * Limiting strictly to POSIX-defined API means there is no defined diff --git a/src/os/portable/os-impl-posix-files.c b/src/os/portable/os-impl-posix-files.c index 43628d5df..9ce3008fe 100644 --- a/src/os/portable/os-impl-posix-files.c +++ b/src/os/portable/os-impl-posix-files.c @@ -63,7 +63,7 @@ * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileOpen_Impl(uint32 local_id, const char *local_path, int32 flags, int32 access) +int32 OS_FileOpen_Impl(osal_index_t local_id, const char *local_path, int32 flags, int32 access) { int os_perm; int os_mode; diff --git a/src/os/portable/os-impl-posix-io.c b/src/os/portable/os-impl-posix-io.c index 1f9860cb1..38e45918d 100644 --- a/src/os/portable/os-impl-posix-io.c +++ b/src/os/portable/os-impl-posix-io.c @@ -66,7 +66,7 @@ * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_GenericClose_Impl(uint32 local_id) +int32 OS_GenericClose_Impl(osal_index_t local_id) { int result; @@ -98,7 +98,7 @@ int32 OS_GenericClose_Impl(uint32 local_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_GenericSeek_Impl(uint32 local_id, int32 offset, uint32 whence) +int32 OS_GenericSeek_Impl(osal_index_t local_id, int32 offset, uint32 whence) { int where; int32 result; @@ -153,7 +153,7 @@ int32 OS_GenericSeek_Impl(uint32 local_id, int32 offset, uint32 whence) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_GenericRead_Impl(uint32 local_id, void *buffer, uint32 nbytes, int32 timeout) +int32 OS_GenericRead_Impl(osal_index_t local_id, void *buffer, size_t nbytes, int32 timeout) { int32 return_code; int os_result; @@ -204,7 +204,7 @@ int32 OS_GenericRead_Impl(uint32 local_id, void *buffer, uint32 nbytes, int32 ti * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_GenericWrite_Impl(uint32 local_id, const void *buffer, uint32 nbytes, int32 timeout) +int32 OS_GenericWrite_Impl(osal_index_t local_id, const void *buffer, size_t nbytes, int32 timeout) { int32 return_code; int os_result; diff --git a/src/os/portable/os-impl-posix-network.c b/src/os/portable/os-impl-posix-network.c index bd114b645..f6d5f540a 100644 --- a/src/os/portable/os-impl-posix-network.c +++ b/src/os/portable/os-impl-posix-network.c @@ -58,7 +58,7 @@ * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_NetworkGetHostName_Impl(char *host_name, uint32 name_len) +int32 OS_NetworkGetHostName_Impl(char *host_name, size_t name_len) { int32 return_code; diff --git a/src/os/posix/inc/os-impl-io.h b/src/os/posix/inc/os-impl-io.h index a6154b8ca..f8cf65f62 100644 --- a/src/os/posix/inc/os-impl-io.h +++ b/src/os/posix/inc/os-impl-io.h @@ -39,13 +39,13 @@ typedef struct { int fd; bool selectable; -} OS_Posix_file_internal_record_t; +} OS_impl_file_internal_record_t; /* * The global file handle table. * * This is shared by all OSAL entities that perform low-level I/O. */ -extern OS_Posix_file_internal_record_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; +extern OS_impl_file_internal_record_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; #endif /* INCLUDE_OS_IMPL_IO_H_ */ diff --git a/src/os/posix/inc/os-posix.h b/src/os/posix/inc/os-posix.h index 965ba58f5..c84391db6 100644 --- a/src/os/posix/inc/os-posix.h +++ b/src/os/posix/inc/os-posix.h @@ -74,7 +74,7 @@ typedef struct typedef struct { bool EnableTaskPriorities; - uint32 TruncateQueueDepth; + osal_blockcount_t TruncateQueueDepth; uint32 ClockAccuracyNsec; pthread_key_t ThreadKey; sigset_t MaximumSigMask; @@ -105,10 +105,10 @@ int32 OS_Posix_StreamAPI_Impl_Init(void); int32 OS_Posix_DirAPI_Impl_Init(void); int32 OS_Posix_FileSysAPI_Impl_Init(void); -int32 OS_Posix_TableMutex_Init(uint32 idtype); +int32 OS_Posix_TableMutex_Init(osal_objtype_t idtype); -int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, uint32 priority, size_t stacksz, PthreadFuncPtr_t entry, - void *entry_arg); +int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, osal_priority_t priority, size_t stacksz, + PthreadFuncPtr_t entry, void *entry_arg); void OS_Posix_CompAbsDelayTime(uint32 msecs, struct timespec *tm); #endif /* INCLUDE_OS_POSIX_H_ */ diff --git a/src/os/posix/src/os-impl-binsem.c b/src/os/posix/src/os-impl-binsem.c index 6e27cbb41..89227a2f4 100644 --- a/src/os/posix/src/os-impl-binsem.c +++ b/src/os/posix/src/os-impl-binsem.c @@ -118,7 +118,7 @@ int32 OS_Posix_BinSemAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemCreate_Impl(uint32 sem_id, uint32 initial_value, uint32 options) +int32 OS_BinSemCreate_Impl(osal_index_t sem_id, uint32 initial_value, uint32 options) { int ret; int attr_created; @@ -240,7 +240,7 @@ int32 OS_BinSemCreate_Impl(uint32 sem_id, uint32 initial_value, uint32 options) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemDelete_Impl(uint32 sem_id) +int32 OS_BinSemDelete_Impl(osal_index_t sem_id) { OS_impl_binsem_internal_record_t *sem; int32 return_code; @@ -279,7 +279,7 @@ int32 OS_BinSemDelete_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemGive_Impl(uint32 sem_id) +int32 OS_BinSemGive_Impl(osal_index_t sem_id) { OS_impl_binsem_internal_record_t *sem; @@ -324,7 +324,7 @@ int32 OS_BinSemGive_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemFlush_Impl(uint32 sem_id) +int32 OS_BinSemFlush_Impl(osal_index_t sem_id) { OS_impl_binsem_internal_record_t *sem; @@ -441,7 +441,7 @@ static int32 OS_GenericBinSemTake_Impl(OS_impl_binsem_internal_record_t *sem, co * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemTake_Impl(uint32 sem_id) +int32 OS_BinSemTake_Impl(osal_index_t sem_id) { return (OS_GenericBinSemTake_Impl(&OS_impl_bin_sem_table[sem_id], NULL)); } /* end OS_BinSemTake_Impl */ @@ -454,7 +454,7 @@ int32 OS_BinSemTake_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemTimedWait_Impl(uint32 sem_id, uint32 msecs) +int32 OS_BinSemTimedWait_Impl(osal_index_t sem_id, uint32 msecs) { struct timespec ts; @@ -474,7 +474,7 @@ int32 OS_BinSemTimedWait_Impl(uint32 sem_id, uint32 msecs) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemGetInfo_Impl(uint32 sem_id, OS_bin_sem_prop_t *sem_prop) +int32 OS_BinSemGetInfo_Impl(osal_index_t sem_id, OS_bin_sem_prop_t *sem_prop) { /* put the info into the stucture */ sem_prop->value = OS_impl_bin_sem_table[sem_id].current_value; diff --git a/src/os/posix/src/os-impl-common.c b/src/os/posix/src/os-impl-common.c index 4412dba35..23452b603 100644 --- a/src/os/posix/src/os-impl-common.c +++ b/src/os/posix/src/os-impl-common.c @@ -52,7 +52,7 @@ POSIX_GlobalVars_t POSIX_GlobalVars = {0}; returns: OS_SUCCESS or OS_ERROR ---------------------------------------------------------------------------------------*/ -int32 OS_API_Impl_Init(uint32 idtype) +int32 OS_API_Impl_Init(osal_objtype_t idtype) { int32 return_code; diff --git a/src/os/posix/src/os-impl-console.c b/src/os/posix/src/os-impl-console.c index a97799683..be6197a6f 100644 --- a/src/os/posix/src/os-impl-console.c +++ b/src/os/posix/src/os-impl-console.c @@ -59,7 +59,7 @@ OS_impl_console_internal_record_t OS_impl_console_table[OS_MAX_CONSOLES]; * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -void OS_ConsoleWakeup_Impl(uint32 local_id) +void OS_ConsoleWakeup_Impl(osal_index_t local_id) { OS_impl_console_internal_record_t *local = &OS_impl_console_table[local_id]; @@ -89,10 +89,10 @@ static void *OS_ConsoleTask_Entry(void *arg) OS_impl_console_internal_record_t *local; local_arg.opaque_arg = arg; - local = &OS_impl_console_table[local_arg.value]; + local = &OS_impl_console_table[local_arg.idx]; while (true) { - OS_ConsoleOutput_Impl(local_arg.value); + OS_ConsoleOutput_Impl(local_arg.idx); sem_wait(&local->data_sem); } return NULL; @@ -106,7 +106,7 @@ static void *OS_ConsoleTask_Entry(void *arg) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ConsoleCreate_Impl(uint32 local_id) +int32 OS_ConsoleCreate_Impl(osal_index_t local_id) { OS_impl_console_internal_record_t *local = &OS_impl_console_table[local_id]; pthread_t consoletask; @@ -126,8 +126,8 @@ int32 OS_ConsoleCreate_Impl(uint32 local_id) } else { - local_arg.value = local_id; - return_code = OS_Posix_InternalTaskCreate_Impl(&consoletask, OS_CONSOLE_TASK_PRIORITY, 0, + local_arg.idx = local_id; + return_code = OS_Posix_InternalTaskCreate_Impl(&consoletask, OS_CONSOLE_TASK_PRIORITY, 0, OS_ConsoleTask_Entry, local_arg.opaque_arg); if (return_code != OS_SUCCESS) diff --git a/src/os/posix/src/os-impl-countsem.c b/src/os/posix/src/os-impl-countsem.c index 22fd5cc71..d399e0857 100644 --- a/src/os/posix/src/os-impl-countsem.c +++ b/src/os/posix/src/os-impl-countsem.c @@ -74,7 +74,7 @@ int32 OS_Posix_CountSemAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 options) +int32 OS_CountSemCreate_Impl(osal_index_t sem_id, uint32 sem_initial_value, uint32 options) { if (sem_initial_value > SEM_VALUE_MAX) { @@ -98,7 +98,7 @@ int32 OS_CountSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 opt * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemDelete_Impl(uint32 sem_id) +int32 OS_CountSemDelete_Impl(osal_index_t sem_id) { if (sem_destroy(&OS_impl_count_sem_table[sem_id].id) < 0) { @@ -117,7 +117,7 @@ int32 OS_CountSemDelete_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemGive_Impl(uint32 sem_id) +int32 OS_CountSemGive_Impl(osal_index_t sem_id) { if (sem_post(&OS_impl_count_sem_table[sem_id].id) < 0) { @@ -136,7 +136,7 @@ int32 OS_CountSemGive_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemTake_Impl(uint32 sem_id) +int32 OS_CountSemTake_Impl(osal_index_t sem_id) { if (sem_wait(&OS_impl_count_sem_table[sem_id].id) < 0) { @@ -154,7 +154,7 @@ int32 OS_CountSemTake_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemTimedWait_Impl(uint32 sem_id, uint32 msecs) +int32 OS_CountSemTimedWait_Impl(osal_index_t sem_id, uint32 msecs) { struct timespec ts; int result; @@ -189,7 +189,7 @@ int32 OS_CountSemTimedWait_Impl(uint32 sem_id, uint32 msecs) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemGetInfo_Impl(uint32 sem_id, OS_count_sem_prop_t *count_prop) +int32 OS_CountSemGetInfo_Impl(osal_index_t sem_id, OS_count_sem_prop_t *count_prop) { int sval; diff --git a/src/os/posix/src/os-impl-files.c b/src/os/posix/src/os-impl-files.c index 320867963..c828947b0 100644 --- a/src/os/posix/src/os-impl-files.c +++ b/src/os/posix/src/os-impl-files.c @@ -48,7 +48,7 @@ * * This is shared by all OSAL entities that perform low-level I/O. */ -OS_Posix_file_internal_record_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; +OS_impl_file_internal_record_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; /* * These two constants (EUID and EGID) are local cache of the @@ -85,7 +85,7 @@ const int OS_IMPL_REGULAR_FILE_FLAGS = O_NONBLOCK; ---------------------------------------------------------------------------------------*/ int32 OS_Posix_StreamAPI_Impl_Init(void) { - uint32 local_id; + osal_index_t local_id; /* * init all filehandles to -1, which is always invalid. diff --git a/src/os/posix/src/os-impl-filesys.c b/src/os/posix/src/os-impl-filesys.c index bd67779cb..6e71e3321 100644 --- a/src/os/posix/src/os-impl-filesys.c +++ b/src/os/posix/src/os-impl-filesys.c @@ -82,7 +82,7 @@ int32 OS_Posix_FileSysAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysStartVolume_Impl(uint32 filesys_id) +int32 OS_FileSysStartVolume_Impl(osal_index_t filesys_id) { OS_filesys_internal_record_t *local = &OS_filesys_table[filesys_id]; struct stat stat_buf; @@ -184,7 +184,7 @@ int32 OS_FileSysStartVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysStopVolume_Impl(uint32 filesys_id) +int32 OS_FileSysStopVolume_Impl(osal_index_t filesys_id) { /* * This is a no-op. @@ -207,7 +207,7 @@ int32 OS_FileSysStopVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysFormatVolume_Impl(uint32 filesys_id) +int32 OS_FileSysFormatVolume_Impl(osal_index_t filesys_id) { /* * In theory, this should wipe any existing files in the ramdisk, @@ -230,7 +230,7 @@ int32 OS_FileSysFormatVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysMountVolume_Impl(uint32 filesys_id) +int32 OS_FileSysMountVolume_Impl(osal_index_t filesys_id) { OS_filesys_internal_record_t *local = &OS_filesys_table[filesys_id]; struct stat stat_buf; @@ -282,7 +282,7 @@ int32 OS_FileSysMountVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysUnmountVolume_Impl(uint32 filesys_id) +int32 OS_FileSysUnmountVolume_Impl(osal_index_t filesys_id) { /* * NOTE: Mounting/Unmounting on POSIX is not implemented. @@ -303,7 +303,7 @@ int32 OS_FileSysUnmountVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysStatVolume_Impl(uint32 filesys_id, OS_statvfs_t *result) +int32 OS_FileSysStatVolume_Impl(osal_index_t filesys_id, OS_statvfs_t *result) { OS_filesys_internal_record_t *local = &OS_filesys_table[filesys_id]; struct statvfs stat_buf; @@ -313,9 +313,9 @@ int32 OS_FileSysStatVolume_Impl(uint32 filesys_id, OS_statvfs_t *result) return OS_ERROR; } - result->block_size = stat_buf.f_bsize; - result->blocks_free = stat_buf.f_bfree; - result->total_blocks = stat_buf.f_blocks; + result->block_size = OSAL_SIZE_C(stat_buf.f_bsize); + result->blocks_free = OSAL_BLOCKCOUNT_C(stat_buf.f_bfree); + result->total_blocks = OSAL_BLOCKCOUNT_C(stat_buf.f_blocks); return (OS_SUCCESS); } /* end OS_FileSysStatVolume_Impl */ @@ -328,7 +328,7 @@ int32 OS_FileSysStatVolume_Impl(uint32 filesys_id, OS_statvfs_t *result) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysCheckVolume_Impl(uint32 filesys_id, bool repair) +int32 OS_FileSysCheckVolume_Impl(osal_index_t filesys_id, bool repair) { return OS_ERR_NOT_IMPLEMENTED; } /* end OS_FileSysCheckVolume_Impl */ diff --git a/src/os/posix/src/os-impl-idmap.c b/src/os/posix/src/os-impl-idmap.c index 233d81d15..64b29aeef 100644 --- a/src/os/posix/src/os-impl-idmap.c +++ b/src/os/posix/src/os-impl-idmap.c @@ -83,7 +83,7 @@ enum * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_Lock_Global_Impl(uint32 idtype) +int32 OS_Lock_Global_Impl(osal_objtype_t idtype) { POSIX_GlobalLock_t *mut; sigset_t previous; @@ -119,7 +119,7 @@ int32 OS_Lock_Global_Impl(uint32 idtype) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_Unlock_Global_Impl(uint32 idtype) +int32 OS_Unlock_Global_Impl(osal_objtype_t idtype) { POSIX_GlobalLock_t *mut; sigset_t previous; @@ -158,7 +158,7 @@ int32 OS_Unlock_Global_Impl(uint32 idtype) returns: OS_SUCCESS or OS_ERROR ---------------------------------------------------------------------------------------*/ -int32 OS_Posix_TableMutex_Init(uint32 idtype) +int32 OS_Posix_TableMutex_Init(osal_objtype_t idtype) { int ret; int32 return_code = OS_SUCCESS; diff --git a/src/os/posix/src/os-impl-mutex.c b/src/os/posix/src/os-impl-mutex.c index 3fbd17479..8d6de200a 100644 --- a/src/os/posix/src/os-impl-mutex.c +++ b/src/os/posix/src/os-impl-mutex.c @@ -61,7 +61,7 @@ int32 OS_Posix_MutexAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemCreate_Impl(uint32 sem_id, uint32 options) +int32 OS_MutSemCreate_Impl(osal_index_t sem_id, uint32 options) { int return_code; pthread_mutexattr_t mutex_attr; @@ -121,7 +121,7 @@ int32 OS_MutSemCreate_Impl(uint32 sem_id, uint32 options) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemDelete_Impl(uint32 sem_id) +int32 OS_MutSemDelete_Impl(osal_index_t sem_id) { int status; @@ -144,7 +144,7 @@ int32 OS_MutSemDelete_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemGive_Impl(uint32 sem_id) +int32 OS_MutSemGive_Impl(osal_index_t sem_id) { int status; @@ -168,7 +168,7 @@ int32 OS_MutSemGive_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemTake_Impl(uint32 sem_id) +int32 OS_MutSemTake_Impl(osal_index_t sem_id) { int status; @@ -192,7 +192,7 @@ int32 OS_MutSemTake_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemGetInfo_Impl(uint32 sem_id, OS_mut_sem_prop_t *mut_prop) +int32 OS_MutSemGetInfo_Impl(osal_index_t sem_id, OS_mut_sem_prop_t *mut_prop) { return OS_SUCCESS; diff --git a/src/os/posix/src/os-impl-queues.c b/src/os/posix/src/os-impl-queues.c index bb5f505d8..913d0773b 100644 --- a/src/os/posix/src/os-impl-queues.c +++ b/src/os/posix/src/os-impl-queues.c @@ -67,7 +67,7 @@ int32 OS_Posix_QueueAPI_Impl_Init(void) /* * Initialize this to zero to indicate no limit */ - POSIX_GlobalVars.TruncateQueueDepth = 0; + POSIX_GlobalVars.TruncateQueueDepth = OSAL_BLOCKCOUNT_C(0); #endif return OS_SUCCESS; @@ -81,7 +81,7 @@ int32 OS_Posix_QueueAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueueCreate_Impl(uint32 queue_id, uint32 flags) +int32 OS_QueueCreate_Impl(osal_index_t queue_id, uint32 flags) { int return_code; mqd_t queueDesc; @@ -159,7 +159,7 @@ int32 OS_QueueCreate_Impl(uint32 queue_id, uint32 flags) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueueDelete_Impl(uint32 queue_id) +int32 OS_QueueDelete_Impl(osal_index_t queue_id) { int32 return_code; @@ -185,7 +185,7 @@ int32 OS_QueueDelete_Impl(uint32 queue_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueueGet_Impl(uint32 queue_id, void *data, uint32 size, uint32 *size_copied, int32 timeout) +int32 OS_QueueGet_Impl(osal_index_t queue_id, void *data, size_t size, size_t *size_copied, int32 timeout) { int32 return_code; ssize_t sizeCopied; @@ -240,7 +240,7 @@ int32 OS_QueueGet_Impl(uint32 queue_id, void *data, uint32 size, uint32 *size_co /* Figure out the return code */ if (sizeCopied == -1) { - *size_copied = 0; + *size_copied = OSAL_SIZE_C(0); /* Map the system errno to the most appropriate OSAL return code */ if (errno == EMSGSIZE) @@ -266,7 +266,7 @@ int32 OS_QueueGet_Impl(uint32 queue_id, void *data, uint32 size, uint32 *size_co } else { - *size_copied = sizeCopied; + *size_copied = OSAL_SIZE_C(sizeCopied); return_code = OS_SUCCESS; } @@ -281,7 +281,7 @@ int32 OS_QueueGet_Impl(uint32 queue_id, void *data, uint32 size, uint32 *size_co * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueuePut_Impl(uint32 queue_id, const void *data, uint32 size, uint32 flags) +int32 OS_QueuePut_Impl(osal_index_t queue_id, const void *data, size_t size, uint32 flags) { int32 return_code; int result; diff --git a/src/os/posix/src/os-impl-shell.c b/src/os/posix/src/os-impl-shell.c index 76cb1538c..e85654380 100644 --- a/src/os/posix/src/os-impl-shell.c +++ b/src/os/posix/src/os-impl-shell.c @@ -57,7 +57,7 @@ * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ShellOutputToFile_Impl(uint32 file_id, const char *Cmd) +int32 OS_ShellOutputToFile_Impl(osal_index_t file_id, const char *Cmd) { pid_t cpid; uint32 local_id; diff --git a/src/os/posix/src/os-impl-tasks.c b/src/os/posix/src/os-impl-tasks.c index ab6cdf4aa..a529264ee 100644 --- a/src/os/posix/src/os-impl-tasks.c +++ b/src/os/posix/src/os-impl-tasks.c @@ -61,7 +61,7 @@ OS_impl_task_internal_record_t OS_impl_task_table[OS_MAX_TASKS]; * to be within the range of [0,OS_MAX_TASK_PRIORITY] * ----------------------------------------------------------------------------*/ -static int OS_PriorityRemap(uint32 InputPri) +static int OS_PriorityRemap(osal_priority_t InputPri) { int OutputPri; @@ -429,8 +429,8 @@ int32 OS_Posix_TaskAPI_Impl_Init(void) * Purpose: Local helper routine, not part of OSAL API. * *-----------------------------------------------------------------*/ -int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, uint32 priority, size_t stacksz, PthreadFuncPtr_t entry, - void *entry_arg) +int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, osal_priority_t priority, size_t stacksz, + PthreadFuncPtr_t entry, void *entry_arg) { int return_code = 0; pthread_attr_t custom_attr; @@ -564,7 +564,7 @@ int32 OS_Posix_InternalTaskCreate_Impl(pthread_t *pthr, uint32 priority, size_t * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskCreate_Impl(uint32 task_id, uint32 flags) +int32 OS_TaskCreate_Impl(osal_index_t task_id, uint32 flags) { OS_U32ValueWrapper_t arg; int32 return_code; @@ -587,7 +587,7 @@ int32 OS_TaskCreate_Impl(uint32 task_id, uint32 flags) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskMatch_Impl(uint32 task_id) +int32 OS_TaskMatch_Impl(osal_index_t task_id) { if (pthread_equal(pthread_self(), OS_impl_task_table[task_id].id) == 0) { @@ -605,7 +605,7 @@ int32 OS_TaskMatch_Impl(uint32 task_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskDelete_Impl(uint32 task_id) +int32 OS_TaskDelete_Impl(osal_index_t task_id) { /* ** Try to delete the task @@ -678,7 +678,7 @@ int32 OS_TaskDelay_Impl(uint32 millisecond) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskSetPriority_Impl(uint32 task_id, uint32 new_priority) +int32 OS_TaskSetPriority_Impl(osal_index_t task_id, osal_priority_t new_priority) { int os_priority; int ret; @@ -758,7 +758,7 @@ osal_id_t OS_TaskGetId_Impl(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskGetInfo_Impl(uint32 task_id, OS_task_prop_t *task_prop) +int32 OS_TaskGetInfo_Impl(osal_index_t task_id, OS_task_prop_t *task_prop) { return OS_SUCCESS; } /* end OS_TaskGetInfo_Impl */ @@ -771,7 +771,7 @@ int32 OS_TaskGetInfo_Impl(uint32 task_id, OS_task_prop_t *task_prop) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -bool OS_TaskIdMatchSystemData_Impl(void *ref, uint32 local_id, const OS_common_record_t *obj) +bool OS_TaskIdMatchSystemData_Impl(void *ref, osal_index_t local_id, const OS_common_record_t *obj) { const pthread_t *target = (const pthread_t *)ref; @@ -786,7 +786,7 @@ bool OS_TaskIdMatchSystemData_Impl(void *ref, uint32 local_id, const OS_common_r * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskValidateSystemData_Impl(const void *sysdata, uint32 sysdata_size) +int32 OS_TaskValidateSystemData_Impl(const void *sysdata, size_t sysdata_size) { if (sysdata == NULL || sysdata_size != sizeof(pthread_t)) { diff --git a/src/os/posix/src/os-impl-timebase.c b/src/os/posix/src/os-impl-timebase.c index c4c23b13e..a576332d9 100644 --- a/src/os/posix/src/os-impl-timebase.c +++ b/src/os/posix/src/os-impl-timebase.c @@ -108,7 +108,7 @@ static void OS_UsecToTimespec(uint32 usecs, struct timespec *time_spec) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -void OS_TimeBaseLock_Impl(uint32 local_id) +void OS_TimeBaseLock_Impl(osal_index_t local_id) { pthread_mutex_lock(&OS_impl_timebase_table[local_id].handler_mutex); } /* end OS_TimeBaseLock_Impl */ @@ -121,7 +121,7 @@ void OS_TimeBaseLock_Impl(uint32 local_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -void OS_TimeBaseUnlock_Impl(uint32 local_id) +void OS_TimeBaseUnlock_Impl(osal_index_t local_id) { pthread_mutex_unlock(&OS_impl_timebase_table[local_id].handler_mutex); } /* end OS_TimeBaseUnlock_Impl */ @@ -133,7 +133,7 @@ void OS_TimeBaseUnlock_Impl(uint32 local_id) * Purpose: Local helper routine, not part of OSAL API. * *-----------------------------------------------------------------*/ -static uint32 OS_TimeBase_SigWaitImpl(uint32 timer_id) +static uint32 OS_TimeBase_SigWaitImpl(osal_index_t timer_id) { int ret; OS_impl_timebase_internal_record_t *local; @@ -190,7 +190,7 @@ static uint32 OS_TimeBase_SigWaitImpl(uint32 timer_id) int32 OS_Posix_TimeBaseAPI_Impl_Init(void) { int status; - int i; + osal_index_t idx; pthread_mutexattr_t mutex_attr; struct timespec clock_resolution; int32 return_code; @@ -253,14 +253,14 @@ int32 OS_Posix_TimeBaseAPI_Impl_Init(void) break; } - for (i = 0; i < OS_MAX_TIMEBASES; ++i) + for (idx = 0; idx < OS_MAX_TIMEBASES; ++idx) { /* ** create the timebase sync mutex ** This gives a mechanism to synchronize updates to the timer chain with the ** expiration of the timer and processing the chain. */ - status = pthread_mutex_init(&OS_impl_timebase_table[i].handler_mutex, &mutex_attr); + status = pthread_mutex_init(&OS_impl_timebase_table[idx].handler_mutex, &mutex_attr); if (status != 0) { OS_DEBUG("Error: Mutex could not be created: %s\n", strerror(status)); @@ -314,11 +314,12 @@ static void *OS_TimeBasePthreadEntry(void *arg) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseCreate_Impl(uint32 timer_id) +int32 OS_TimeBaseCreate_Impl(osal_index_t timer_id) { int32 return_code; int status; int i; + osal_index_t idx; struct sigevent evp; struct timespec ts; OS_impl_timebase_internal_record_t *local; @@ -340,8 +341,8 @@ int32 OS_TimeBaseCreate_Impl(uint32 timer_id) */ arg.opaque_arg = NULL; arg.id = global->active_id; - return_code = - OS_Posix_InternalTaskCreate_Impl(&local->handler_thread, 0, 0, OS_TimeBasePthreadEntry, arg.opaque_arg); + return_code = OS_Posix_InternalTaskCreate_Impl(&local->handler_thread, OSAL_PRIORITY_C(0), 0, + OS_TimeBasePthreadEntry, arg.opaque_arg); if (return_code != OS_SUCCESS) { return return_code; @@ -368,12 +369,12 @@ int32 OS_TimeBaseCreate_Impl(uint32 timer_id) * This is all done while the global lock is held so no chance of the * underlying tables changing */ - for (i = 0; i < OS_MAX_TIMEBASES; ++i) + for (idx = 0; idx < OS_MAX_TIMEBASES; ++idx) { - if (i != timer_id && OS_ObjectIdDefined(OS_global_timebase_table[i].active_id) && - OS_impl_timebase_table[i].assigned_signal != 0) + if (idx != timer_id && OS_ObjectIdDefined(OS_global_timebase_table[idx].active_id) && + OS_impl_timebase_table[idx].assigned_signal != 0) { - sigaddset(&local->sigset, OS_impl_timebase_table[i].assigned_signal); + sigaddset(&local->sigset, OS_impl_timebase_table[idx].assigned_signal); } } @@ -479,7 +480,7 @@ int32 OS_TimeBaseCreate_Impl(uint32 timer_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseSet_Impl(uint32 timer_id, int32 start_time, int32 interval_time) +int32 OS_TimeBaseSet_Impl(osal_index_t timer_id, int32 start_time, int32 interval_time) { OS_impl_timebase_internal_record_t *local; struct itimerspec timeout; @@ -533,7 +534,7 @@ int32 OS_TimeBaseSet_Impl(uint32 timer_id, int32 start_time, int32 interval_time * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseDelete_Impl(uint32 timer_id) +int32 OS_TimeBaseDelete_Impl(osal_index_t timer_id) { OS_impl_timebase_internal_record_t *local; int status; @@ -568,7 +569,7 @@ int32 OS_TimeBaseDelete_Impl(uint32 timer_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseGetInfo_Impl(uint32 timer_id, OS_timebase_prop_t *timer_prop) +int32 OS_TimeBaseGetInfo_Impl(osal_index_t timer_id, OS_timebase_prop_t *timer_prop) { return OS_SUCCESS; diff --git a/src/os/rtems/inc/os-rtems.h b/src/os/rtems/inc/os-rtems.h index c8cf01159..4f4a1a76a 100644 --- a/src/os/rtems/inc/os-rtems.h +++ b/src/os/rtems/inc/os-rtems.h @@ -84,6 +84,6 @@ int32 OS_Rtems_StreamAPI_Impl_Init(void); int32 OS_Rtems_DirAPI_Impl_Init(void); int32 OS_Rtems_FileSysAPI_Impl_Init(void); -int32 OS_Rtems_TableMutex_Init(uint32 idtype); +int32 OS_Rtems_TableMutex_Init(osal_objtype_t idtype); #endif /* INCLUDE_OS_RTEMS_H_ */ diff --git a/src/os/rtems/src/os-impl-binsem.c b/src/os/rtems/src/os-impl-binsem.c index 5d34c2079..d3a8933bf 100644 --- a/src/os/rtems/src/os-impl-binsem.c +++ b/src/os/rtems/src/os-impl-binsem.c @@ -87,7 +87,7 @@ int32 OS_Rtems_BinSemAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 options) +int32 OS_BinSemCreate_Impl(osal_index_t sem_id, uint32 sem_initial_value, uint32 options) { rtems_status_code status; rtems_name r_name; @@ -128,7 +128,7 @@ int32 OS_BinSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 optio * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemDelete_Impl(uint32 sem_id) +int32 OS_BinSemDelete_Impl(osal_index_t sem_id) { rtems_status_code status; @@ -151,7 +151,7 @@ int32 OS_BinSemDelete_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemGive_Impl(uint32 sem_id) +int32 OS_BinSemGive_Impl(osal_index_t sem_id) { rtems_status_code status; @@ -173,7 +173,7 @@ int32 OS_BinSemGive_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemFlush_Impl(uint32 sem_id) +int32 OS_BinSemFlush_Impl(osal_index_t sem_id) { rtems_status_code status; @@ -197,7 +197,7 @@ int32 OS_BinSemFlush_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemTake_Impl(uint32 sem_id) +int32 OS_BinSemTake_Impl(osal_index_t sem_id) { rtems_status_code status; @@ -228,7 +228,7 @@ int32 OS_BinSemTake_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemTimedWait_Impl(uint32 sem_id, uint32 msecs) +int32 OS_BinSemTimedWait_Impl(osal_index_t sem_id, uint32 msecs) { rtems_status_code status; int TimeInTicks; @@ -264,7 +264,7 @@ int32 OS_BinSemTimedWait_Impl(uint32 sem_id, uint32 msecs) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemGetInfo_Impl(uint32 sem_id, OS_bin_sem_prop_t *bin_prop) +int32 OS_BinSemGetInfo_Impl(osal_index_t sem_id, OS_bin_sem_prop_t *bin_prop) { /* RTEMS has no API for obtaining the current value of a semaphore */ return OS_SUCCESS; diff --git a/src/os/rtems/src/os-impl-common.c b/src/os/rtems/src/os-impl-common.c index 2d396901b..4e0720103 100644 --- a/src/os/rtems/src/os-impl-common.c +++ b/src/os/rtems/src/os-impl-common.c @@ -52,7 +52,7 @@ RTEMS_GlobalVars_t RTEMS_GlobalVars = {0}; returns: OS_SUCCESS or OS_ERROR ---------------------------------------------------------------------------------------*/ -int32 OS_API_Impl_Init(uint32 idtype) +int32 OS_API_Impl_Init(osal_objtype_t idtype) { int32 return_code; diff --git a/src/os/rtems/src/os-impl-console.c b/src/os/rtems/src/os-impl-console.c index 84c84ae0c..7bad84748 100644 --- a/src/os/rtems/src/os-impl-console.c +++ b/src/os/rtems/src/os-impl-console.c @@ -86,7 +86,7 @@ OS_impl_console_internal_record_t OS_impl_console_table[OS_MAX_CONSOLES]; * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -void OS_ConsoleWakeup_Impl(uint32 local_id) +void OS_ConsoleWakeup_Impl(osal_index_t local_id) { OS_impl_console_internal_record_t *local = &OS_impl_console_table[local_id]; @@ -130,7 +130,7 @@ static void OS_ConsoleTask_Entry(rtems_task_argument arg) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ConsoleCreate_Impl(uint32 local_id) +int32 OS_ConsoleCreate_Impl(osal_index_t local_id) { OS_impl_console_internal_record_t *local = &OS_impl_console_table[local_id]; int32 return_code; diff --git a/src/os/rtems/src/os-impl-countsem.c b/src/os/rtems/src/os-impl-countsem.c index 21b3caeee..11c294918 100644 --- a/src/os/rtems/src/os-impl-countsem.c +++ b/src/os/rtems/src/os-impl-countsem.c @@ -84,7 +84,7 @@ int32 OS_Rtems_CountSemAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 options) +int32 OS_CountSemCreate_Impl(osal_index_t sem_id, uint32 sem_initial_value, uint32 options) { rtems_status_code status; rtems_name r_name; @@ -125,7 +125,7 @@ int32 OS_CountSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 opt * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemDelete_Impl(uint32 sem_id) +int32 OS_CountSemDelete_Impl(osal_index_t sem_id) { rtems_status_code status; @@ -148,7 +148,7 @@ int32 OS_CountSemDelete_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemGive_Impl(uint32 sem_id) +int32 OS_CountSemGive_Impl(osal_index_t sem_id) { rtems_status_code status; @@ -171,7 +171,7 @@ int32 OS_CountSemGive_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemTake_Impl(uint32 sem_id) +int32 OS_CountSemTake_Impl(osal_index_t sem_id) { rtems_status_code status; @@ -194,7 +194,7 @@ int32 OS_CountSemTake_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemTimedWait_Impl(uint32 sem_id, uint32 msecs) +int32 OS_CountSemTimedWait_Impl(osal_index_t sem_id, uint32 msecs) { rtems_status_code status; int TimeInTicks; @@ -228,7 +228,7 @@ int32 OS_CountSemTimedWait_Impl(uint32 sem_id, uint32 msecs) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemGetInfo_Impl(uint32 sem_id, OS_count_sem_prop_t *count_prop) +int32 OS_CountSemGetInfo_Impl(osal_index_t sem_id, OS_count_sem_prop_t *count_prop) { /* RTEMS does not provide an API to get the value */ return OS_SUCCESS; diff --git a/src/os/rtems/src/os-impl-filesys.c b/src/os/rtems/src/os-impl-filesys.c index 1ad989e03..3583303c7 100644 --- a/src/os/rtems/src/os-impl-filesys.c +++ b/src/os/rtems/src/os-impl-filesys.c @@ -104,7 +104,7 @@ int32 OS_Rtems_FileSysAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysStartVolume_Impl(uint32 filesys_id) +int32 OS_FileSysStartVolume_Impl(osal_index_t filesys_id) { OS_filesys_internal_record_t * local = &OS_filesys_table[filesys_id]; OS_impl_filesys_internal_record_t *impl = &OS_impl_filesys_table[filesys_id]; @@ -205,7 +205,7 @@ int32 OS_FileSysStartVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysStopVolume_Impl(uint32 filesys_id) +int32 OS_FileSysStopVolume_Impl(osal_index_t filesys_id) { OS_impl_filesys_internal_record_t *impl = &OS_impl_filesys_table[filesys_id]; @@ -229,7 +229,7 @@ int32 OS_FileSysStopVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysFormatVolume_Impl(uint32 filesys_id) +int32 OS_FileSysFormatVolume_Impl(osal_index_t filesys_id) { OS_filesys_internal_record_t * local = &OS_filesys_table[filesys_id]; OS_impl_filesys_internal_record_t *impl = &OS_impl_filesys_table[filesys_id]; @@ -291,7 +291,7 @@ int32 OS_FileSysFormatVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysMountVolume_Impl(uint32 filesys_id) +int32 OS_FileSysMountVolume_Impl(osal_index_t filesys_id) { OS_filesys_internal_record_t * local = &OS_filesys_table[filesys_id]; OS_impl_filesys_internal_record_t *impl = &OS_impl_filesys_table[filesys_id]; @@ -345,7 +345,7 @@ int32 OS_FileSysMountVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysUnmountVolume_Impl(uint32 filesys_id) +int32 OS_FileSysUnmountVolume_Impl(osal_index_t filesys_id) { OS_filesys_internal_record_t *local = &OS_filesys_table[filesys_id]; @@ -373,7 +373,7 @@ int32 OS_FileSysUnmountVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysStatVolume_Impl(uint32 filesys_id, OS_statvfs_t *result) +int32 OS_FileSysStatVolume_Impl(osal_index_t filesys_id, OS_statvfs_t *result) { OS_filesys_internal_record_t *local = &OS_filesys_table[filesys_id]; struct statvfs stat_buf; @@ -415,7 +415,7 @@ int32 OS_FileSysStatVolume_Impl(uint32 filesys_id, OS_statvfs_t *result) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysCheckVolume_Impl(uint32 filesys_id, bool repair) +int32 OS_FileSysCheckVolume_Impl(osal_index_t filesys_id, bool repair) { return OS_ERR_NOT_IMPLEMENTED; } /* end OS_FileSysCheckVolume_Impl */ diff --git a/src/os/rtems/src/os-impl-idmap.c b/src/os/rtems/src/os-impl-idmap.c index 6d6b15f00..7e08b6986 100644 --- a/src/os/rtems/src/os-impl-idmap.c +++ b/src/os/rtems/src/os-impl-idmap.c @@ -86,7 +86,7 @@ enum * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_Lock_Global_Impl(uint32 idtype) +int32 OS_Lock_Global_Impl(osal_objtype_t idtype) { rtems_id *mut; @@ -120,7 +120,7 @@ int32 OS_Lock_Global_Impl(uint32 idtype) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_Unlock_Global_Impl(uint32 idtype) +int32 OS_Unlock_Global_Impl(osal_objtype_t idtype) { rtems_id *mut; @@ -158,7 +158,7 @@ int32 OS_Unlock_Global_Impl(uint32 idtype) returns: OS_SUCCESS or OS_ERROR ---------------------------------------------------------------------------------------*/ -int32 OS_Rtems_TableMutex_Init(uint32 idtype) +int32 OS_Rtems_TableMutex_Init(osal_objtype_t idtype) { int32 return_code = OS_SUCCESS; rtems_status_code rtems_sc; diff --git a/src/os/rtems/src/os-impl-loader.c b/src/os/rtems/src/os-impl-loader.c index 89fbbedce..f3f1fb1d8 100644 --- a/src/os/rtems/src/os-impl-loader.c +++ b/src/os/rtems/src/os-impl-loader.c @@ -104,7 +104,7 @@ static bool OS_rtems_rtl_check_unresolved(rtems_rtl_unresolv_rec_t *rec, void *d * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleLoad_Impl(uint32 module_id, const char *translated_path) +int32 OS_ModuleLoad_Impl(osal_index_t module_id, const char *translated_path) { int32 status = OS_ERROR; int unresolved; @@ -177,7 +177,7 @@ int32 OS_ModuleLoad_Impl(uint32 module_id, const char *translated_path) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleUnload_Impl(uint32 module_id) +int32 OS_ModuleUnload_Impl(osal_index_t module_id) { int32 status = OS_ERROR; @@ -207,7 +207,7 @@ int32 OS_ModuleUnload_Impl(uint32 module_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleGetInfo_Impl(uint32 module_id, OS_module_prop_t *module_prop) +int32 OS_ModuleGetInfo_Impl(osal_index_t module_id, OS_module_prop_t *module_prop) { /* ** RTEMS does not specify a way to get these values diff --git a/src/os/rtems/src/os-impl-mutex.c b/src/os/rtems/src/os-impl-mutex.c index 4ae538954..c02b95665 100644 --- a/src/os/rtems/src/os-impl-mutex.c +++ b/src/os/rtems/src/os-impl-mutex.c @@ -85,7 +85,7 @@ int32 OS_Rtems_MutexAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemCreate_Impl(uint32 sem_id, uint32 options) +int32 OS_MutSemCreate_Impl(osal_index_t sem_id, uint32 options) { rtems_status_code status; rtems_name r_name; @@ -114,7 +114,7 @@ int32 OS_MutSemCreate_Impl(uint32 sem_id, uint32 options) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemDelete_Impl(uint32 sem_id) +int32 OS_MutSemDelete_Impl(osal_index_t sem_id) { rtems_status_code status; @@ -138,7 +138,7 @@ int32 OS_MutSemDelete_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemGive_Impl(uint32 sem_id) +int32 OS_MutSemGive_Impl(osal_index_t sem_id) { rtems_status_code status; @@ -163,7 +163,7 @@ int32 OS_MutSemGive_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemTake_Impl(uint32 sem_id) +int32 OS_MutSemTake_Impl(osal_index_t sem_id) { rtems_status_code status; @@ -187,7 +187,7 @@ int32 OS_MutSemTake_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemGetInfo_Impl(uint32 sem_id, OS_mut_sem_prop_t *mut_prop) +int32 OS_MutSemGetInfo_Impl(osal_index_t sem_id, OS_mut_sem_prop_t *mut_prop) { /* RTEMS provides no additional info */ return OS_SUCCESS; diff --git a/src/os/rtems/src/os-impl-queues.c b/src/os/rtems/src/os-impl-queues.c index dcd9ddbe8..f94385f5c 100644 --- a/src/os/rtems/src/os-impl-queues.c +++ b/src/os/rtems/src/os-impl-queues.c @@ -78,7 +78,7 @@ int32 OS_Rtems_QueueAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueueCreate_Impl(uint32 queue_id, uint32 flags) +int32 OS_QueueCreate_Impl(osal_index_t queue_id, uint32 flags) { rtems_status_code status; rtems_name r_name; @@ -125,7 +125,7 @@ int32 OS_QueueCreate_Impl(uint32 queue_id, uint32 flags) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueueDelete_Impl(uint32 queue_id) +int32 OS_QueueDelete_Impl(osal_index_t queue_id) { rtems_status_code status; @@ -149,7 +149,7 @@ int32 OS_QueueDelete_Impl(uint32 queue_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueueGet_Impl(uint32 queue_id, void *data, uint32 size, uint32 *size_copied, int32 timeout) +int32 OS_QueueGet_Impl(osal_index_t queue_id, void *data, uint32 size, uint32 *size_copied, int32 timeout) { int32 return_code; rtems_status_code status; @@ -243,7 +243,7 @@ int32 OS_QueueGet_Impl(uint32 queue_id, void *data, uint32 size, uint32 *size_co * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueuePut_Impl(uint32 queue_id, const void *data, uint32 size, uint32 flags) +int32 OS_QueuePut_Impl(osal_index_t queue_id, const void *data, uint32 size, uint32 flags) { rtems_status_code status; rtems_id rtems_queue_id; @@ -287,7 +287,7 @@ int32 OS_QueuePut_Impl(uint32 queue_id, const void *data, uint32 size, uint32 fl * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueueGetInfo_Impl(uint32 queue_id, OS_queue_prop_t *queue_prop) +int32 OS_QueueGetInfo_Impl(osal_index_t queue_id, OS_queue_prop_t *queue_prop) { /* No extra info for queues in the OS implementation */ return OS_SUCCESS; diff --git a/src/os/rtems/src/os-impl-tasks.c b/src/os/rtems/src/os-impl-tasks.c index 8db7432fe..cc278e422 100644 --- a/src/os/rtems/src/os-impl-tasks.c +++ b/src/os/rtems/src/os-impl-tasks.c @@ -90,7 +90,7 @@ int32 OS_Rtems_TaskAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskCreate_Impl(uint32 task_id, uint32 flags) +int32 OS_TaskCreate_Impl(osal_index_t task_id, uint32 flags) { rtems_status_code status; rtems_name r_name; @@ -151,7 +151,7 @@ int32 OS_TaskCreate_Impl(uint32 task_id, uint32 flags) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskDelete_Impl(uint32 task_id) +int32 OS_TaskDelete_Impl(osal_index_t task_id) { /* ** Try to delete the task @@ -221,7 +221,7 @@ int32 OS_TaskDelay_Impl(uint32 milli_second) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskSetPriority_Impl(uint32 task_id, uint32 new_priority) +int32 OS_TaskSetPriority_Impl(osal_index_t task_id, osal_priority_t new_priority) { rtems_task_priority old_pri; rtems_status_code status; @@ -246,7 +246,7 @@ int32 OS_TaskSetPriority_Impl(uint32 task_id, uint32 new_priority) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskMatch_Impl(uint32 task_id) +int32 OS_TaskMatch_Impl(osal_index_t task_id) { /* ** Get RTEMS Task Id @@ -329,7 +329,7 @@ osal_id_t OS_TaskGetId_Impl(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskGetInfo_Impl(uint32 task_id, OS_task_prop_t *task_prop) +int32 OS_TaskGetInfo_Impl(osal_index_t task_id, OS_task_prop_t *task_prop) { return OS_SUCCESS; @@ -360,7 +360,7 @@ int32 OS_TaskValidateSystemData_Impl(const void *sysdata, uint32 sysdata_size) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -bool OS_TaskIdMatchSystemData_Impl(void *ref, uint32 local_id, const OS_common_record_t *obj) +bool OS_TaskIdMatchSystemData_Impl(void *ref, osal_index_t local_id, const OS_common_record_t *obj) { const rtems_id *target = (const rtems_id *)ref; diff --git a/src/os/rtems/src/os-impl-timebase.c b/src/os/rtems/src/os-impl-timebase.c index 8d047ec75..935386edc 100644 --- a/src/os/rtems/src/os-impl-timebase.c +++ b/src/os/rtems/src/os-impl-timebase.c @@ -89,7 +89,7 @@ OS_impl_timebase_internal_record_t OS_impl_timebase_table[OS_MAX_TIMEBASES]; * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -void OS_TimeBaseLock_Impl(uint32 local_id) +void OS_TimeBaseLock_Impl(osal_index_t local_id) { rtems_semaphore_obtain(OS_impl_timebase_table[local_id].handler_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); } /* end OS_TimeBaseLock_Impl */ @@ -102,7 +102,7 @@ void OS_TimeBaseLock_Impl(uint32 local_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -void OS_TimeBaseUnlock_Impl(uint32 local_id) +void OS_TimeBaseUnlock_Impl(osal_index_t local_id) { rtems_semaphore_release(OS_impl_timebase_table[local_id].handler_mutex); } /* end OS_TimeBaseUnlock_Impl */ @@ -119,7 +119,7 @@ void OS_TimeBaseUnlock_Impl(uint32 local_id) static rtems_timer_service_routine OS_TimeBase_ISR(rtems_id rtems_timer_id, void *arg) { OS_U32ValueWrapper_t user_data; - uint32 local_id; + osal_index_t local_id; OS_impl_timebase_internal_record_t *local; user_data.opaque_arg = arg; @@ -154,7 +154,7 @@ static rtems_timer_service_routine OS_TimeBase_ISR(rtems_id rtems_timer_id, void * Pends on the semaphore for the next timer tick * *-----------------------------------------------------------------*/ -static uint32 OS_TimeBase_WaitImpl(uint32 local_id) +static uint32 OS_TimeBase_WaitImpl(osal_index_t local_id) { OS_impl_timebase_internal_record_t *local; uint32 tick_time; @@ -280,7 +280,7 @@ void OS_UsecsToTicks(uint32 usecs, rtems_interval *ticks) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseCreate_Impl(uint32 timer_id) +int32 OS_TimeBaseCreate_Impl(osal_index_t timer_id) { int32 return_code; rtems_status_code rtems_sc; @@ -410,7 +410,7 @@ int32 OS_TimeBaseCreate_Impl(uint32 timer_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseSet_Impl(uint32 timer_id, int32 start_time, int32 interval_time) +int32 OS_TimeBaseSet_Impl(osal_index_t timer_id, int32 start_time, int32 interval_time) { OS_U32ValueWrapper_t user_data; OS_impl_timebase_internal_record_t *local; @@ -512,7 +512,7 @@ int32 OS_TimeBaseSet_Impl(uint32 timer_id, int32 start_time, int32 interval_time * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseDelete_Impl(uint32 timer_id) +int32 OS_TimeBaseDelete_Impl(osal_index_t timer_id) { rtems_status_code rtems_sc; OS_impl_timebase_internal_record_t *local; @@ -576,7 +576,7 @@ int32 OS_TimeBaseDelete_Impl(uint32 timer_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseGetInfo_Impl(uint32 timer_id, OS_timebase_prop_t *timer_prop) +int32 OS_TimeBaseGetInfo_Impl(osal_index_t timer_id, OS_timebase_prop_t *timer_prop) { return OS_SUCCESS; diff --git a/src/os/shared/inc/os-shared-binsem.h b/src/os/shared/inc/os-shared-binsem.h index 8304d2b2e..f9b743f62 100644 --- a/src/os/shared/inc/os-shared-binsem.h +++ b/src/os/shared/inc/os-shared-binsem.h @@ -62,7 +62,7 @@ int32 OS_BinSemAPI_Init(void); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_BinSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 options); +int32 OS_BinSemCreate_Impl(osal_index_t sem_id, uint32 sem_initial_value, uint32 options); /*---------------------------------------------------------------- Function: OS_BinSemFlush_Impl @@ -72,7 +72,7 @@ int32 OS_BinSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 optio Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_BinSemFlush_Impl(uint32 sem_id); +int32 OS_BinSemFlush_Impl(osal_index_t sem_id); /*---------------------------------------------------------------- Function: OS_BinSemGive_Impl @@ -81,7 +81,7 @@ int32 OS_BinSemFlush_Impl(uint32 sem_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_BinSemGive_Impl(uint32 sem_id); +int32 OS_BinSemGive_Impl(osal_index_t sem_id); /*---------------------------------------------------------------- Function: OS_BinSemTake_Impl @@ -91,7 +91,7 @@ int32 OS_BinSemGive_Impl(uint32 sem_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_BinSemTake_Impl(uint32 sem_id); +int32 OS_BinSemTake_Impl(osal_index_t sem_id); /*---------------------------------------------------------------- Function: OS_BinSemTimedWait_Impl @@ -101,7 +101,7 @@ int32 OS_BinSemTake_Impl(uint32 sem_id); Returns: OS_SUCCESS on success, or relevant error code OS_SEM_TIMEOUT must be returned if the time limit was reached ------------------------------------------------------------------*/ -int32 OS_BinSemTimedWait_Impl(uint32 sem_id, uint32 msecs); +int32 OS_BinSemTimedWait_Impl(osal_index_t sem_id, uint32 msecs); /*---------------------------------------------------------------- Function: OS_BinSemDelete_Impl @@ -110,7 +110,7 @@ int32 OS_BinSemTimedWait_Impl(uint32 sem_id, uint32 msecs); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_BinSemDelete_Impl(uint32 sem_id); +int32 OS_BinSemDelete_Impl(osal_index_t sem_id); /*---------------------------------------------------------------- Function: OS_BinSemGetInfo_Impl @@ -119,6 +119,6 @@ int32 OS_BinSemDelete_Impl(uint32 sem_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_BinSemGetInfo_Impl(uint32 sem_id, OS_bin_sem_prop_t *bin_prop); +int32 OS_BinSemGetInfo_Impl(osal_index_t sem_id, OS_bin_sem_prop_t *bin_prop); #endif /* INCLUDE_OS_SHARED_BINSEM_H_ */ diff --git a/src/os/shared/inc/os-shared-common.h b/src/os/shared/inc/os-shared-common.h index e98858a33..e3654138e 100644 --- a/src/os/shared/inc/os-shared-common.h +++ b/src/os/shared/inc/os-shared-common.h @@ -87,7 +87,7 @@ int32 OS_NotifyEvent(OS_Event_t event, osal_id_t object_id, void *data); returns: OS_SUCCESS on success, or relevant error code ---------------------------------------------------------------------------------------*/ -int32 OS_API_Impl_Init(uint32 idtype); +int32 OS_API_Impl_Init(osal_objtype_t idtype); /* * This functions implement a the OS-specific portion diff --git a/src/os/shared/inc/os-shared-countsem.h b/src/os/shared/inc/os-shared-countsem.h index 8298aad38..fc4715d62 100644 --- a/src/os/shared/inc/os-shared-countsem.h +++ b/src/os/shared/inc/os-shared-countsem.h @@ -62,7 +62,7 @@ int32 OS_CountSemAPI_Init(void); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_CountSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 options); +int32 OS_CountSemCreate_Impl(osal_index_t sem_id, uint32 sem_initial_value, uint32 options); /*---------------------------------------------------------------- Function: OS_CountSemGive_Impl @@ -71,7 +71,7 @@ int32 OS_CountSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 opt Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_CountSemGive_Impl(uint32 sem_id); +int32 OS_CountSemGive_Impl(osal_index_t sem_id); /*---------------------------------------------------------------- Function: OS_CountSemTake_Impl @@ -81,7 +81,7 @@ int32 OS_CountSemGive_Impl(uint32 sem_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_CountSemTake_Impl(uint32 sem_id); +int32 OS_CountSemTake_Impl(osal_index_t sem_id); /*---------------------------------------------------------------- Function: OS_CountSemTimedWait_Impl @@ -91,7 +91,7 @@ int32 OS_CountSemTake_Impl(uint32 sem_id); Returns: OS_SUCCESS on success, or relevant error code OS_SEM_TIMEOUT must be returned if the time limit was reached ------------------------------------------------------------------*/ -int32 OS_CountSemTimedWait_Impl(uint32 sem_id, uint32 msecs); +int32 OS_CountSemTimedWait_Impl(osal_index_t sem_id, uint32 msecs); /*---------------------------------------------------------------- Function: OS_CountSemDelete_Impl @@ -100,7 +100,7 @@ int32 OS_CountSemTimedWait_Impl(uint32 sem_id, uint32 msecs); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_CountSemDelete_Impl(uint32 sem_id); +int32 OS_CountSemDelete_Impl(osal_index_t sem_id); /*---------------------------------------------------------------- Function: OS_CountSemGetInfo_Impl @@ -109,6 +109,6 @@ int32 OS_CountSemDelete_Impl(uint32 sem_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_CountSemGetInfo_Impl(uint32 sem_id, OS_count_sem_prop_t *count_prop); +int32 OS_CountSemGetInfo_Impl(osal_index_t sem_id, OS_count_sem_prop_t *count_prop); #endif /* INCLUDE_OS_SHARED_COUNTSEM_H_ */ diff --git a/src/os/shared/inc/os-shared-dir.h b/src/os/shared/inc/os-shared-dir.h index 79d783e86..e52d682ad 100644 --- a/src/os/shared/inc/os-shared-dir.h +++ b/src/os/shared/inc/os-shared-dir.h @@ -72,7 +72,7 @@ int32 OS_DirCreate_Impl(const char *local_path, uint32 access); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_DirOpen_Impl(uint32 local_id, const char *local_path); +int32 OS_DirOpen_Impl(osal_index_t local_id, const char *local_path); /*---------------------------------------------------------------- Function: OS_DirClose_Impl @@ -81,7 +81,7 @@ int32 OS_DirOpen_Impl(uint32 local_id, const char *local_path); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_DirClose_Impl(uint32 local_id); +int32 OS_DirClose_Impl(osal_index_t local_id); /*---------------------------------------------------------------- Function: OS_DirRead_Impl @@ -90,7 +90,7 @@ int32 OS_DirClose_Impl(uint32 local_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_DirRead_Impl(uint32 local_id, os_dirent_t *dirent); +int32 OS_DirRead_Impl(osal_index_t local_id, os_dirent_t *dirent); /*---------------------------------------------------------------- Function: OS_DirRewind_Impl @@ -99,7 +99,7 @@ int32 OS_DirRead_Impl(uint32 local_id, os_dirent_t *dirent); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_DirRewind_Impl(uint32 local_id); +int32 OS_DirRewind_Impl(osal_index_t local_id); /*---------------------------------------------------------------- Function: OS_DirRemove_Impl diff --git a/src/os/shared/inc/os-shared-file.h b/src/os/shared/inc/os-shared-file.h index 75c8fc912..547bde042 100644 --- a/src/os/shared/inc/os-shared-file.h +++ b/src/os/shared/inc/os-shared-file.h @@ -78,7 +78,7 @@ int32 OS_FileAPI_Init(void); Returns: File position (non-negative) on success, or relevant error code (negative) ------------------------------------------------------------------*/ -int32 OS_GenericSeek_Impl(uint32 local_id, int32 offset, uint32 whence); +int32 OS_GenericSeek_Impl(osal_index_t local_id, int32 offset, uint32 whence); /*---------------------------------------------------------------- Function: OS_GenericRead_Impl @@ -88,7 +88,7 @@ int32 OS_GenericSeek_Impl(uint32 local_id, int32 offset, uint32 whence); Returns: Number of bytes read (non-negative) on success, or relevant error code (negative) ------------------------------------------------------------------*/ -int32 OS_GenericRead_Impl(uint32 local_id, void *buffer, uint32 nbytes, int32 timeout); +int32 OS_GenericRead_Impl(osal_index_t local_id, void *buffer, size_t nbytes, int32 timeout); /*---------------------------------------------------------------- Function: OS_GenericWrite_Impl @@ -98,7 +98,7 @@ int32 OS_GenericRead_Impl(uint32 local_id, void *buffer, uint32 nbytes, int32 ti Returns: Number of bytes written (non-negative) on success, or relevant error code (negative) ------------------------------------------------------------------*/ -int32 OS_GenericWrite_Impl(uint32 local_id, const void *buffer, uint32 nbytes, int32 timeout); +int32 OS_GenericWrite_Impl(osal_index_t local_id, const void *buffer, size_t nbytes, int32 timeout); /*---------------------------------------------------------------- Function: OS_GenericClose_Impl @@ -108,7 +108,7 @@ int32 OS_GenericWrite_Impl(uint32 local_id, const void *buffer, uint32 nbytes, i Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_GenericClose_Impl(uint32 local_id); +int32 OS_GenericClose_Impl(osal_index_t local_id); /*---------------------------------------------------------------- Function: OS_FileOpen_Impl @@ -118,7 +118,7 @@ int32 OS_GenericClose_Impl(uint32 local_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_FileOpen_Impl(uint32 local_id, const char *local_path, int32 flags, int32 access); +int32 OS_FileOpen_Impl(osal_index_t local_id, const char *local_path, int32 flags, int32 access); /*---------------------------------------------------------------- Function: OS_ShellOutputToFile_Impl @@ -127,7 +127,7 @@ int32 OS_FileOpen_Impl(uint32 local_id, const char *local_path, int32 flags, int Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_ShellOutputToFile_Impl(uint32 stream_id, const char *Cmd); +int32 OS_ShellOutputToFile_Impl(osal_index_t stream_id, const char *Cmd); /**************************************************************************************** Filename-based Operations diff --git a/src/os/shared/inc/os-shared-filesys.h b/src/os/shared/inc/os-shared-filesys.h index c4227ce59..110a23697 100644 --- a/src/os/shared/inc/os-shared-filesys.h +++ b/src/os/shared/inc/os-shared-filesys.h @@ -94,9 +94,9 @@ enum */ typedef struct { - uint32 block_size; - uint64 total_blocks; - uint64 blocks_free; + size_t block_size; + osal_blockcount_t total_blocks; + osal_blockcount_t blocks_free; } OS_statvfs_t; typedef struct @@ -107,11 +107,11 @@ typedef struct operating system */ char virtual_mountpt[OS_MAX_PATH_LEN]; /**< The name/prefix in the OSAL Virtual File system exposed to applications */ - char * address; - uint32 blocksize; - uint32 numblocks; - uint8 flags; - uint8 fstype; + char * address; + size_t blocksize; + osal_blockcount_t numblocks; + uint8 flags; + uint8 fstype; } OS_filesys_internal_record_t; /* @@ -140,7 +140,7 @@ int32 OS_FileSysAPI_Init(void); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_FileSysStartVolume_Impl(uint32 filesys_id); +int32 OS_FileSysStartVolume_Impl(osal_index_t filesys_id); /*---------------------------------------------------------------- Function: OS_FileSysStopVolume_Impl @@ -149,7 +149,7 @@ int32 OS_FileSysStartVolume_Impl(uint32 filesys_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_FileSysStopVolume_Impl(uint32 filesys_id); +int32 OS_FileSysStopVolume_Impl(osal_index_t filesys_id); /*---------------------------------------------------------------- Function: OS_FileSysFormatVolume_Impl @@ -158,7 +158,7 @@ int32 OS_FileSysStopVolume_Impl(uint32 filesys_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_FileSysFormatVolume_Impl(uint32 filesys_id); +int32 OS_FileSysFormatVolume_Impl(osal_index_t filesys_id); /*---------------------------------------------------------------- Function: OS_FileSysCheckVolume_Impl @@ -167,7 +167,7 @@ int32 OS_FileSysFormatVolume_Impl(uint32 filesys_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_FileSysCheckVolume_Impl(uint32 filesys_id, bool repair); +int32 OS_FileSysCheckVolume_Impl(osal_index_t filesys_id, bool repair); /*---------------------------------------------------------------- Function: OS_FileSysStatVolume_Impl @@ -176,7 +176,7 @@ int32 OS_FileSysCheckVolume_Impl(uint32 filesys_id, bool repair); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_FileSysStatVolume_Impl(uint32 filesys_id, OS_statvfs_t *result); +int32 OS_FileSysStatVolume_Impl(osal_index_t filesys_id, OS_statvfs_t *result); /*---------------------------------------------------------------- Function: OS_FileSysMountVolume_Impl @@ -185,7 +185,7 @@ int32 OS_FileSysStatVolume_Impl(uint32 filesys_id, OS_statvfs_t *result); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_FileSysMountVolume_Impl(uint32 filesys_id); +int32 OS_FileSysMountVolume_Impl(osal_index_t filesys_id); /*---------------------------------------------------------------- Function: OS_FileSysUnmountVolume_Impl @@ -194,7 +194,7 @@ int32 OS_FileSysMountVolume_Impl(uint32 filesys_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_FileSysUnmountVolume_Impl(uint32 filesys_id); +int32 OS_FileSysUnmountVolume_Impl(osal_index_t filesys_id); /* * Internal helper functions @@ -202,8 +202,8 @@ int32 OS_FileSysUnmountVolume_Impl(uint32 filesys_id); * Not normally invoked outside this unit, except for unit testing */ -bool OS_FileSys_FindVirtMountPoint(void *ref, uint32 local_id, const OS_common_record_t *obj); -int32 OS_FileSys_Initialize(char *address, const char *fsdevname, const char *fsvolname, uint32 blocksize, - uint32 numblocks, bool should_format); +bool OS_FileSys_FindVirtMountPoint(void *ref, osal_index_t local_id, const OS_common_record_t *obj); +int32 OS_FileSys_Initialize(char *address, const char *fsdevname, const char *fsvolname, size_t blocksize, + osal_blockcount_t numblocks, bool should_format); #endif /* INCLUDE_OS_SHARED_FILESYS_H_ */ diff --git a/src/os/shared/inc/os-shared-globaldefs.h b/src/os/shared/inc/os-shared-globaldefs.h index cbca0704c..3a85a80f8 100644 --- a/src/os/shared/inc/os-shared-globaldefs.h +++ b/src/os/shared/inc/os-shared-globaldefs.h @@ -61,7 +61,7 @@ typedef union OS_TimerCallback_t timer_callback_func; osal_task_entry entry_func; osal_id_t id; - uint32 value; + osal_index_t idx; } OS_U32ValueWrapper_t; /* diff --git a/src/os/shared/inc/os-shared-idmap.h b/src/os/shared/inc/os-shared-idmap.h index 30f128bc2..7b5b6b30e 100644 --- a/src/os/shared/inc/os-shared-idmap.h +++ b/src/os/shared/inc/os-shared-idmap.h @@ -65,7 +65,7 @@ typedef enum * * Returns true if the id/obj matches the reference, false otherwise. */ -typedef bool (*OS_ObjectMatchFunc_t)(void *ref, uint32 local_id, const OS_common_record_t *obj); +typedef bool (*OS_ObjectMatchFunc_t)(void *ref, osal_index_t local_id, const OS_common_record_t *obj); /* * Global instantiations @@ -109,7 +109,7 @@ int32 OS_ObjectIdInit(void); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -void OS_Lock_Global(uint32 idtype); +void OS_Lock_Global(osal_objtype_t idtype); /*---------------------------------------------------------------- Function: OS_Lock_Global @@ -118,7 +118,7 @@ void OS_Lock_Global(uint32 idtype); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_Lock_Global_Impl(uint32 idtype); +int32 OS_Lock_Global_Impl(osal_objtype_t idtype); /*---------------------------------------------------------------- Function: OS_Unlock_Global @@ -127,7 +127,7 @@ int32 OS_Lock_Global_Impl(uint32 idtype); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -void OS_Unlock_Global(uint32 idtype); +void OS_Unlock_Global(osal_objtype_t idtype); /*---------------------------------------------------------------- Function: OS_Unlock_Global @@ -136,7 +136,7 @@ void OS_Unlock_Global(uint32 idtype); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_Unlock_Global_Impl(uint32 idtype); +int32 OS_Unlock_Global_Impl(osal_objtype_t idtype); /* Function prototypes for routines implemented in common layers but private to OSAL @@ -161,7 +161,7 @@ static inline uint32 OS_ObjectIdToSerialNumber_Impl(osal_id_t id) Purpose: Obtain the object type component of a generic OSAL Object ID ------------------------------------------------------------------*/ -static inline uint32 OS_ObjectIdToType_Impl(osal_id_t id) +static inline osal_objtype_t OS_ObjectIdToType_Impl(osal_id_t id) { return (OS_ObjectIdToInteger(id) >> OS_OBJECT_TYPE_SHIFT); } @@ -171,7 +171,7 @@ static inline uint32 OS_ObjectIdToType_Impl(osal_id_t id) Purpose: Convert an object serial number and resource type into an external 32-bit OSAL ID ------------------------------------------------------------------*/ -static inline void OS_ObjectIdCompose_Impl(uint32 idtype, uint32 idserial, osal_id_t *result) +static inline void OS_ObjectIdCompose_Impl(osal_objtype_t idtype, uint32 idserial, osal_id_t *result) { *result = OS_ObjectIdFromInteger((idtype << OS_OBJECT_TYPE_SHIFT) | idserial); } @@ -183,7 +183,7 @@ static inline void OS_ObjectIdCompose_Impl(uint32 idtype, uint32 idserial, osal_ Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -uint32 OS_GetMaxForObjectType(uint32 idtype); +uint32 OS_GetMaxForObjectType(osal_objtype_t idtype); /*---------------------------------------------------------------- Function: OS_GetBaseForObjectType @@ -192,7 +192,7 @@ uint32 OS_GetMaxForObjectType(uint32 idtype); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -uint32 OS_GetBaseForObjectType(uint32 idtype); +uint32 OS_GetBaseForObjectType(osal_objtype_t idtype); /*---------------------------------------------------------------- Function: OS_ObjectIdFindByName @@ -201,7 +201,7 @@ uint32 OS_GetBaseForObjectType(uint32 idtype); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_ObjectIdFindByName(uint32 idtype, const char *name, osal_id_t *object_id); +int32 OS_ObjectIdFindByName(osal_objtype_t idtype, const char *name, osal_id_t *object_id); /*---------------------------------------------------------------- Function: OS_ObjectIdGetBySearch @@ -212,7 +212,7 @@ int32 OS_ObjectIdFindByName(uint32 idtype, const char *name, osal_id_t *object_i Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_ObjectIdGetBySearch(OS_lock_mode_t lock_mode, uint32 idtype, OS_ObjectMatchFunc_t MatchFunc, void *arg, +int32 OS_ObjectIdGetBySearch(OS_lock_mode_t lock_mode, osal_objtype_t idtype, OS_ObjectMatchFunc_t MatchFunc, void *arg, OS_common_record_t **record); /*---------------------------------------------------------------- @@ -223,7 +223,8 @@ int32 OS_ObjectIdGetBySearch(OS_lock_mode_t lock_mode, uint32 idtype, OS_ObjectM Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_ObjectIdGetByName(OS_lock_mode_t lock_mode, uint32 idtype, const char *name, OS_common_record_t **record); +int32 OS_ObjectIdGetByName(OS_lock_mode_t lock_mode, osal_objtype_t idtype, const char *name, + OS_common_record_t **record); /*---------------------------------------------------------------- Function: OS_ObjectIdGetById @@ -233,7 +234,7 @@ int32 OS_ObjectIdGetByName(OS_lock_mode_t lock_mode, uint32 idtype, const char * Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_ObjectIdGetById(OS_lock_mode_t lock_mode, uint32 idtype, osal_id_t id, uint32 *array_index, +int32 OS_ObjectIdGetById(OS_lock_mode_t lock_mode, osal_objtype_t idtype, osal_id_t id, osal_index_t *array_index, OS_common_record_t **record); /*---------------------------------------------------------------- @@ -246,7 +247,8 @@ int32 OS_ObjectIdGetById(OS_lock_mode_t lock_mode, uint32 idtype, osal_id_t id, Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_ObjectIdAllocateNew(uint32 idtype, const char *name, uint32 *array_index, OS_common_record_t **record); +int32 OS_ObjectIdAllocateNew(osal_objtype_t idtype, const char *name, osal_index_t *array_index, + OS_common_record_t **record); /*---------------------------------------------------------------- Function: OS_ObjectIdFinalizeNew @@ -287,10 +289,11 @@ int32 OS_ObjectIdRefcountDecr(OS_common_record_t *record); * These are not normally called outside this unit, but need * to be exposed for unit testing. */ -bool OS_ObjectNameMatch(void *ref, uint32 local_id, const OS_common_record_t *obj); -void OS_ObjectIdInitiateLock(OS_lock_mode_t lock_mode, uint32 idtype); -int32 OS_ObjectIdConvertLock(OS_lock_mode_t lock_mode, uint32 idtype, osal_id_t reference_id, OS_common_record_t *obj); -int32 OS_ObjectIdSearch(uint32 idtype, OS_ObjectMatchFunc_t MatchFunc, void *arg, OS_common_record_t **record); -int32 OS_ObjectIdFindNext(uint32 idtype, uint32 *array_index, OS_common_record_t **record); +bool OS_ObjectNameMatch(void *ref, osal_index_t local_id, const OS_common_record_t *obj); +void OS_ObjectIdInitiateLock(OS_lock_mode_t lock_mode, osal_objtype_t idtype); +int32 OS_ObjectIdConvertLock(OS_lock_mode_t lock_mode, osal_objtype_t idtype, osal_id_t reference_id, + OS_common_record_t *obj); +int32 OS_ObjectIdSearch(osal_objtype_t idtype, OS_ObjectMatchFunc_t MatchFunc, void *arg, OS_common_record_t **record); +int32 OS_ObjectIdFindNext(osal_objtype_t idtype, osal_index_t *array_index, OS_common_record_t **record); #endif /* INCLUDE_OS_SHARED_IDMAP_H_ */ diff --git a/src/os/shared/inc/os-shared-module.h b/src/os/shared/inc/os-shared-module.h index abae2cdd0..4f9284264 100644 --- a/src/os/shared/inc/os-shared-module.h +++ b/src/os/shared/inc/os-shared-module.h @@ -72,7 +72,7 @@ int32 OS_ModuleAPI_Init(void); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_ModuleLoad_Impl(uint32 module_id, const char *translated_path); +int32 OS_ModuleLoad_Impl(osal_index_t module_id, const char *translated_path); /*---------------------------------------------------------------- @@ -82,7 +82,7 @@ int32 OS_ModuleLoad_Impl(uint32 module_id, const char *translated_path); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_ModuleUnload_Impl(uint32 module_id); +int32 OS_ModuleUnload_Impl(osal_index_t module_id); /*---------------------------------------------------------------- Function: OS_ModuleGetInfo_Impl @@ -91,7 +91,7 @@ int32 OS_ModuleUnload_Impl(uint32 module_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_ModuleGetInfo_Impl(uint32 module_id, OS_module_prop_t *module_prop); +int32 OS_ModuleGetInfo_Impl(osal_index_t module_id, OS_module_prop_t *module_prop); /*---------------------------------------------------------------- Function: OS_GlobalSymbolLookup_Impl @@ -111,7 +111,7 @@ int32 OS_GlobalSymbolLookup_Impl(cpuaddr *SymbolAddress, const char *SymbolName) Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_ModuleSymbolLookup_Impl(uint32 local_id, cpuaddr *SymbolAddress, const char *SymbolName); +int32 OS_ModuleSymbolLookup_Impl(osal_index_t local_id, cpuaddr *SymbolAddress, const char *SymbolName); /*---------------------------------------------------------------- Function: OS_SymbolTableDump_Impl @@ -120,7 +120,7 @@ int32 OS_ModuleSymbolLookup_Impl(uint32 local_id, cpuaddr *SymbolAddress, const Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_SymbolTableDump_Impl(const char *filename, uint32 size_limit); +int32 OS_SymbolTableDump_Impl(const char *filename, size_t size_limit); /* * Helper functions within the shared layer that are not normally invoked outside the local module diff --git a/src/os/shared/inc/os-shared-mutex.h b/src/os/shared/inc/os-shared-mutex.h index 218c60343..576540228 100644 --- a/src/os/shared/inc/os-shared-mutex.h +++ b/src/os/shared/inc/os-shared-mutex.h @@ -58,7 +58,7 @@ int32 OS_MutexAPI_Init(void); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_MutSemCreate_Impl(uint32 sem_id, uint32 options); +int32 OS_MutSemCreate_Impl(osal_index_t sem_id, uint32 options); /*---------------------------------------------------------------- Function: OS_MutSemGive_Impl @@ -67,7 +67,7 @@ int32 OS_MutSemCreate_Impl(uint32 sem_id, uint32 options); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_MutSemGive_Impl(uint32 sem_id); +int32 OS_MutSemGive_Impl(osal_index_t sem_id); /*---------------------------------------------------------------- Function: OS_MutSemTake_Impl @@ -76,7 +76,7 @@ int32 OS_MutSemGive_Impl(uint32 sem_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_MutSemTake_Impl(uint32 sem_id); +int32 OS_MutSemTake_Impl(osal_index_t sem_id); /*---------------------------------------------------------------- Function: OS_MutSemDelete_Impl @@ -85,7 +85,7 @@ int32 OS_MutSemTake_Impl(uint32 sem_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_MutSemDelete_Impl(uint32 sem_id); +int32 OS_MutSemDelete_Impl(osal_index_t sem_id); /*---------------------------------------------------------------- Function: OS_MutSemGetInfo_Impl @@ -94,6 +94,6 @@ int32 OS_MutSemDelete_Impl(uint32 sem_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_MutSemGetInfo_Impl(uint32 sem_id, OS_mut_sem_prop_t *mut_prop); +int32 OS_MutSemGetInfo_Impl(osal_index_t sem_id, OS_mut_sem_prop_t *mut_prop); #endif /* INCLUDE_OS_SHARED_MUTEX_H_ */ diff --git a/src/os/shared/inc/os-shared-network.h b/src/os/shared/inc/os-shared-network.h index 818f8ea84..f933ee166 100644 --- a/src/os/shared/inc/os-shared-network.h +++ b/src/os/shared/inc/os-shared-network.h @@ -51,7 +51,7 @@ int32 OS_NetworkAPI_Init(void); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_NetworkGetHostName_Impl(char *host_name, uint32 name_len); +int32 OS_NetworkGetHostName_Impl(char *host_name, size_t name_len); /*---------------------------------------------------------------- Function: OS_NetworkGetID_Impl diff --git a/src/os/shared/inc/os-shared-printf.h b/src/os/shared/inc/os-shared-printf.h index b4f0e3d86..165dd3dec 100644 --- a/src/os/shared/inc/os-shared-printf.h +++ b/src/os/shared/inc/os-shared-printf.h @@ -45,9 +45,9 @@ typedef struct char device_name[OS_MAX_API_NAME]; char * BufBase; /**< Start of the buffer memory */ - uint32 BufSize; /**< Total size of the buffer */ - volatile uint32 ReadPos; /**< Offset of next byte to read */ - volatile uint32 WritePos; /**< Offset of next byte to write */ + size_t BufSize; /**< Total size of the buffer */ + volatile size_t ReadPos; /**< Offset of next byte to read */ + volatile size_t WritePos; /**< Offset of next byte to write */ uint32 OverflowEvents; /**< Number of lines dropped due to overflow */ } OS_console_internal_record_t; @@ -73,7 +73,7 @@ int32 OS_ConsoleAPI_Init(void); Purpose: Prepare a console device for use For Async devices, this sets up the background writer task ------------------------------------------------------------------*/ -int32 OS_ConsoleCreate_Impl(uint32 local_id); +int32 OS_ConsoleCreate_Impl(osal_index_t local_id); /*---------------------------------------------------------------- Function: OS_ConsoleOutput_Impl @@ -85,7 +85,7 @@ int32 OS_ConsoleCreate_Impl(uint32 local_id); The data is already formatted, this just writes the characters. ------------------------------------------------------------------*/ -void OS_ConsoleOutput_Impl(uint32 local_id); +void OS_ConsoleOutput_Impl(osal_index_t local_id); /*---------------------------------------------------------------- Function: OS_ConsoleOutput_Impl @@ -100,6 +100,6 @@ void OS_ConsoleOutput_Impl(uint32 local_id); service, this should wakeup the actual console servicing thread. ------------------------------------------------------------------*/ -void OS_ConsoleWakeup_Impl(uint32 local_id); +void OS_ConsoleWakeup_Impl(osal_index_t local_id); #endif /* INCLUDE_OS_SHARED_PRINTF_H_ */ diff --git a/src/os/shared/inc/os-shared-queue.h b/src/os/shared/inc/os-shared-queue.h index b60e4a279..752c61f89 100644 --- a/src/os/shared/inc/os-shared-queue.h +++ b/src/os/shared/inc/os-shared-queue.h @@ -32,9 +32,9 @@ typedef struct { - char queue_name[OS_MAX_API_NAME]; - uint32 max_size; - uint32 max_depth; + char queue_name[OS_MAX_API_NAME]; + size_t max_size; + osal_blockcount_t max_depth; } OS_queue_internal_record_t; /* @@ -63,7 +63,7 @@ int32 OS_QueueAPI_Init(void); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_QueueCreate_Impl(uint32 queue_id, uint32 flags); +int32 OS_QueueCreate_Impl(osal_index_t queue_id, uint32 flags); /*---------------------------------------------------------------- Function: OS_QueueDelete_Impl @@ -72,7 +72,7 @@ int32 OS_QueueCreate_Impl(uint32 queue_id, uint32 flags); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_QueueDelete_Impl(uint32 queue_id); +int32 OS_QueueDelete_Impl(osal_index_t queue_id); /*---------------------------------------------------------------- Function: OS_QueueGet_Impl @@ -85,7 +85,7 @@ int32 OS_QueueDelete_Impl(uint32 queue_id); OS_QUEUE_EMPTY must be returned if the queue is empty when polled (OS_CHECK) OS_QUEUE_INVALID_SIZE must be returned if the supplied buffer is too small ------------------------------------------------------------------*/ -int32 OS_QueueGet_Impl(uint32 queue_id, void *data, uint32 size, uint32 *size_copied, int32 timeout); +int32 OS_QueueGet_Impl(osal_index_t queue_id, void *data, size_t size, size_t *size_copied, int32 timeout); /*---------------------------------------------------------------- Function: OS_QueuePut_Impl @@ -95,7 +95,7 @@ int32 OS_QueueGet_Impl(uint32 queue_id, void *data, uint32 size, uint32 *size_co Returns: OS_SUCCESS on success, or relevant error code OS_QUEUE_FULL must be returned if the queue is full. ------------------------------------------------------------------*/ -int32 OS_QueuePut_Impl(uint32 queue_id, const void *data, uint32 size, uint32 flags); +int32 OS_QueuePut_Impl(osal_index_t queue_id, const void *data, size_t size, uint32 flags); /*---------------------------------------------------------------- Function: OS_QueueGetInfo_Impl @@ -104,6 +104,6 @@ int32 OS_QueuePut_Impl(uint32 queue_id, const void *data, uint32 size, uint32 fl Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_QueueGetInfo_Impl(uint32 queue_id, OS_queue_prop_t *queue_prop); +int32 OS_QueueGetInfo_Impl(osal_index_t queue_id, OS_queue_prop_t *queue_prop); #endif /* INCLUDE_OS_SHARED_QUEUE_H_ */ diff --git a/src/os/shared/inc/os-shared-select.h b/src/os/shared/inc/os-shared-select.h index b2bc847a5..a1d7e9c85 100644 --- a/src/os/shared/inc/os-shared-select.h +++ b/src/os/shared/inc/os-shared-select.h @@ -50,7 +50,7 @@ Returns: OS_SUCCESS on success, or relevant error code OS_ERR_OPERATION_NOT_SUPPORTED if the specified file handle does not support select ------------------------------------------------------------------*/ -int32 OS_SelectSingle_Impl(uint32 stream_id, uint32 *SelectFlags, int32 msecs); +int32 OS_SelectSingle_Impl(osal_index_t stream_id, uint32 *SelectFlags, int32 msecs); /*---------------------------------------------------------------- diff --git a/src/os/shared/inc/os-shared-shell.h b/src/os/shared/inc/os-shared-shell.h index 582f1e3fa..a26044648 100644 --- a/src/os/shared/inc/os-shared-shell.h +++ b/src/os/shared/inc/os-shared-shell.h @@ -41,6 +41,6 @@ Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_ShellOutputToFile_Impl(uint32 stream_id, const char *Cmd); +int32 OS_ShellOutputToFile_Impl(osal_index_t stream_id, const char *Cmd); #endif /* INCLUDE_OS_SHARED_SHELL_H_ */ diff --git a/src/os/shared/inc/os-shared-sockets.h b/src/os/shared/inc/os-shared-sockets.h index a50e0a45c..8bd9fcfb6 100644 --- a/src/os/shared/inc/os-shared-sockets.h +++ b/src/os/shared/inc/os-shared-sockets.h @@ -50,7 +50,7 @@ int32 OS_SocketAPI_Init(void); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_SocketOpen_Impl(uint32 sock_id); +int32 OS_SocketOpen_Impl(osal_index_t sock_id); /*---------------------------------------------------------------- Function: OS_SocketBind_Impl @@ -59,7 +59,7 @@ int32 OS_SocketOpen_Impl(uint32 sock_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_SocketBind_Impl(uint32 sock_id, const OS_SockAddr_t *Addr); +int32 OS_SocketBind_Impl(osal_index_t sock_id, const OS_SockAddr_t *Addr); /*---------------------------------------------------------------- Function: OS_SocketAccept_Impl @@ -70,7 +70,7 @@ int32 OS_SocketBind_Impl(uint32 sock_id, const OS_SockAddr_t *Addr); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_SocketAccept_Impl(uint32 sock_id, uint32 connsock_id, OS_SockAddr_t *Addr, int32 timeout); +int32 OS_SocketAccept_Impl(osal_index_t sock_id, osal_index_t connsock_id, OS_SockAddr_t *Addr, int32 timeout); /*---------------------------------------------------------------- Function: OS_SocketConnect_Impl @@ -80,7 +80,7 @@ int32 OS_SocketAccept_Impl(uint32 sock_id, uint32 connsock_id, OS_SockAddr_t *Ad Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_SocketConnect_Impl(uint32 sock_id, const OS_SockAddr_t *Addr, int32 timeout); +int32 OS_SocketConnect_Impl(osal_index_t sock_id, const OS_SockAddr_t *Addr, int32 timeout); /*---------------------------------------------------------------- Function: OS_SocketRecvFrom_Impl @@ -93,7 +93,8 @@ int32 OS_SocketConnect_Impl(uint32 sock_id, const OS_SockAddr_t *Addr, int32 tim Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_SocketRecvFrom_Impl(uint32 sock_id, void *buffer, uint32 buflen, OS_SockAddr_t *RemoteAddr, int32 timeout); +int32 OS_SocketRecvFrom_Impl(osal_index_t sock_id, void *buffer, size_t buflen, OS_SockAddr_t *RemoteAddr, + int32 timeout); /*---------------------------------------------------------------- Function: OS_SocketSendTo_Impl @@ -104,7 +105,7 @@ int32 OS_SocketRecvFrom_Impl(uint32 sock_id, void *buffer, uint32 buflen, OS_Soc Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_SocketSendTo_Impl(uint32 sock_id, const void *buffer, uint32 buflen, const OS_SockAddr_t *RemoteAddr); +int32 OS_SocketSendTo_Impl(osal_index_t sock_id, const void *buffer, size_t buflen, const OS_SockAddr_t *RemoteAddr); /*---------------------------------------------------------------- @@ -114,7 +115,7 @@ int32 OS_SocketSendTo_Impl(uint32 sock_id, const void *buffer, uint32 buflen, co Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_SocketGetInfo_Impl(uint32 sock_id, OS_socket_prop_t *sock_prop); +int32 OS_SocketGetInfo_Impl(osal_index_t sock_id, OS_socket_prop_t *sock_prop); /*---------------------------------------------------------------- @@ -134,7 +135,7 @@ int32 OS_SocketAddrInit_Impl(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_SocketAddrToString_Impl(char *buffer, uint32 buflen, const OS_SockAddr_t *Addr); +int32 OS_SocketAddrToString_Impl(char *buffer, size_t buflen, const OS_SockAddr_t *Addr); /*---------------------------------------------------------------- Function: OS_SocketAddrFromString_Impl @@ -174,6 +175,6 @@ int32 OS_SocketAddrSetPort_Impl(OS_SockAddr_t *Addr, uint16 PortNum); * Internal helper functions * Not normally called outside the local unit, except during unit test */ -void OS_CreateSocketName(uint32 local_id, const OS_SockAddr_t *Addr, const char *parent_name); +void OS_CreateSocketName(osal_index_t local_id, const OS_SockAddr_t *Addr, const char *parent_name); #endif /* INCLUDE_OS_SHARED_SOCKETS_H_ */ diff --git a/src/os/shared/inc/os-shared-task.h b/src/os/shared/inc/os-shared-task.h index 4adb87fe2..74ba5386a 100644 --- a/src/os/shared/inc/os-shared-task.h +++ b/src/os/shared/inc/os-shared-task.h @@ -34,12 +34,12 @@ typedef struct { char task_name[OS_MAX_API_NAME]; - uint32 stack_size; - uint32 priority; + size_t stack_size; + osal_priority_t priority; osal_task_entry entry_function_pointer; osal_task_entry delete_hook_pointer; void * entry_arg; - uint32 * stack_pointer; + osal_stackptr_t stack_pointer; } OS_task_internal_record_t; /* @@ -81,7 +81,7 @@ void OS_TaskEntryPoint(osal_id_t global_task_id); Returns: OS_SUCCESS on match, any other code on non-match ------------------------------------------------------------------*/ -int32 OS_TaskMatch_Impl(uint32 task_id); +int32 OS_TaskMatch_Impl(osal_index_t task_id); /*---------------------------------------------------------------- @@ -92,7 +92,7 @@ int32 OS_TaskMatch_Impl(uint32 task_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_TaskCreate_Impl(uint32 task_id, uint32 flags); +int32 OS_TaskCreate_Impl(osal_index_t task_id, uint32 flags); /*---------------------------------------------------------------- Function: OS_TaskDelete_Impl @@ -101,7 +101,7 @@ int32 OS_TaskCreate_Impl(uint32 task_id, uint32 flags); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_TaskDelete_Impl(uint32 task_id); +int32 OS_TaskDelete_Impl(osal_index_t task_id); /*---------------------------------------------------------------- Function: OS_TaskExit_Impl @@ -128,7 +128,7 @@ int32 OS_TaskDelay_Impl(uint32 millisecond); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_TaskSetPriority_Impl(uint32 task_id, uint32 new_priority); +int32 OS_TaskSetPriority_Impl(osal_index_t task_id, osal_priority_t new_priority); /*---------------------------------------------------------------- Function: OS_TaskGetId_Impl @@ -146,7 +146,7 @@ osal_id_t OS_TaskGetId_Impl(void); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_TaskGetInfo_Impl(uint32 task_id, OS_task_prop_t *task_prop); +int32 OS_TaskGetInfo_Impl(osal_index_t task_id, OS_task_prop_t *task_prop); /*---------------------------------------------------------------- @@ -169,7 +169,7 @@ int32 OS_TaskRegister_Impl(osal_id_t global_task_id); Compatible with the "OS_ObjectIdFindBySearch" routine ------------------------------------------------------------------*/ -bool OS_TaskIdMatchSystemData_Impl(void *ref, uint32 local_id, const OS_common_record_t *obj); +bool OS_TaskIdMatchSystemData_Impl(void *ref, osal_index_t local_id, const OS_common_record_t *obj); /*---------------------------------------------------------------- @@ -179,6 +179,6 @@ bool OS_TaskIdMatchSystemData_Impl(void *ref, uint32 local_id, const OS_common_r compatible/reasonable for the underlying OS. ------------------------------------------------------------------*/ -int32 OS_TaskValidateSystemData_Impl(const void *sysdata, uint32 sysdata_size); +int32 OS_TaskValidateSystemData_Impl(const void *sysdata, size_t sysdata_size); #endif /* INCLUDE_OS_SHARED_TASK_H_ */ diff --git a/src/os/shared/inc/os-shared-time.h b/src/os/shared/inc/os-shared-time.h index f8397cd54..1fb7aa3e1 100644 --- a/src/os/shared/inc/os-shared-time.h +++ b/src/os/shared/inc/os-shared-time.h @@ -36,9 +36,9 @@ typedef struct { char timer_name[OS_MAX_API_NAME]; uint32 flags; - uint32 timebase_ref; - uint32 prev_ref; - uint32 next_ref; + osal_index_t timebase_ref; + osal_index_t prev_ref; + osal_index_t next_ref; uint32 backlog_resets; int32 wait_time; int32 interval_time; diff --git a/src/os/shared/inc/os-shared-timebase.h b/src/os/shared/inc/os-shared-timebase.h index cf88e82a2..109f05b10 100644 --- a/src/os/shared/inc/os-shared-timebase.h +++ b/src/os/shared/inc/os-shared-timebase.h @@ -73,7 +73,7 @@ int32 OS_TimeBaseAPI_Init(void); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_TimeBaseCreate_Impl(uint32 timebase_id); +int32 OS_TimeBaseCreate_Impl(osal_index_t timebase_id); /*---------------------------------------------------------------- Function: OS_TimeBaseSet_Impl @@ -82,7 +82,7 @@ int32 OS_TimeBaseCreate_Impl(uint32 timebase_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_TimeBaseSet_Impl(uint32 timebase_id, int32 start_time, int32 interval_time); +int32 OS_TimeBaseSet_Impl(osal_index_t timebase_id, int32 start_time, int32 interval_time); /*---------------------------------------------------------------- Function: OS_TimeBaseDelete_Impl @@ -91,7 +91,7 @@ int32 OS_TimeBaseSet_Impl(uint32 timebase_id, int32 start_time, int32 interval_t Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_TimeBaseDelete_Impl(uint32 timebase_id); +int32 OS_TimeBaseDelete_Impl(osal_index_t timebase_id); /**************************************************************************************** INTERNAL FUNCTIONS @@ -103,7 +103,7 @@ int32 OS_TimeBaseDelete_Impl(uint32 timebase_id); Purpose: Get exclusive access to the given timebase Add/remove of application callbacks is prevented ------------------------------------------------------------------*/ -void OS_TimeBaseLock_Impl(uint32 timebase_id); +void OS_TimeBaseLock_Impl(osal_index_t timebase_id); /*---------------------------------------------------------------- Function: OS_TimeBaseLock_Impl @@ -111,7 +111,7 @@ void OS_TimeBaseLock_Impl(uint32 timebase_id); Purpose: Release exclusive access to the given timebase Add/remove of application callbacks is allowed ------------------------------------------------------------------*/ -void OS_TimeBaseUnlock_Impl(uint32 timebase_id); +void OS_TimeBaseUnlock_Impl(osal_index_t timebase_id); /*---------------------------------------------------------------- Function: OS_TimeBaseGetInfo_Impl @@ -120,7 +120,7 @@ void OS_TimeBaseUnlock_Impl(uint32 timebase_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_TimeBaseGetInfo_Impl(uint32 timer_id, OS_timebase_prop_t *timer_prop); +int32 OS_TimeBaseGetInfo_Impl(osal_index_t timer_id, OS_timebase_prop_t *timer_prop); /*---------------------------------------------------------------- Function: OS_TimeBase_CallbackThread diff --git a/src/os/shared/src/osapi-binsem.c b/src/os/shared/src/osapi-binsem.c index 3cb6dbfc6..6d323faff 100644 --- a/src/os/shared/src/osapi-binsem.c +++ b/src/os/shared/src/osapi-binsem.c @@ -98,7 +98,7 @@ int32 OS_BinSemCreate(osal_id_t *sem_id, const char *sem_name, uint32 sem_initia { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; /* Check for NULL pointers */ if (sem_id == NULL || sem_name == NULL) @@ -141,7 +141,7 @@ int32 OS_BinSemCreate(osal_id_t *sem_id, const char *sem_name, uint32 sem_initia int32 OS_BinSemDelete(osal_id_t sem_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; return_code = OS_ObjectIdGetById(OS_LOCK_MODE_EXCLUSIVE, LOCAL_OBJID_TYPE, sem_id, &local_id, &record); @@ -168,7 +168,7 @@ int32 OS_BinSemDelete(osal_id_t sem_id) int32 OS_BinSemGive(osal_id_t sem_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -193,7 +193,7 @@ int32 OS_BinSemGive(osal_id_t sem_id) int32 OS_BinSemFlush(osal_id_t sem_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -217,7 +217,7 @@ int32 OS_BinSemFlush(osal_id_t sem_id) int32 OS_BinSemTake(osal_id_t sem_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -241,7 +241,7 @@ int32 OS_BinSemTake(osal_id_t sem_id) int32 OS_BinSemTimedWait(osal_id_t sem_id, uint32 msecs) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -287,7 +287,7 @@ int32 OS_BinSemGetIdByName(osal_id_t *sem_id, const char *sem_name) int32 OS_BinSemGetInfo(osal_id_t sem_id, OS_bin_sem_prop_t *bin_prop) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check parameters */ diff --git a/src/os/shared/src/osapi-common.c b/src/os/shared/src/osapi-common.c index c6f317625..609fbe045 100644 --- a/src/os/shared/src/osapi-common.c +++ b/src/os/shared/src/osapi-common.c @@ -108,9 +108,9 @@ int32 OS_NotifyEvent(OS_Event_t event, osal_id_t object_id, void *data) *-----------------------------------------------------------------*/ int32 OS_API_Init(void) { - int32 return_code = OS_SUCCESS; - uint32 idtype; - uint32 microSecPerSec; + int32 return_code = OS_SUCCESS; + osal_objtype_t idtype; + uint32 microSecPerSec; if (OS_SharedGlobalVars.Initialized != false) { diff --git a/src/os/shared/src/osapi-countsem.c b/src/os/shared/src/osapi-countsem.c index 00cd9d930..d0e248167 100644 --- a/src/os/shared/src/osapi-countsem.c +++ b/src/os/shared/src/osapi-countsem.c @@ -90,7 +90,7 @@ int32 OS_CountSemCreate(osal_id_t *sem_id, const char *sem_name, uint32 sem_init { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; /* Check for NULL pointers */ if (sem_id == NULL || sem_name == NULL) @@ -133,7 +133,7 @@ int32 OS_CountSemCreate(osal_id_t *sem_id, const char *sem_name, uint32 sem_init int32 OS_CountSemDelete(osal_id_t sem_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; return_code = OS_ObjectIdGetById(OS_LOCK_MODE_EXCLUSIVE, LOCAL_OBJID_TYPE, sem_id, &local_id, &record); @@ -160,7 +160,7 @@ int32 OS_CountSemDelete(osal_id_t sem_id) int32 OS_CountSemGive(osal_id_t sem_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -185,7 +185,7 @@ int32 OS_CountSemGive(osal_id_t sem_id) int32 OS_CountSemTake(osal_id_t sem_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -209,7 +209,7 @@ int32 OS_CountSemTake(osal_id_t sem_id) int32 OS_CountSemTimedWait(osal_id_t sem_id, uint32 msecs) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -255,7 +255,7 @@ int32 OS_CountSemGetIdByName(osal_id_t *sem_id, const char *sem_name) int32 OS_CountSemGetInfo(osal_id_t sem_id, OS_count_sem_prop_t *count_prop) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check parameters */ diff --git a/src/os/shared/src/osapi-dir.c b/src/os/shared/src/osapi-dir.c index 42153431e..5246d9a31 100644 --- a/src/os/shared/src/osapi-dir.c +++ b/src/os/shared/src/osapi-dir.c @@ -113,7 +113,7 @@ int32 OS_DirectoryOpen(osal_id_t *dir_id, const char *path) { char local_path[OS_MAX_LOCAL_PATH_LEN]; OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; if (dir_id == NULL || path == NULL) @@ -154,7 +154,7 @@ int32 OS_DirectoryOpen(osal_id_t *dir_id, const char *path) int32 OS_DirectoryClose(osal_id_t dir_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Make sure the file descriptor is legit before using it */ @@ -181,7 +181,7 @@ int32 OS_DirectoryClose(osal_id_t dir_id) int32 OS_DirectoryRead(osal_id_t dir_id, os_dirent_t *dirent) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; if (dirent == NULL) @@ -223,7 +223,7 @@ int32 OS_DirectoryRead(osal_id_t dir_id, os_dirent_t *dirent) int32 OS_DirectoryRewind(osal_id_t dir_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Make sure the file descriptor is legit before using it */ diff --git a/src/os/shared/src/osapi-file.c b/src/os/shared/src/osapi-file.c index 37837b9e2..06cc795e8 100644 --- a/src/os/shared/src/osapi-file.c +++ b/src/os/shared/src/osapi-file.c @@ -90,7 +90,7 @@ int32 OS_FileAPI_Init(void) int32 OS_OpenCreate(osal_id_t *filedes, const char *path, int32 flags, int32 access) { int32 return_code; - uint32 local_id; + osal_index_t local_id; OS_common_record_t *record; char local_path[OS_MAX_LOCAL_PATH_LEN]; @@ -228,7 +228,7 @@ int32 OS_open(const char *path, int32 access, uint32 mode) int32 OS_close(osal_id_t filedes) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Make sure the file descriptor is legit before using it */ @@ -253,10 +253,10 @@ int32 OS_close(osal_id_t filedes) * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_TimedRead(osal_id_t filedes, void *buffer, uint32 nbytes, int32 timeout) +int32 OS_TimedRead(osal_id_t filedes, void *buffer, size_t nbytes, int32 timeout) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -283,10 +283,10 @@ int32 OS_TimedRead(osal_id_t filedes, void *buffer, uint32 nbytes, int32 timeout * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_TimedWrite(osal_id_t filedes, const void *buffer, uint32 nbytes, int32 timeout) +int32 OS_TimedWrite(osal_id_t filedes, const void *buffer, size_t nbytes, int32 timeout) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -313,7 +313,7 @@ int32 OS_TimedWrite(osal_id_t filedes, const void *buffer, uint32 nbytes, int32 * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_read(osal_id_t filedes, void *buffer, uint32 nbytes) +int32 OS_read(osal_id_t filedes, void *buffer, size_t nbytes) { return OS_TimedRead(filedes, buffer, nbytes, OS_PEND); } /* end OS_read */ @@ -326,7 +326,7 @@ int32 OS_read(osal_id_t filedes, void *buffer, uint32 nbytes) * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_write(osal_id_t filedes, const void *buffer, uint32 nbytes) +int32 OS_write(osal_id_t filedes, const void *buffer, size_t nbytes) { return OS_TimedWrite(filedes, buffer, nbytes, OS_PEND); } /* end OS_write */ @@ -394,7 +394,7 @@ int32 OS_stat(const char *path, os_fstat_t *filestats) int32 OS_lseek(osal_id_t filedes, int32 offset, uint32 whence) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Make sure the file descriptor is legit before using it */ @@ -441,10 +441,10 @@ int32 OS_remove(const char *path) *-----------------------------------------------------------------*/ int32 OS_rename(const char *old, const char *new) { - int i; - int32 return_code; - char old_path[OS_MAX_LOCAL_PATH_LEN]; - char new_path[OS_MAX_LOCAL_PATH_LEN]; + osal_index_t i; + int32 return_code; + char old_path[OS_MAX_LOCAL_PATH_LEN]; + char new_path[OS_MAX_LOCAL_PATH_LEN]; return_code = OS_TranslatePath(old, old_path); if (return_code == OS_SUCCESS) @@ -583,7 +583,7 @@ int32 OS_mv(const char *src, const char *dest) int32 OS_FDGetInfo(osal_id_t filedes, OS_file_prop_t *fd_prop) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check parameters */ @@ -618,8 +618,8 @@ int32 OS_FDGetInfo(osal_id_t filedes, OS_file_prop_t *fd_prop) *-----------------------------------------------------------------*/ int32 OS_FileOpenCheck(const char *Filename) { - int32 return_code; - uint32 i; + int32 return_code; + osal_index_t i; if (Filename == NULL) { @@ -656,9 +656,9 @@ int32 OS_FileOpenCheck(const char *Filename) *-----------------------------------------------------------------*/ int32 OS_CloseFileByName(const char *Filename) { - int32 return_code; - int32 close_code; - uint32 i; + int32 return_code; + int32 close_code; + osal_index_t i; if (Filename == NULL) { @@ -703,9 +703,9 @@ int32 OS_CloseFileByName(const char *Filename) *-----------------------------------------------------------------*/ int32 OS_CloseAllFiles(void) { - int32 return_code; - int32 close_code; - uint32 i; + int32 return_code; + int32 close_code; + osal_index_t i; return_code = OS_SUCCESS; diff --git a/src/os/shared/src/osapi-filesys.c b/src/os/shared/src/osapi-filesys.c index 30d562aa4..ed8effd21 100644 --- a/src/os/shared/src/osapi-filesys.c +++ b/src/os/shared/src/osapi-filesys.c @@ -74,7 +74,7 @@ const char OS_FILESYS_RAMDISK_VOLNAME_PREFIX[] = "RAM"; * Returns: true if the entry matches, false if it does not match * *-----------------------------------------------------------------*/ -bool OS_FileSys_FindVirtMountPoint(void *ref, uint32 local_id, const OS_common_record_t *obj) +bool OS_FileSys_FindVirtMountPoint(void *ref, osal_index_t local_id, const OS_common_record_t *obj) { OS_filesys_internal_record_t *rec = &OS_filesys_table[local_id]; const char * target = (const char *)ref; @@ -101,13 +101,13 @@ bool OS_FileSys_FindVirtMountPoint(void *ref, uint32 local_id, const OS_common_r * Returns: OS_SUCCESS on creating the disk, or appropriate error code. * *-----------------------------------------------------------------*/ -int32 OS_FileSys_Initialize(char *address, const char *fsdevname, const char *fsvolname, uint32 blocksize, - uint32 numblocks, bool should_format) +int32 OS_FileSys_Initialize(char *address, const char *fsdevname, const char *fsvolname, size_t blocksize, + osal_blockcount_t numblocks, bool should_format) { OS_common_record_t * global; OS_filesys_internal_record_t *local; int32 return_code; - uint32 local_id; + osal_index_t local_id; /* ** Check parameters @@ -229,7 +229,7 @@ int32 OS_FileSysAddFixedMap(osal_id_t *filesys_id, const char *phys_path, const OS_common_record_t * global; OS_filesys_internal_record_t *local; int32 return_code; - uint32 local_id; + osal_index_t local_id; const char * dev_name; /* @@ -316,7 +316,7 @@ int32 OS_FileSysAddFixedMap(osal_id_t *filesys_id, const char *phys_path, const * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_mkfs(char *address, const char *devname, const char *volname, uint32 blocksize, uint32 numblocks) +int32 OS_mkfs(char *address, const char *devname, const char *volname, size_t blocksize, osal_blockcount_t numblocks) { int32 return_code; @@ -349,7 +349,7 @@ int32 OS_mkfs(char *address, const char *devname, const char *volname, uint32 bl int32 OS_rmfs(const char *devname) { int32 return_code; - uint32 local_id; + osal_index_t local_id; OS_common_record_t *global; if (devname == NULL) @@ -402,7 +402,7 @@ int32 OS_rmfs(const char *devname) * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_initfs(char *address, const char *devname, const char *volname, uint32 blocksize, uint32 numblocks) +int32 OS_initfs(char *address, const char *devname, const char *volname, size_t blocksize, osal_blockcount_t numblocks) { int32 return_code; @@ -435,7 +435,7 @@ int32 OS_initfs(char *address, const char *devname, const char *volname, uint32 int32 OS_mount(const char *devname, const char *mountpoint) { int32 return_code; - uint32 local_id; + osal_index_t local_id; OS_common_record_t * global; OS_filesys_internal_record_t *local; @@ -511,7 +511,7 @@ int32 OS_mount(const char *devname, const char *mountpoint) int32 OS_unmount(const char *mountpoint) { int32 return_code; - uint32 local_id; + osal_index_t local_id; OS_common_record_t * global; OS_filesys_internal_record_t *local; @@ -582,7 +582,7 @@ int32 OS_fsBlocksFree(const char *name) { int32 return_code; OS_statvfs_t statfs; - uint32 local_id; + osal_index_t local_id; OS_common_record_t *global; if (name == NULL) @@ -633,7 +633,7 @@ int32 OS_fsBytesFree(const char *name, uint64 *bytes_free) { int32 return_code; OS_statvfs_t statfs; - uint32 local_id; + osal_index_t local_id; OS_common_record_t *global; if (name == NULL || bytes_free == NULL) @@ -682,7 +682,7 @@ int32 OS_fsBytesFree(const char *name, uint64 *bytes_free) *-----------------------------------------------------------------*/ int32 OS_chkfs(const char *name, bool repair) { - uint32 local_id; + osal_index_t local_id; int32 return_code; OS_common_record_t *global; @@ -729,7 +729,7 @@ int32 OS_chkfs(const char *name, bool repair) *-----------------------------------------------------------------*/ int32 OS_FS_GetPhysDriveName(char *PhysDriveName, const char *MountPoint) { - uint32 local_id; + osal_index_t local_id; int32 return_code; OS_common_record_t * global; OS_filesys_internal_record_t *local; @@ -783,7 +783,7 @@ int32 OS_FS_GetPhysDriveName(char *PhysDriveName, const char *MountPoint) *-----------------------------------------------------------------*/ int32 OS_GetFsInfo(os_fsinfo_t *filesys_info) { - int i; + osal_index_t idx; /* ** Check to see if the file pointers are NULL @@ -800,9 +800,9 @@ int32 OS_GetFsInfo(os_fsinfo_t *filesys_info) OS_Lock_Global(OS_OBJECT_TYPE_OS_STREAM); - for (i = 0; i < OS_MAX_NUM_OPEN_FILES; i++) + for (idx = 0; idx < OS_MAX_NUM_OPEN_FILES; idx++) { - if (!OS_ObjectIdDefined(OS_global_stream_table[i].active_id)) + if (!OS_ObjectIdDefined(OS_global_stream_table[idx].active_id)) { filesys_info->FreeFds++; } @@ -812,9 +812,9 @@ int32 OS_GetFsInfo(os_fsinfo_t *filesys_info) OS_Lock_Global(OS_OBJECT_TYPE_OS_FILESYS); - for (i = 0; i < OS_MAX_FILE_SYSTEMS; i++) + for (idx = 0; idx < OS_MAX_FILE_SYSTEMS; idx++) { - if (!OS_ObjectIdDefined(OS_global_filesys_table[i].active_id)) + if (!OS_ObjectIdDefined(OS_global_filesys_table[idx].active_id)) { filesys_info->FreeVolumes++; } @@ -835,7 +835,7 @@ int32 OS_GetFsInfo(os_fsinfo_t *filesys_info) *-----------------------------------------------------------------*/ int32 OS_TranslatePath(const char *VirtualPath, char *LocalPath) { - uint32 local_id; + osal_index_t local_id; int32 return_code; const char * name_ptr; OS_common_record_t * global; diff --git a/src/os/shared/src/osapi-idmap.c b/src/os/shared/src/osapi-idmap.c index 0c0bf1af7..858c583cd 100644 --- a/src/os/shared/src/osapi-idmap.c +++ b/src/os/shared/src/osapi-idmap.c @@ -132,7 +132,7 @@ int32 OS_ObjectIdInit(void) * Purpose: Local helper routine, not part of OSAL API. * *-----------------------------------------------------------------*/ -uint32 OS_GetMaxForObjectType(uint32 idtype) +uint32 OS_GetMaxForObjectType(osal_objtype_t idtype) { switch (idtype) { @@ -172,7 +172,7 @@ uint32 OS_GetMaxForObjectType(uint32 idtype) * Purpose: Local helper routine, not part of OSAL API. * *-----------------------------------------------------------------*/ -uint32 OS_GetBaseForObjectType(uint32 idtype) +uint32 OS_GetBaseForObjectType(osal_objtype_t idtype) { switch (idtype) { @@ -224,7 +224,7 @@ uint32 OS_GetBaseForObjectType(uint32 idtype) * returns: true if match, false otherwise * *-----------------------------------------------------------------*/ -bool OS_ObjectNameMatch(void *ref, uint32 local_id, const OS_common_record_t *obj) +bool OS_ObjectNameMatch(void *ref, osal_index_t local_id, const OS_common_record_t *obj) { return (obj->name_entry != NULL && strcmp((const char *)ref, obj->name_entry) == 0); } /* end OS_ObjectNameMatch */ @@ -245,7 +245,7 @@ bool OS_ObjectNameMatch(void *ref, uint32 local_id, const OS_common_record_t *ob * lock type requested (lock_mode). * *-----------------------------------------------------------------*/ -void OS_ObjectIdInitiateLock(OS_lock_mode_t lock_mode, uint32 idtype) +void OS_ObjectIdInitiateLock(OS_lock_mode_t lock_mode, osal_objtype_t idtype) { if (lock_mode != OS_LOCK_MODE_NONE) { @@ -291,7 +291,8 @@ void OS_ObjectIdInitiateLock(OS_lock_mode_t lock_mode, uint32 idtype) * all lock modes other than OS_LOCK_MODE_NONE. * *-----------------------------------------------------------------*/ -int32 OS_ObjectIdConvertLock(OS_lock_mode_t lock_mode, uint32 idtype, osal_id_t reference_id, OS_common_record_t *obj) +int32 OS_ObjectIdConvertLock(OS_lock_mode_t lock_mode, osal_objtype_t idtype, osal_id_t reference_id, + OS_common_record_t *obj) { int32 return_code = OS_ERROR; uint32 exclusive_bits = 0; @@ -420,11 +421,11 @@ int32 OS_ObjectIdConvertLock(OS_lock_mode_t lock_mode, uint32 idtype, osal_id_t * returns: OS_ERR_NAME_NOT_FOUND if not found, OS_SUCCESS if match is found * *-----------------------------------------------------------------*/ -int32 OS_ObjectIdSearch(uint32 idtype, OS_ObjectMatchFunc_t MatchFunc, void *arg, OS_common_record_t **record) +int32 OS_ObjectIdSearch(osal_objtype_t idtype, OS_ObjectMatchFunc_t MatchFunc, void *arg, OS_common_record_t **record) { int32 return_code; uint32 obj_count; - uint32 local_id; + osal_index_t local_id; OS_common_record_t *obj; return_code = OS_ERR_NAME_NOT_FOUND; @@ -475,7 +476,7 @@ int32 OS_ObjectIdSearch(uint32 idtype, OS_ObjectMatchFunc_t MatchFunc, void *arg * * returns: OS_SUCCESS if an empty location was found. *-----------------------------------------------------------------*/ -int32 OS_ObjectIdFindNext(uint32 idtype, uint32 *array_index, OS_common_record_t **record) +int32 OS_ObjectIdFindNext(osal_objtype_t idtype, osal_index_t *array_index, OS_common_record_t **record) { uint32 max_id; uint32 base_id; @@ -537,7 +538,7 @@ int32 OS_ObjectIdFindNext(uint32 idtype, uint32 *array_index, OS_common_record_t if (array_index != NULL) { - *array_index = local_id; + *array_index = OSAL_INDEX_C(local_id); } if (record != NULL) { @@ -561,7 +562,7 @@ int32 OS_ObjectIdFindNext(uint32 idtype, uint32 *array_index, OS_common_record_t Purpose: Locks the global table identified by "idtype" ------------------------------------------------------------------*/ -void OS_Lock_Global(uint32 idtype) +void OS_Lock_Global(osal_objtype_t idtype) { int32 return_code; osal_id_t self_task_id; @@ -622,7 +623,7 @@ void OS_Lock_Global(uint32 idtype) Purpose: Unlocks the global table identified by "idtype" ------------------------------------------------------------------*/ -void OS_Unlock_Global(uint32 idtype) +void OS_Unlock_Global(osal_objtype_t idtype) { int32 return_code; osal_id_t self_task_id; @@ -695,8 +696,8 @@ void OS_Unlock_Global(uint32 idtype) *-----------------------------------------------------------------*/ int32 OS_ObjectIdFinalizeNew(int32 operation_status, OS_common_record_t *record, osal_id_t *outid) { - uint32 idtype = OS_ObjectIdToType_Impl(record->active_id); - osal_id_t callback_id; + osal_objtype_t idtype = OS_ObjectIdToType_Impl(record->active_id); + osal_id_t callback_id; /* if operation was unsuccessful, then clear * the active_id field within the record, so @@ -750,8 +751,8 @@ int32 OS_ObjectIdFinalizeNew(int32 operation_status, OS_common_record_t *record, ------------------------------------------------------------------*/ int32 OS_ObjectIdFinalizeDelete(int32 operation_status, OS_common_record_t *record) { - uint32 idtype = OS_ObjectIdToType_Impl(record->active_id); - osal_id_t callback_id; + osal_objtype_t idtype = OS_ObjectIdToType_Impl(record->active_id); + osal_id_t callback_id; /* Clear the OSAL ID if successful - this returns the record to the pool */ if (operation_status == OS_SUCCESS) @@ -790,7 +791,7 @@ int32 OS_ObjectIdFinalizeDelete(int32 operation_status, OS_common_record_t *reco * returns: OS_ERR_NAME_NOT_FOUND if not found, OS_SUCCESS if match is found * *-----------------------------------------------------------------*/ -int32 OS_ObjectIdGetBySearch(OS_lock_mode_t lock_mode, uint32 idtype, OS_ObjectMatchFunc_t MatchFunc, void *arg, +int32 OS_ObjectIdGetBySearch(OS_lock_mode_t lock_mode, osal_objtype_t idtype, OS_ObjectMatchFunc_t MatchFunc, void *arg, OS_common_record_t **record) { int32 return_code; @@ -836,7 +837,8 @@ int32 OS_ObjectIdGetBySearch(OS_lock_mode_t lock_mode, uint32 idtype, OS_ObjectM * returns: OS_ERR_NAME_NOT_FOUND if not found, OS_SUCCESS if match is found * *-----------------------------------------------------------------*/ -int32 OS_ObjectIdGetByName(OS_lock_mode_t lock_mode, uint32 idtype, const char *name, OS_common_record_t **record) +int32 OS_ObjectIdGetByName(OS_lock_mode_t lock_mode, osal_objtype_t idtype, const char *name, + OS_common_record_t **record) { return OS_ObjectIdGetBySearch(lock_mode, idtype, OS_ObjectNameMatch, (void *)name, record); @@ -853,7 +855,7 @@ int32 OS_ObjectIdGetByName(OS_lock_mode_t lock_mode, uint32 idtype, const char * * returns: OS_ERR_NAME_NOT_FOUND if not found, OS_SUCCESS if match is found * *-----------------------------------------------------------------*/ -int32 OS_ObjectIdFindByName(uint32 idtype, const char *name, osal_id_t *object_id) +int32 OS_ObjectIdFindByName(osal_objtype_t idtype, const char *name, osal_id_t *object_id) { int32 return_code; OS_common_record_t *global; @@ -900,7 +902,7 @@ int32 OS_ObjectIdFindByName(uint32 idtype, const char *name, osal_id_t *object_i * If this returns something other than OS_SUCCESS then the global is NOT locked. * *-----------------------------------------------------------------*/ -int32 OS_ObjectIdGetById(OS_lock_mode_t lock_mode, uint32 idtype, osal_id_t id, uint32 *array_index, +int32 OS_ObjectIdGetById(OS_lock_mode_t lock_mode, osal_objtype_t idtype, osal_id_t id, osal_index_t *array_index, OS_common_record_t **record) { int32 return_code; @@ -955,8 +957,8 @@ int32 OS_ObjectIdGetById(OS_lock_mode_t lock_mode, uint32 idtype, osal_id_t id, *-----------------------------------------------------------------*/ int32 OS_ObjectIdRefcountDecr(OS_common_record_t *record) { - int32 return_code; - uint32 idtype = OS_ObjectIdToType_Impl(record->active_id); + int32 return_code; + osal_objtype_t idtype = OS_ObjectIdToType_Impl(record->active_id); if (idtype == 0 || !OS_ObjectIdDefined(record->active_id)) { @@ -1012,7 +1014,8 @@ int32 OS_ObjectIdRefcountDecr(OS_common_record_t *record) * manipulate the global lock at all. * *-----------------------------------------------------------------*/ -int32 OS_ObjectIdAllocateNew(uint32 idtype, const char *name, uint32 *array_index, OS_common_record_t **record) +int32 OS_ObjectIdAllocateNew(osal_objtype_t idtype, const char *name, osal_index_t *array_index, + OS_common_record_t **record) { int32 return_code; @@ -1079,7 +1082,7 @@ int32 OS_ObjectIdAllocateNew(uint32 idtype, const char *name, uint32 *array_inde * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_ConvertToArrayIndex(osal_id_t object_id, uint32 *ArrayIndex) +int32 OS_ConvertToArrayIndex(osal_id_t object_id, osal_index_t *ArrayIndex) { /* just pass to the generic internal conversion routine */ return OS_ObjectIdToArrayIndex(OS_OBJECT_TYPE_UNDEFINED, object_id, ArrayIndex); @@ -1095,7 +1098,7 @@ int32 OS_ConvertToArrayIndex(osal_id_t object_id, uint32 *ArrayIndex) *-----------------------------------------------------------------*/ void OS_ForEachObject(osal_id_t creator_id, OS_ArgCallback_t callback_ptr, void *callback_arg) { - uint32 idtype; + osal_objtype_t idtype; for (idtype = 0; idtype < OS_OBJECT_TYPE_USER; ++idtype) { @@ -1111,11 +1114,12 @@ void OS_ForEachObject(osal_id_t creator_id, OS_ArgCallback_t callback_ptr, void * See description in API and header file for detail * *-----------------------------------------------------------------*/ -void OS_ForEachObjectOfType(uint32 idtype, osal_id_t creator_id, OS_ArgCallback_t callback_ptr, void *callback_arg) +void OS_ForEachObjectOfType(osal_objtype_t idtype, osal_id_t creator_id, OS_ArgCallback_t callback_ptr, + void *callback_arg) { - uint32 obj_index; - uint32 obj_max; - osal_id_t obj_id; + osal_index_t obj_index; + uint32 obj_max; + osal_id_t obj_id; obj_max = OS_GetMaxForObjectType(idtype); if (obj_max > 0) @@ -1170,7 +1174,7 @@ void OS_ForEachObjectOfType(uint32 idtype, osal_id_t creator_id, OS_ArgCallback_ * See description in API and header file for detail * *-----------------------------------------------------------------*/ -uint32 OS_IdentifyObject(osal_id_t object_id) +osal_objtype_t OS_IdentifyObject(osal_id_t object_id) { return OS_ObjectIdToType_Impl(object_id); } /* end OS_IdentifyObject */ @@ -1183,13 +1187,13 @@ uint32 OS_IdentifyObject(osal_id_t object_id) * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_GetResourceName(osal_id_t object_id, char *buffer, uint32 buffer_size) +int32 OS_GetResourceName(osal_id_t object_id, char *buffer, size_t buffer_size) { - uint32 idtype; + osal_objtype_t idtype; OS_common_record_t *record; int32 return_code; - uint32 name_len; - uint32 local_id; + size_t name_len; + osal_index_t local_id; /* sanity check the passed-in buffer and size */ if (buffer == NULL || buffer_size == 0) @@ -1241,12 +1245,12 @@ int32 OS_GetResourceName(osal_id_t object_id, char *buffer, uint32 buffer_size) * Otherwise OS_SUCCESS is returned. * *-----------------------------------------------------------------*/ -int32 OS_ObjectIdToArrayIndex(uint32 idtype, osal_id_t object_id, uint32 *ArrayIndex) +int32 OS_ObjectIdToArrayIndex(osal_objtype_t idtype, osal_id_t object_id, osal_index_t *ArrayIndex) { - uint32 max_id; - uint32 obj_index; - uint32 actual_type; - int32 return_code; + uint32 max_id; + uint32 obj_index; + osal_objtype_t actual_type; + int32 return_code; obj_index = OS_ObjectIdToSerialNumber_Impl(object_id); actual_type = OS_ObjectIdToType_Impl(object_id); @@ -1269,7 +1273,7 @@ int32 OS_ObjectIdToArrayIndex(uint32 idtype, osal_id_t object_id, uint32 *ArrayI else { return_code = OS_SUCCESS; - *ArrayIndex = obj_index % max_id; + *ArrayIndex = OSAL_INDEX_C(obj_index % max_id); } } diff --git a/src/os/shared/src/osapi-module.c b/src/os/shared/src/osapi-module.c index 96bbe4abb..2bd14899f 100644 --- a/src/os/shared/src/osapi-module.c +++ b/src/os/shared/src/osapi-module.c @@ -184,7 +184,7 @@ int32 OS_ModuleLoad(osal_id_t *module_id, const char *module_name, const char *f char translated_path[OS_MAX_LOCAL_PATH_LEN]; int32 return_code; int32 filename_status; - uint32 local_id; + osal_index_t local_id; OS_common_record_t *record; /* @@ -282,7 +282,7 @@ int32 OS_ModuleUnload(osal_id_t module_id) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; return_code = OS_ObjectIdGetById(OS_LOCK_MODE_EXCLUSIVE, LOCAL_OBJID_TYPE, module_id, &local_id, &record); if (return_code == OS_SUCCESS) @@ -316,7 +316,7 @@ int32 OS_ModuleInfo(osal_id_t module_id, OS_module_prop_t *module_prop) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; /* Check parameters */ if (module_prop == NULL) @@ -402,7 +402,7 @@ int32 OS_ModuleSymbolLookup(osal_id_t module_id, cpuaddr *symbol_address, const int32 return_code; int32 staticsym_status; OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; /* ** Check parameters @@ -447,7 +447,7 @@ int32 OS_ModuleSymbolLookup(osal_id_t module_id, cpuaddr *symbol_address, const * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_SymbolTableDump(const char *filename, uint32 SizeLimit) +int32 OS_SymbolTableDump(const char *filename, size_t SizeLimit) { int32 return_code; char translated_path[OS_MAX_LOCAL_PATH_LEN]; diff --git a/src/os/shared/src/osapi-mutex.c b/src/os/shared/src/osapi-mutex.c index 28cbc73ee..5e1a282ff 100644 --- a/src/os/shared/src/osapi-mutex.c +++ b/src/os/shared/src/osapi-mutex.c @@ -90,7 +90,7 @@ int32 OS_MutSemCreate(osal_id_t *sem_id, const char *sem_name, uint32 options) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; /* Check for NULL pointers */ if (sem_id == NULL || sem_name == NULL) @@ -133,7 +133,7 @@ int32 OS_MutSemCreate(osal_id_t *sem_id, const char *sem_name, uint32 options) int32 OS_MutSemDelete(osal_id_t sem_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; return_code = OS_ObjectIdGetById(OS_LOCK_MODE_EXCLUSIVE, LOCAL_OBJID_TYPE, sem_id, &local_id, &record); @@ -160,7 +160,7 @@ int32 OS_MutSemDelete(osal_id_t sem_id) int32 OS_MutSemGive(osal_id_t sem_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; osal_id_t self_task; @@ -198,7 +198,7 @@ int32 OS_MutSemGive(osal_id_t sem_id) int32 OS_MutSemTake(osal_id_t sem_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; osal_id_t self_task; @@ -262,7 +262,7 @@ int32 OS_MutSemGetInfo(osal_id_t sem_id, OS_mut_sem_prop_t *mut_prop) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; /* Check parameters */ if (mut_prop == NULL) diff --git a/src/os/shared/src/osapi-network.c b/src/os/shared/src/osapi-network.c index 3864288e3..e43e05561 100644 --- a/src/os/shared/src/osapi-network.c +++ b/src/os/shared/src/osapi-network.c @@ -63,7 +63,7 @@ int32 OS_NetworkAPI_Init(void) * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_NetworkGetHostName(char *host_name, uint32 name_len) +int32 OS_NetworkGetHostName(char *host_name, size_t name_len) { uint32 return_code; diff --git a/src/os/shared/src/osapi-printf.c b/src/os/shared/src/osapi-printf.c index e420dfeab..0a5359656 100644 --- a/src/os/shared/src/osapi-printf.c +++ b/src/os/shared/src/osapi-printf.c @@ -78,7 +78,7 @@ int32 OS_ConsoleAPI_Init(void) { OS_console_internal_record_t *console; int32 return_code; - uint32 local_id; + osal_index_t local_id; OS_common_record_t * record; memset(&OS_console_table, 0, sizeof(OS_console_table)); @@ -137,10 +137,10 @@ int32 OS_ConsoleAPI_Init(void) * Either the entire string should be written, or none of it. * *-----------------------------------------------------------------*/ -static int32 OS_Console_CopyOut(OS_console_internal_record_t *console, const char *Str, uint32 *NextWritePos) +static int32 OS_Console_CopyOut(OS_console_internal_record_t *console, const char *Str, size_t *NextWritePos) { const char *pmsg; - uint32 WriteOffset; + size_t WriteOffset; int32 return_code; return_code = OS_ERROR; @@ -193,9 +193,9 @@ int32 OS_ConsoleWrite(osal_id_t console_id, const char *Str) { int32 return_code; OS_common_record_t * record; - uint32 local_id; + osal_index_t local_id; OS_console_internal_record_t *console; - uint32 PendingWritePos; + size_t PendingWritePos; return_code = OS_ObjectIdGetById(OS_LOCK_MODE_GLOBAL, OS_OBJECT_TYPE_OS_CONSOLE, console_id, &local_id, &record); if (return_code == OS_SUCCESS) diff --git a/src/os/shared/src/osapi-queue.c b/src/os/shared/src/osapi-queue.c index 9400f0f3b..51833c843 100644 --- a/src/os/shared/src/osapi-queue.c +++ b/src/os/shared/src/osapi-queue.c @@ -87,11 +87,12 @@ int32 OS_QueueAPI_Init(void) * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_QueueCreate(osal_id_t *queue_id, const char *queue_name, uint32 queue_depth, uint32 data_size, uint32 flags) +int32 OS_QueueCreate(osal_id_t *queue_id, const char *queue_name, osal_blockcount_t queue_depth, size_t data_size, + uint32 flags) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; if (queue_name == NULL || queue_id == NULL) { @@ -140,7 +141,7 @@ int32 OS_QueueCreate(osal_id_t *queue_id, const char *queue_name, uint32 queue_d int32 OS_QueueDelete(osal_id_t queue_id) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; return_code = OS_ObjectIdGetById(OS_LOCK_MODE_EXCLUSIVE, LOCAL_OBJID_TYPE, queue_id, &local_id, &record); @@ -164,10 +165,10 @@ int32 OS_QueueDelete(osal_id_t queue_id) * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_QueueGet(osal_id_t queue_id, void *data, uint32 size, uint32 *size_copied, int32 timeout) +int32 OS_QueueGet(osal_id_t queue_id, void *data, size_t size, size_t *size_copied, int32 timeout) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -206,10 +207,10 @@ int32 OS_QueueGet(osal_id_t queue_id, void *data, uint32 size, uint32 *size_copi * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_QueuePut(osal_id_t queue_id, const void *data, uint32 size, uint32 flags) +int32 OS_QueuePut(osal_id_t queue_id, const void *data, size_t size, uint32 flags) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -264,7 +265,7 @@ int32 OS_QueueGetInfo(osal_id_t queue_id, OS_queue_prop_t *queue_prop) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; /* Check parameters */ if (queue_prop == NULL) diff --git a/src/os/shared/src/osapi-select.c b/src/os/shared/src/osapi-select.c index 5a3fe885f..f48c27a34 100644 --- a/src/os/shared/src/osapi-select.c +++ b/src/os/shared/src/osapi-select.c @@ -61,7 +61,7 @@ int32 OS_SelectSingle(osal_id_t objid, uint32 *StateFlags, int32 msecs) { int32 return_code; - uint32 local_id; + osal_index_t local_id; OS_common_record_t *record; if (StateFlags == NULL) @@ -126,8 +126,8 @@ int32 OS_SelectFdZero(OS_FdSet *Set) *-----------------------------------------------------------------*/ int32 OS_SelectFdAdd(OS_FdSet *Set, osal_id_t objid) { - int32 return_code; - uint32 local_id; + int32 return_code; + osal_index_t local_id; if (Set == NULL) return OS_INVALID_POINTER; @@ -151,8 +151,8 @@ int32 OS_SelectFdAdd(OS_FdSet *Set, osal_id_t objid) *-----------------------------------------------------------------*/ int32 OS_SelectFdClear(OS_FdSet *Set, osal_id_t objid) { - int32 return_code; - uint32 local_id; + int32 return_code; + osal_index_t local_id; if (Set == NULL) return OS_INVALID_POINTER; @@ -176,8 +176,8 @@ int32 OS_SelectFdClear(OS_FdSet *Set, osal_id_t objid) *-----------------------------------------------------------------*/ bool OS_SelectFdIsSet(OS_FdSet *Set, osal_id_t objid) { - int32 return_code; - uint32 local_id; + int32 return_code; + osal_index_t local_id; if (Set == NULL) return false; diff --git a/src/os/shared/src/osapi-shell.c b/src/os/shared/src/osapi-shell.c index d59668210..50e195068 100644 --- a/src/os/shared/src/osapi-shell.c +++ b/src/os/shared/src/osapi-shell.c @@ -53,7 +53,7 @@ int32 OS_ShellOutputToFile(const char *Cmd, osal_id_t filedes) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ diff --git a/src/os/shared/src/osapi-sockets.c b/src/os/shared/src/osapi-sockets.c index 4a66c5fdb..cca5aee01 100644 --- a/src/os/shared/src/osapi-sockets.c +++ b/src/os/shared/src/osapi-sockets.c @@ -84,9 +84,9 @@ int32 OS_SocketAPI_Init(void) * Purpose: Local helper routine, not part of OSAL API. * *-----------------------------------------------------------------*/ -void OS_CreateSocketName(uint32 local_id, const OS_SockAddr_t *Addr, const char *parent_name) +void OS_CreateSocketName(osal_index_t local_id, const OS_SockAddr_t *Addr, const char *parent_name) { - int32 len; + size_t len; uint16 port; OS_stream_internal_record_t *sock = &OS_stream_table[local_id]; @@ -122,7 +122,7 @@ int32 OS_SocketOpen(osal_id_t *sock_id, OS_SocketDomain_t Domain, OS_SocketType_ { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; /* Check for NULL pointers */ if (sock_id == NULL) @@ -160,7 +160,7 @@ int32 OS_SocketOpen(osal_id_t *sock_id, OS_SocketDomain_t Domain, OS_SocketType_ int32 OS_SocketBind(osal_id_t sock_id, const OS_SockAddr_t *Addr) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -214,8 +214,8 @@ int32 OS_SocketAccept(osal_id_t sock_id, osal_id_t *connsock_id, OS_SockAddr_t * { OS_common_record_t *record; OS_common_record_t *connrecord; - uint32 local_id; - uint32 conn_id = 0; + osal_index_t local_id; + osal_index_t conn_id; int32 return_code; /* Check Parameters */ @@ -232,6 +232,7 @@ int32 OS_SocketAccept(osal_id_t sock_id, osal_id_t *connsock_id, OS_SockAddr_t * * set to OS_SUCCESS when connrecord is also initialized) */ connrecord = NULL; + conn_id = OSAL_INDEX_C(0); return_code = OS_ObjectIdGetById(OS_LOCK_MODE_REFCOUNT, LOCAL_OBJID_TYPE, sock_id, &local_id, &record); if (return_code == OS_SUCCESS) @@ -310,7 +311,7 @@ int32 OS_SocketAccept(osal_id_t sock_id, osal_id_t *connsock_id, OS_SockAddr_t * int32 OS_SocketConnect(osal_id_t sock_id, const OS_SockAddr_t *Addr, int32 Timeout) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -364,10 +365,10 @@ int32 OS_SocketConnect(osal_id_t sock_id, const OS_SockAddr_t *Addr, int32 Timeo * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_SocketRecvFrom(osal_id_t sock_id, void *buffer, uint32 buflen, OS_SockAddr_t *RemoteAddr, int32 timeout) +int32 OS_SocketRecvFrom(osal_id_t sock_id, void *buffer, size_t buflen, OS_SockAddr_t *RemoteAddr, int32 timeout) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -407,10 +408,10 @@ int32 OS_SocketRecvFrom(osal_id_t sock_id, void *buffer, uint32 buflen, OS_SockA * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_SocketSendTo(osal_id_t sock_id, const void *buffer, uint32 buflen, const OS_SockAddr_t *RemoteAddr) +int32 OS_SocketSendTo(osal_id_t sock_id, const void *buffer, size_t buflen, const OS_SockAddr_t *RemoteAddr) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check Parameters */ @@ -470,7 +471,7 @@ int32 OS_SocketGetIdByName(osal_id_t *sock_id, const char *sock_name) int32 OS_SocketGetInfo(osal_id_t sock_id, OS_socket_prop_t *sock_prop) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; int32 return_code; /* Check parameters */ @@ -520,7 +521,7 @@ int32 OS_SocketAddrInit(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain) * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_SocketAddrToString(char *buffer, uint32 buflen, const OS_SockAddr_t *Addr) +int32 OS_SocketAddrToString(char *buffer, size_t buflen, const OS_SockAddr_t *Addr) { if (Addr == NULL || buffer == NULL || buflen == 0) { diff --git a/src/os/shared/src/osapi-task.c b/src/os/shared/src/osapi-task.c index 05817443e..0bb3b96d0 100644 --- a/src/os/shared/src/osapi-task.c +++ b/src/os/shared/src/osapi-task.c @@ -81,8 +81,8 @@ OS_task_internal_record_t OS_task_table[LOCAL_NUM_OBJECTS]; *-----------------------------------------------------------------*/ static int32 OS_TaskPrepare(osal_id_t task_id, osal_task_entry *entrypt) { - int32 return_code; - uint32 local_id; + int32 return_code; + osal_index_t local_id; return_code = OS_ObjectIdToArrayIndex(OS_OBJECT_TYPE_OS_TASK, task_id, &local_id); if (return_code == OS_SUCCESS) @@ -186,18 +186,12 @@ int32 OS_TaskAPI_Init(void) * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_TaskCreate(osal_id_t *task_id, const char *task_name, osal_task_entry function_pointer, uint32 *stack_pointer, - uint32 stack_size, uint32 priority, uint32 flags) +int32 OS_TaskCreate(osal_id_t *task_id, const char *task_name, osal_task_entry function_pointer, + osal_stackptr_t stack_pointer, size_t stack_size, osal_priority_t priority, uint32 flags) { OS_common_record_t *record; int32 return_code; - uint32 local_id; - - /* Check for bad priority */ - if (priority > OS_MAX_TASK_PRIORITY) - { - return OS_ERR_INVALID_PRIORITY; - } + osal_index_t local_id; /* Check for NULL pointers */ if (task_name == NULL || task_id == NULL || function_pointer == NULL) @@ -255,7 +249,7 @@ int32 OS_TaskDelete(osal_id_t task_id) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; osal_task_entry delete_hook; delete_hook = NULL; @@ -294,7 +288,7 @@ void OS_TaskExit() { OS_common_record_t *record; osal_id_t task_id; - uint32 local_id; + osal_index_t local_id; task_id = OS_TaskGetId_Impl(); if (OS_ObjectIdGetById(OS_LOCK_MODE_GLOBAL, LOCAL_OBJID_TYPE, task_id, &local_id, &record) == OS_SUCCESS) @@ -331,33 +325,26 @@ int32 OS_TaskDelay(uint32 millisecond) * See description in API and header file for detail * *-----------------------------------------------------------------*/ -int32 OS_TaskSetPriority(osal_id_t task_id, uint32 new_priority) +int32 OS_TaskSetPriority(osal_id_t task_id, osal_priority_t new_priority) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; - if (new_priority > OS_MAX_TASK_PRIORITY) - { - return_code = OS_ERR_INVALID_PRIORITY; - } - else + return_code = OS_ObjectIdGetById(OS_LOCK_MODE_GLOBAL, LOCAL_OBJID_TYPE, task_id, &local_id, &record); + if (return_code == OS_SUCCESS) { - return_code = OS_ObjectIdGetById(OS_LOCK_MODE_GLOBAL, LOCAL_OBJID_TYPE, task_id, &local_id, &record); + return_code = OS_TaskSetPriority_Impl(local_id, new_priority); + if (return_code == OS_SUCCESS) { - return_code = OS_TaskSetPriority_Impl(local_id, new_priority); - - if (return_code == OS_SUCCESS) - { - /* Use the abstracted priority, not the OS one */ - /* Change the priority in the table as well */ - OS_task_table[local_id].priority = new_priority; - } - - /* Unlock the global from OS_ObjectIdGetAndLock() */ - OS_Unlock_Global(LOCAL_OBJID_TYPE); + /* Use the abstracted priority, not the OS one */ + /* Change the priority in the table as well */ + OS_task_table[local_id].priority = new_priority; } + + /* Unlock the global from OS_ObjectIdGetAndLock() */ + OS_Unlock_Global(LOCAL_OBJID_TYPE); } return return_code; @@ -374,7 +361,7 @@ int32 OS_TaskSetPriority(osal_id_t task_id, uint32 new_priority) int32 OS_TaskRegister(void) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; /* * Just to retain compatibility (really, only the unit test cares) @@ -394,7 +381,7 @@ int32 OS_TaskRegister(void) osal_id_t OS_TaskGetId(void) { OS_common_record_t *record; - uint32 local_id; + osal_index_t local_id; osal_id_t task_id; task_id = OS_TaskGetId_Impl(); @@ -444,7 +431,7 @@ int32 OS_TaskGetInfo(osal_id_t task_id, OS_task_prop_t *task_prop) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; /* Check parameters */ if (task_prop == NULL) @@ -487,7 +474,7 @@ int32 OS_TaskInstallDeleteHandler(osal_task_entry function_pointer) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; osal_id_t task_id; task_id = OS_TaskGetId_Impl(); diff --git a/src/os/shared/src/osapi-time.c b/src/os/shared/src/osapi-time.c index 93b71532f..b73f4b1cb 100644 --- a/src/os/shared/src/osapi-time.c +++ b/src/os/shared/src/osapi-time.c @@ -94,10 +94,11 @@ static int32 OS_DoTimerAdd(osal_id_t *timer_id, const char *timer_name, osal_id_ OS_common_record_t * record; OS_timecb_internal_record_t *local; int32 return_code; - uint32 local_id; - uint32 timebase_local_id; + osal_objtype_t objtype; + osal_index_t local_id; + osal_index_t timebase_local_id; osal_id_t cb_list; - uint32 attach_id; + osal_index_t attach_id; /* ** Check Parameters @@ -128,8 +129,8 @@ static int32 OS_DoTimerAdd(osal_id_t *timer_id, const char *timer_name, osal_id_ * Check our context. Not allowed to use the timer API from a timer callback. * Just interested in the object type returned. */ - local_id = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); - if (local_id == OS_OBJECT_TYPE_OS_TIMEBASE) + objtype = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); + if (objtype == OS_OBJECT_TYPE_OS_TIMEBASE) { return OS_ERR_INCORRECT_OBJ_STATE; } @@ -313,7 +314,8 @@ int32 OS_TimerSet(osal_id_t timer_id, uint32 start_time, uint32 interval_time) OS_common_record_t * record; OS_timecb_internal_record_t *local; int32 return_code; - uint32 local_id; + osal_objtype_t objtype; + osal_index_t local_id; osal_id_t dedicated_timebase_id; dedicated_timebase_id = OS_OBJECT_ID_UNDEFINED; @@ -332,8 +334,8 @@ int32 OS_TimerSet(osal_id_t timer_id, uint32 start_time, uint32 interval_time) * Check our context. Not allowed to use the timer API from a timer callback. * Just interested in the object type returned. */ - local_id = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); - if (local_id == OS_OBJECT_TYPE_OS_TIMEBASE) + objtype = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); + if (objtype == OS_OBJECT_TYPE_OS_TIMEBASE) { return OS_ERR_INCORRECT_OBJ_STATE; } @@ -393,7 +395,8 @@ int32 OS_TimerDelete(osal_id_t timer_id) OS_common_record_t * record; OS_common_record_t * timebase = NULL; int32 return_code; - uint32 local_id; + osal_objtype_t objtype; + osal_index_t local_id; osal_id_t dedicated_timebase_id; dedicated_timebase_id = OS_OBJECT_ID_UNDEFINED; @@ -402,8 +405,8 @@ int32 OS_TimerDelete(osal_id_t timer_id) * Check our context. Not allowed to use the timer API from a timer callback. * Just interested in the object type returned. */ - local_id = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); - if (local_id == OS_OBJECT_TYPE_OS_TIMEBASE) + objtype = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); + if (objtype == OS_OBJECT_TYPE_OS_TIMEBASE) { return OS_ERR_INCORRECT_OBJ_STATE; } @@ -483,8 +486,8 @@ int32 OS_TimerDelete(osal_id_t timer_id) *-----------------------------------------------------------------*/ int32 OS_TimerGetIdByName(osal_id_t *timer_id, const char *timer_name) { - int32 return_code; - uint32 local_id; + int32 return_code; + osal_objtype_t objtype; if (timer_id == NULL || timer_name == NULL) { @@ -495,8 +498,8 @@ int32 OS_TimerGetIdByName(osal_id_t *timer_id, const char *timer_name) * Check our context. Not allowed to use the timer API from a timer callback. * Just interested in the object type returned. */ - local_id = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); - if (local_id == OS_OBJECT_TYPE_OS_TIMEBASE) + objtype = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); + if (objtype == OS_OBJECT_TYPE_OS_TIMEBASE) { return OS_ERR_INCORRECT_OBJ_STATE; } @@ -518,7 +521,8 @@ int32 OS_TimerGetInfo(osal_id_t timer_id, OS_timer_prop_t *timer_prop) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; + osal_objtype_t objtype; /* Check parameters */ if (timer_prop == NULL) @@ -530,8 +534,8 @@ int32 OS_TimerGetInfo(osal_id_t timer_id, OS_timer_prop_t *timer_prop) * Check our context. Not allowed to use the timer API from a timer callback. * Just interested in the object type returned. */ - local_id = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); - if (local_id == OS_OBJECT_TYPE_OS_TIMEBASE) + objtype = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); + if (objtype == OS_OBJECT_TYPE_OS_TIMEBASE) { return OS_ERR_INCORRECT_OBJ_STATE; } diff --git a/src/os/shared/src/osapi-timebase.c b/src/os/shared/src/osapi-timebase.c index e881954b7..17b2a67f1 100644 --- a/src/os/shared/src/osapi-timebase.c +++ b/src/os/shared/src/osapi-timebase.c @@ -100,7 +100,8 @@ int32 OS_TimeBaseCreate(osal_id_t *timer_id, const char *timebase_name, OS_Timer { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_objtype_t objtype; + osal_index_t local_id; /* * Specifying a NULL sync function means the timebase is not externally synchronized. @@ -128,8 +129,8 @@ int32 OS_TimeBaseCreate(osal_id_t *timer_id, const char *timebase_name, OS_Timer * Check our context. Not allowed to use the timer API from a timer callback. * Just interested in the object type returned. */ - local_id = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); - if (local_id == OS_OBJECT_TYPE_OS_TIMEBASE) + objtype = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); + if (objtype == OS_OBJECT_TYPE_OS_TIMEBASE) { return OS_ERR_INCORRECT_OBJ_STATE; } @@ -175,7 +176,8 @@ int32 OS_TimeBaseSet(osal_id_t timer_id, uint32 start_time, uint32 interval_time { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_objtype_t objtype; + osal_index_t local_id; /* * Internally the implementation represents the interval as a @@ -194,8 +196,8 @@ int32 OS_TimeBaseSet(osal_id_t timer_id, uint32 start_time, uint32 interval_time * Check our context. Not allowed to use the timer API from a timer callback. * Just interested in the object type returned. */ - local_id = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); - if (local_id == OS_OBJECT_TYPE_OS_TIMEBASE) + objtype = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); + if (objtype == OS_OBJECT_TYPE_OS_TIMEBASE) { return OS_ERR_INCORRECT_OBJ_STATE; } @@ -235,14 +237,15 @@ int32 OS_TimeBaseDelete(osal_id_t timer_id) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_objtype_t objtype; + osal_index_t local_id; /* * Check our context. Not allowed to use the timer API from a timer callback. * Just interested in the object type returned. */ - local_id = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); - if (local_id == OS_OBJECT_TYPE_OS_TIMEBASE) + objtype = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); + if (objtype == OS_OBJECT_TYPE_OS_TIMEBASE) { return OS_ERR_INCORRECT_OBJ_STATE; } @@ -269,8 +272,8 @@ int32 OS_TimeBaseDelete(osal_id_t timer_id) *-----------------------------------------------------------------*/ int32 OS_TimeBaseGetIdByName(osal_id_t *timer_id, const char *timebase_name) { - int32 return_code; - uint32 local_id; + int32 return_code; + osal_objtype_t objtype; if (timer_id == NULL || timebase_name == NULL) { @@ -281,8 +284,8 @@ int32 OS_TimeBaseGetIdByName(osal_id_t *timer_id, const char *timebase_name) * Check our context. Not allowed to use the timer API from a timer callback. * Just interested in the object type returned. */ - local_id = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); - if (local_id == OS_OBJECT_TYPE_OS_TIMEBASE) + objtype = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); + if (objtype == OS_OBJECT_TYPE_OS_TIMEBASE) { return OS_ERR_INCORRECT_OBJ_STATE; } @@ -304,7 +307,8 @@ int32 OS_TimeBaseGetInfo(osal_id_t timebase_id, OS_timebase_prop_t *timebase_pro { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_objtype_t objtype; + osal_index_t local_id; /* Check parameters */ if (timebase_prop == NULL) @@ -316,8 +320,8 @@ int32 OS_TimeBaseGetInfo(osal_id_t timebase_id, OS_timebase_prop_t *timebase_pro * Check our context. Not allowed to use the timer API from a timer callback. * Just interested in the object type returned. */ - local_id = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); - if (local_id == OS_OBJECT_TYPE_OS_TIMEBASE) + objtype = OS_ObjectIdToType_Impl(OS_TaskGetId_Impl()); + if (objtype == OS_OBJECT_TYPE_OS_TIMEBASE) { return OS_ERR_INCORRECT_OBJ_STATE; } @@ -353,7 +357,7 @@ int32 OS_TimeBaseGetFreeRun(osal_id_t timebase_id, uint32 *freerun_val) { OS_common_record_t *record; int32 return_code; - uint32 local_id; + osal_index_t local_id; /* Check parameters */ return_code = OS_ObjectIdGetById(OS_LOCK_MODE_NONE, LOCAL_OBJID_TYPE, timebase_id, &local_id, &record); @@ -390,9 +394,9 @@ void OS_TimeBase_CallbackThread(osal_id_t timebase_id) OS_timebase_internal_record_t *timebase; OS_timecb_internal_record_t * timecb; OS_common_record_t * record; - uint32 local_id; - uint32 timer_id; - uint32 curr_cb_local_id; + osal_index_t local_id; + osal_index_t timer_id; + osal_index_t curr_cb_local_id; osal_id_t curr_cb_public_id; uint32 tick_time; uint32 spin_cycles; diff --git a/src/os/vxworks/inc/os-impl-io.h b/src/os/vxworks/inc/os-impl-io.h index 0bf73c3bc..04034d807 100644 --- a/src/os/vxworks/inc/os-impl-io.h +++ b/src/os/vxworks/inc/os-impl-io.h @@ -38,7 +38,7 @@ typedef struct { int fd; bool selectable; -} OS_VxWorks_filehandle_entry_t; +} OS_impl_file_internal_record_t; /* * The global file handle table. @@ -46,7 +46,7 @@ typedef struct * This table is shared across multiple units (files, sockets, etc) and they will share * the same file handle table from the basic file I/O. */ -extern OS_VxWorks_filehandle_entry_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; +extern OS_impl_file_internal_record_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; /* * VxWorks needs to cast the argument to "write()" to avoid a warning. diff --git a/src/os/vxworks/inc/os-impl-symtab.h b/src/os/vxworks/inc/os-impl-symtab.h index 373d9b60c..9f0caa46c 100644 --- a/src/os/vxworks/inc/os-impl-symtab.h +++ b/src/os/vxworks/inc/os-impl-symtab.h @@ -33,8 +33,8 @@ typedef struct { - uint32 Sizelimit; - uint32 CurrSize; + size_t Sizelimit; + size_t CurrSize; int32 StatusCode; int fd; } SymbolDumpState_t; diff --git a/src/os/vxworks/inc/os-vxworks.h b/src/os/vxworks/inc/os-vxworks.h index 9b993db96..997a12aaa 100644 --- a/src/os/vxworks/inc/os-vxworks.h +++ b/src/os/vxworks/inc/os-vxworks.h @@ -92,14 +92,14 @@ int32 OS_VxWorks_DirAPI_Impl_Init(void); int OS_VxWorks_TaskEntry(int arg); int OS_VxWorks_ConsoleTask_Entry(int arg); -uint32 OS_VxWorks_SigWait(uint32 local_id); +uint32 OS_VxWorks_SigWait(osal_index_t local_id); int OS_VxWorks_TimeBaseTask(int arg); -void OS_VxWorks_RegisterTimer(uint32 local_id); +void OS_VxWorks_RegisterTimer(osal_index_t local_id); void OS_VxWorks_UsecToTimespec(uint32 usecs, struct timespec *time_spec); int32 OS_VxWorks_GenericSemTake(SEM_ID vxid, int sys_ticks); int32 OS_VxWorks_GenericSemGive(SEM_ID vxid); -int32 OS_VxWorks_TableMutex_Init(uint32 idtype); +int32 OS_VxWorks_TableMutex_Init(osal_objtype_t idtype); #endif /* INCLUDE_OS_VXWORKS_H_ */ diff --git a/src/os/vxworks/src/os-impl-binsem.c b/src/os/vxworks/src/os-impl-binsem.c index c2c0c4e96..0f90efd2b 100644 --- a/src/os/vxworks/src/os-impl-binsem.c +++ b/src/os/vxworks/src/os-impl-binsem.c @@ -70,7 +70,7 @@ int32 OS_VxWorks_BinSemAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 options) +int32 OS_BinSemCreate_Impl(osal_index_t sem_id, uint32 sem_initial_value, uint32 options) { SEM_ID tmp_sem_id; @@ -98,7 +98,7 @@ int32 OS_BinSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 optio * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemDelete_Impl(uint32 sem_id) +int32 OS_BinSemDelete_Impl(osal_index_t sem_id) { /* * As the memory for the sem is statically allocated, delete is a no-op. @@ -116,7 +116,7 @@ int32 OS_BinSemDelete_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemGive_Impl(uint32 sem_id) +int32 OS_BinSemGive_Impl(osal_index_t sem_id) { /* Use common routine */ return OS_VxWorks_GenericSemGive(OS_impl_bin_sem_table[sem_id].vxid); @@ -130,7 +130,7 @@ int32 OS_BinSemGive_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemFlush_Impl(uint32 sem_id) +int32 OS_BinSemFlush_Impl(osal_index_t sem_id) { /* Flush VxWorks Semaphore */ if (semFlush(OS_impl_bin_sem_table[sem_id].vxid) != OK) @@ -150,7 +150,7 @@ int32 OS_BinSemFlush_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemTake_Impl(uint32 sem_id) +int32 OS_BinSemTake_Impl(osal_index_t sem_id) { /* Use common routine */ return OS_VxWorks_GenericSemTake(OS_impl_bin_sem_table[sem_id].vxid, WAIT_FOREVER); @@ -165,7 +165,7 @@ int32 OS_BinSemTake_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemTimedWait_Impl(uint32 sem_id, uint32 msecs) +int32 OS_BinSemTimedWait_Impl(osal_index_t sem_id, uint32 msecs) { int ticks; int32 status; @@ -188,7 +188,7 @@ int32 OS_BinSemTimedWait_Impl(uint32 sem_id, uint32 msecs) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_BinSemGetInfo_Impl(uint32 sem_id, OS_bin_sem_prop_t *bin_prop) +int32 OS_BinSemGetInfo_Impl(osal_index_t sem_id, OS_bin_sem_prop_t *bin_prop) { /* VxWorks has no API for obtaining the current value of a semaphore */ return OS_SUCCESS; diff --git a/src/os/vxworks/src/os-impl-common.c b/src/os/vxworks/src/os-impl-common.c index 6c3dc4aa8..beed30470 100644 --- a/src/os/vxworks/src/os-impl-common.c +++ b/src/os/vxworks/src/os-impl-common.c @@ -60,7 +60,7 @@ static TASK_ID OS_idle_task_id; * about objects * *-----------------------------------------------------------------*/ -int32 OS_API_Impl_Init(uint32 idtype) +int32 OS_API_Impl_Init(osal_objtype_t idtype) { int32 return_code; diff --git a/src/os/vxworks/src/os-impl-console.c b/src/os/vxworks/src/os-impl-console.c index 52f82aa64..7accef4bb 100644 --- a/src/os/vxworks/src/os-impl-console.c +++ b/src/os/vxworks/src/os-impl-console.c @@ -66,7 +66,7 @@ OS_impl_console_internal_record_t OS_impl_console_table[OS_MAX_CONSOLES]; * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -void OS_ConsoleWakeup_Impl(uint32 local_id) +void OS_ConsoleWakeup_Impl(osal_index_t local_id) { OS_impl_console_internal_record_t *local = &OS_impl_console_table[local_id]; @@ -94,7 +94,7 @@ void OS_ConsoleWakeup_Impl(uint32 local_id) *-----------------------------------------------------------------*/ int OS_VxWorks_ConsoleTask_Entry(int arg) { - uint32 local_id = arg; + osal_index_t local_id = OSAL_INDEX_C(arg); OS_impl_console_internal_record_t *local; local = &OS_impl_console_table[local_id]; @@ -119,7 +119,7 @@ int OS_VxWorks_ConsoleTask_Entry(int arg) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ConsoleCreate_Impl(uint32 local_id) +int32 OS_ConsoleCreate_Impl(osal_index_t local_id) { OS_impl_console_internal_record_t *local = &OS_impl_console_table[local_id]; int32 return_code; diff --git a/src/os/vxworks/src/os-impl-countsem.c b/src/os/vxworks/src/os-impl-countsem.c index c22f847d4..41cff591d 100644 --- a/src/os/vxworks/src/os-impl-countsem.c +++ b/src/os/vxworks/src/os-impl-countsem.c @@ -69,7 +69,7 @@ int32 OS_VxWorks_CountSemAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 options) +int32 OS_CountSemCreate_Impl(osal_index_t sem_id, uint32 sem_initial_value, uint32 options) { SEM_ID tmp_sem_id; @@ -97,7 +97,7 @@ int32 OS_CountSemCreate_Impl(uint32 sem_id, uint32 sem_initial_value, uint32 opt * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemDelete_Impl(uint32 sem_id) +int32 OS_CountSemDelete_Impl(osal_index_t sem_id) { /* * As the memory for the sem is statically allocated, delete is a no-op. @@ -115,7 +115,7 @@ int32 OS_CountSemDelete_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemGive_Impl(uint32 sem_id) +int32 OS_CountSemGive_Impl(osal_index_t sem_id) { /* Give VxWorks Semaphore */ return OS_VxWorks_GenericSemGive(OS_impl_count_sem_table[sem_id].vxid); @@ -129,7 +129,7 @@ int32 OS_CountSemGive_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemTake_Impl(uint32 sem_id) +int32 OS_CountSemTake_Impl(osal_index_t sem_id) { return OS_VxWorks_GenericSemTake(OS_impl_count_sem_table[sem_id].vxid, WAIT_FOREVER); } /* end OS_CountSemTake_Impl */ @@ -142,7 +142,7 @@ int32 OS_CountSemTake_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemTimedWait_Impl(uint32 sem_id, uint32 msecs) +int32 OS_CountSemTimedWait_Impl(osal_index_t sem_id, uint32 msecs) { int ticks; int32 status; @@ -165,7 +165,7 @@ int32 OS_CountSemTimedWait_Impl(uint32 sem_id, uint32 msecs) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_CountSemGetInfo_Impl(uint32 sem_id, OS_count_sem_prop_t *count_prop) +int32 OS_CountSemGetInfo_Impl(osal_index_t sem_id, OS_count_sem_prop_t *count_prop) { /* VxWorks does not provide an API to get the value */ return OS_SUCCESS; diff --git a/src/os/vxworks/src/os-impl-dirs.c b/src/os/vxworks/src/os-impl-dirs.c index 9e6cff52f..513b8b878 100644 --- a/src/os/vxworks/src/os-impl-dirs.c +++ b/src/os/vxworks/src/os-impl-dirs.c @@ -83,7 +83,7 @@ int32 OS_DirCreate_Impl(const char *local_path, uint32 access) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_DirOpen_Impl(uint32 local_id, const char *local_path) +int32 OS_DirOpen_Impl(osal_index_t local_id, const char *local_path) { OS_impl_dir_table[local_id].dp = opendir(local_path); if (OS_impl_dir_table[local_id].dp == NULL) @@ -101,7 +101,7 @@ int32 OS_DirOpen_Impl(uint32 local_id, const char *local_path) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_DirClose_Impl(uint32 local_id) +int32 OS_DirClose_Impl(osal_index_t local_id) { closedir(OS_impl_dir_table[local_id].dp); OS_impl_dir_table[local_id].dp = NULL; @@ -116,7 +116,7 @@ int32 OS_DirClose_Impl(uint32 local_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_DirRead_Impl(uint32 local_id, os_dirent_t *dirent) +int32 OS_DirRead_Impl(osal_index_t local_id, os_dirent_t *dirent) { struct dirent *de; @@ -149,7 +149,7 @@ int32 OS_DirRead_Impl(uint32 local_id, os_dirent_t *dirent) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_DirRewind_Impl(uint32 local_id) +int32 OS_DirRewind_Impl(osal_index_t local_id) { rewinddir(OS_impl_dir_table[local_id].dp); return OS_SUCCESS; diff --git a/src/os/vxworks/src/os-impl-files.c b/src/os/vxworks/src/os-impl-files.c index cb024ebd1..c839fe469 100644 --- a/src/os/vxworks/src/os-impl-files.c +++ b/src/os/vxworks/src/os-impl-files.c @@ -38,7 +38,7 @@ * * This is shared by all OSAL entities that perform low-level I/O. */ -OS_VxWorks_filehandle_entry_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; +OS_impl_file_internal_record_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; /*---------------------------------------------------------------- * @@ -49,7 +49,7 @@ OS_VxWorks_filehandle_entry_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; *-----------------------------------------------------------------*/ int32 OS_VxWorks_StreamAPI_Impl_Init(void) { - uint32 local_id; + osal_index_t local_id; /* * init all filehandles to -1, which is always invalid. diff --git a/src/os/vxworks/src/os-impl-filesys.c b/src/os/vxworks/src/os-impl-filesys.c index 1a3a3ff32..2876348e4 100644 --- a/src/os/vxworks/src/os-impl-filesys.c +++ b/src/os/vxworks/src/os-impl-filesys.c @@ -76,7 +76,7 @@ OS_impl_filesys_internal_record_t OS_impl_filesys_table[OS_MAX_FILE_SYSTEMS]; * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysStartVolume_Impl(uint32 filesys_id) +int32 OS_FileSysStartVolume_Impl(osal_index_t filesys_id) { OS_filesys_internal_record_t * local = &OS_filesys_table[filesys_id]; OS_impl_filesys_internal_record_t *impl = &OS_impl_filesys_table[filesys_id]; @@ -192,7 +192,7 @@ int32 OS_FileSysStartVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysStopVolume_Impl(uint32 filesys_id) +int32 OS_FileSysStopVolume_Impl(osal_index_t filesys_id) { OS_filesys_internal_record_t * local = &OS_filesys_table[filesys_id]; OS_impl_filesys_internal_record_t *impl = &OS_impl_filesys_table[filesys_id]; @@ -231,7 +231,7 @@ int32 OS_FileSysStopVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysFormatVolume_Impl(uint32 filesys_id) +int32 OS_FileSysFormatVolume_Impl(osal_index_t filesys_id) { OS_filesys_internal_record_t *local = &OS_filesys_table[filesys_id]; int32 return_code = OS_ERR_NOT_IMPLEMENTED; @@ -282,7 +282,7 @@ int32 OS_FileSysFormatVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysMountVolume_Impl(uint32 filesys_id) +int32 OS_FileSysMountVolume_Impl(osal_index_t filesys_id) { OS_filesys_internal_record_t *local = &OS_filesys_table[filesys_id]; int32 status; @@ -315,7 +315,7 @@ int32 OS_FileSysMountVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysUnmountVolume_Impl(uint32 filesys_id) +int32 OS_FileSysUnmountVolume_Impl(osal_index_t filesys_id) { OS_filesys_internal_record_t *local = &OS_filesys_table[filesys_id]; int32 status; @@ -355,7 +355,7 @@ int32 OS_FileSysUnmountVolume_Impl(uint32 filesys_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysStatVolume_Impl(uint32 filesys_id, OS_statvfs_t *result) +int32 OS_FileSysStatVolume_Impl(osal_index_t filesys_id, OS_statvfs_t *result) { OS_filesys_internal_record_t *local = &OS_filesys_table[filesys_id]; struct statfs stat_buf; @@ -368,9 +368,9 @@ int32 OS_FileSysStatVolume_Impl(uint32 filesys_id, OS_statvfs_t *result) } else { - result->block_size = stat_buf.f_bsize; - result->blocks_free = stat_buf.f_bfree; - result->total_blocks = stat_buf.f_blocks; + result->block_size = OSAL_SIZE_C(stat_buf.f_bsize); + result->blocks_free = OSAL_BLOCKCOUNT_C(stat_buf.f_bfree); + result->total_blocks = OSAL_BLOCKCOUNT_C(stat_buf.f_blocks); return_code = OS_SUCCESS; } @@ -386,7 +386,7 @@ int32 OS_FileSysStatVolume_Impl(uint32 filesys_id, OS_statvfs_t *result) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_FileSysCheckVolume_Impl(uint32 filesys_id, bool repair) +int32 OS_FileSysCheckVolume_Impl(osal_index_t filesys_id, bool repair) { OS_filesys_internal_record_t *local = &OS_filesys_table[filesys_id]; STATUS chk_status; diff --git a/src/os/vxworks/src/os-impl-heap.c b/src/os/vxworks/src/os-impl-heap.c index fb46f0780..8931130c0 100644 --- a/src/os/vxworks/src/os-impl-heap.c +++ b/src/os/vxworks/src/os-impl-heap.c @@ -57,9 +57,9 @@ int32 OS_HeapGetInfo_Impl(OS_heap_prop_t *heap_prop) return OS_ERROR; } - heap_prop->free_bytes = stats.numBytesFree; - heap_prop->free_blocks = stats.numBlocksFree; - heap_prop->largest_free_block = stats.maxBlockSizeFree; + heap_prop->free_bytes = OSAL_SIZE_C(stats.numBytesFree); + heap_prop->free_blocks = OSAL_BLOCKCOUNT_C(stats.numBlocksFree); + heap_prop->largest_free_block = OSAL_SIZE_C(stats.maxBlockSizeFree); return (OS_SUCCESS); } /* end OS_HeapGetInfo_Impl */ diff --git a/src/os/vxworks/src/os-impl-idmap.c b/src/os/vxworks/src/os-impl-idmap.c index 41752a387..4ec8d728d 100644 --- a/src/os/vxworks/src/os-impl-idmap.c +++ b/src/os/vxworks/src/os-impl-idmap.c @@ -86,7 +86,7 @@ enum * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_Lock_Global_Impl(uint32 idtype) +int32 OS_Lock_Global_Impl(osal_objtype_t idtype) { VxWorks_GlobalMutex_t *mut; @@ -118,7 +118,7 @@ int32 OS_Lock_Global_Impl(uint32 idtype) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_Unlock_Global_Impl(uint32 idtype) +int32 OS_Unlock_Global_Impl(osal_objtype_t idtype) { VxWorks_GlobalMutex_t *mut; @@ -154,7 +154,7 @@ int32 OS_Unlock_Global_Impl(uint32 idtype) * about objects * *-----------------------------------------------------------------*/ -int32 OS_VxWorks_TableMutex_Init(uint32 idtype) +int32 OS_VxWorks_TableMutex_Init(osal_objtype_t idtype) { int32 return_code = OS_SUCCESS; SEM_ID semid; diff --git a/src/os/vxworks/src/os-impl-loader.c b/src/os/vxworks/src/os-impl-loader.c index 7ab65fae6..ba9a607c2 100644 --- a/src/os/vxworks/src/os-impl-loader.c +++ b/src/os/vxworks/src/os-impl-loader.c @@ -71,7 +71,7 @@ int32 OS_VxWorks_ModuleAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleLoad_Impl(uint32 local_id, const char *translated_path) +int32 OS_ModuleLoad_Impl(osal_index_t local_id, const char *translated_path) { int32 return_code; int fd; @@ -126,7 +126,7 @@ int32 OS_ModuleLoad_Impl(uint32 local_id, const char *translated_path) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleUnload_Impl(uint32 local_id) +int32 OS_ModuleUnload_Impl(osal_index_t local_id) { STATUS vxStatus; @@ -152,7 +152,7 @@ int32 OS_ModuleUnload_Impl(uint32 local_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleGetInfo_Impl(uint32 local_id, OS_module_prop_t *module_prop) +int32 OS_ModuleGetInfo_Impl(osal_index_t local_id, OS_module_prop_t *module_prop) { MODULE_INFO vxModuleInfo; STATUS vxStatus; diff --git a/src/os/vxworks/src/os-impl-mutex.c b/src/os/vxworks/src/os-impl-mutex.c index 54273f14e..72e09afe5 100644 --- a/src/os/vxworks/src/os-impl-mutex.c +++ b/src/os/vxworks/src/os-impl-mutex.c @@ -67,7 +67,7 @@ int32 OS_VxWorks_MutexAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemCreate_Impl(uint32 sem_id, uint32 options) +int32 OS_MutSemCreate_Impl(osal_index_t sem_id, uint32 options) { SEM_ID tmp_sem_id; @@ -93,7 +93,7 @@ int32 OS_MutSemCreate_Impl(uint32 sem_id, uint32 options) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemDelete_Impl(uint32 sem_id) +int32 OS_MutSemDelete_Impl(osal_index_t sem_id) { /* * As the memory for the sem is statically allocated, delete is a no-op. @@ -111,7 +111,7 @@ int32 OS_MutSemDelete_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemGive_Impl(uint32 sem_id) +int32 OS_MutSemGive_Impl(osal_index_t sem_id) { /* Give VxWorks Semaphore */ return OS_VxWorks_GenericSemGive(OS_impl_mutex_table[sem_id].vxid); @@ -125,7 +125,7 @@ int32 OS_MutSemGive_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemTake_Impl(uint32 sem_id) +int32 OS_MutSemTake_Impl(osal_index_t sem_id) { /* Take VxWorks Semaphore */ return OS_VxWorks_GenericSemTake(OS_impl_mutex_table[sem_id].vxid, WAIT_FOREVER); @@ -139,7 +139,7 @@ int32 OS_MutSemTake_Impl(uint32 sem_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_MutSemGetInfo_Impl(uint32 sem_id, OS_mut_sem_prop_t *mut_prop) +int32 OS_MutSemGetInfo_Impl(osal_index_t sem_id, OS_mut_sem_prop_t *mut_prop) { /* VxWorks provides no additional info */ return OS_SUCCESS; diff --git a/src/os/vxworks/src/os-impl-network.c b/src/os/vxworks/src/os-impl-network.c index 63c526be6..6180c1439 100644 --- a/src/os/vxworks/src/os-impl-network.c +++ b/src/os/vxworks/src/os-impl-network.c @@ -43,7 +43,7 @@ * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_NetworkGetHostName_Impl(char *host_name, uint32 name_len) +int32 OS_NetworkGetHostName_Impl(char *host_name, size_t name_len) { int32 return_code; diff --git a/src/os/vxworks/src/os-impl-queues.c b/src/os/vxworks/src/os-impl-queues.c index 319d5e1dd..bbc95b175 100644 --- a/src/os/vxworks/src/os-impl-queues.c +++ b/src/os/vxworks/src/os-impl-queues.c @@ -63,7 +63,7 @@ int32 OS_VxWorks_QueueAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueueCreate_Impl(uint32 queue_id, uint32 flags) +int32 OS_QueueCreate_Impl(osal_index_t queue_id, uint32 flags) { MSG_Q_ID tmp_msgq_id; int queue_depth = OS_queue_table[queue_id].max_depth; /* maximum number of messages in queue (queue depth) */ @@ -92,7 +92,7 @@ int32 OS_QueueCreate_Impl(uint32 queue_id, uint32 flags) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueueDelete_Impl(uint32 queue_id) +int32 OS_QueueDelete_Impl(osal_index_t queue_id) { /* Try to delete the queue */ if (msgQDelete(OS_impl_queue_table[queue_id].vxid) != OK) @@ -114,7 +114,7 @@ int32 OS_QueueDelete_Impl(uint32 queue_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueueGet_Impl(uint32 queue_id, void *data, uint32 size, uint32 *size_copied, int32 timeout) +int32 OS_QueueGet_Impl(osal_index_t queue_id, void *data, size_t size, size_t *size_copied, int32 timeout) { int32 return_code; STATUS status; @@ -159,7 +159,7 @@ int32 OS_QueueGet_Impl(uint32 queue_id, void *data, uint32 size, uint32 *size_co } else { - *size_copied = status; + *size_copied = OSAL_SIZE_C(status); return_code = OS_SUCCESS; } @@ -174,7 +174,7 @@ int32 OS_QueueGet_Impl(uint32 queue_id, void *data, uint32 size, uint32 *size_co * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueuePut_Impl(uint32 queue_id, const void *data, uint32 size, uint32 flags) +int32 OS_QueuePut_Impl(osal_index_t queue_id, const void *data, size_t size, uint32 flags) { int32 return_code; @@ -204,7 +204,7 @@ int32 OS_QueuePut_Impl(uint32 queue_id, const void *data, uint32 size, uint32 fl * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_QueueGetInfo_Impl(uint32 queue_id, OS_queue_prop_t *queue_prop) +int32 OS_QueueGetInfo_Impl(osal_index_t queue_id, OS_queue_prop_t *queue_prop) { /* No extra info for queues in the OS implementation */ return OS_SUCCESS; diff --git a/src/os/vxworks/src/os-impl-shell.c b/src/os/vxworks/src/os-impl-shell.c index a43fce496..2b942a41d 100644 --- a/src/os/vxworks/src/os-impl-shell.c +++ b/src/os/vxworks/src/os-impl-shell.c @@ -52,13 +52,13 @@ * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ShellOutputToFile_Impl(uint32 file_id, const char *Cmd) +int32 OS_ShellOutputToFile_Impl(osal_index_t file_id, const char *Cmd) { - int32 ReturnCode = OS_ERROR; - int32 Result; - osal_id_t fdCmd; - uint32 cmdidx; - char * shellName; + int32 ReturnCode = OS_ERROR; + int32 Result; + osal_id_t fdCmd; + osal_index_t cmdidx; + char * shellName; /* Create a file to write the command to (or write over the old one) */ Result = diff --git a/src/os/vxworks/src/os-impl-symtab.c b/src/os/vxworks/src/os-impl-symtab.c index 31b2db5c4..be689df95 100644 --- a/src/os/vxworks/src/os-impl-symtab.c +++ b/src/os/vxworks/src/os-impl-symtab.c @@ -128,7 +128,7 @@ int32 OS_GlobalSymbolLookup_Impl(cpuaddr *SymbolAddress, const char *SymbolName) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_ModuleSymbolLookup_Impl(uint32 local_id, cpuaddr *SymbolAddress, const char *SymbolName) +int32 OS_ModuleSymbolLookup_Impl(osal_index_t local_id, cpuaddr *SymbolAddress, const char *SymbolName) { /* * NOTE: this is currently exactly the same as OS_GlobalSymbolLookup_Impl(). @@ -165,7 +165,7 @@ int32 OS_ModuleSymbolLookup_Impl(uint32 local_id, cpuaddr *SymbolAddress, const BOOL OS_SymTableIterator_Impl(char *name, SYM_VALUE val, SYM_TYPE type, _Vx_usr_arg_t arg, SYM_GROUP group) { SymbolRecord_t symRecord; - uint32 NextSize; + size_t NextSize; int status; SymbolDumpState_t *state; @@ -234,7 +234,7 @@ BOOL OS_SymTableIterator_Impl(char *name, SYM_VALUE val, SYM_TYPE type, _Vx_usr_ * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_SymbolTableDump_Impl(const char *local_filename, uint32 SizeLimit) +int32 OS_SymbolTableDump_Impl(const char *filename, size_t size_limit) { SymbolDumpState_t *state; @@ -245,15 +245,15 @@ int32 OS_SymbolTableDump_Impl(const char *local_filename, uint32 SizeLimit) state = &OS_VxWorks_SymbolDumpState; memset(state, 0, sizeof(*state)); - state->Sizelimit = SizeLimit; + state->Sizelimit = size_limit; /* ** Open file */ - state->fd = open(local_filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); + state->fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (state->fd < 0) { - OS_DEBUG("open(%s): error: %s\n", local_filename, strerror(errno)); + OS_DEBUG("open(%s): error: %s\n", filename, strerror(errno)); state->StatusCode = OS_ERROR; } else diff --git a/src/os/vxworks/src/os-impl-tasks.c b/src/os/vxworks/src/os-impl-tasks.c index fac9ae90e..22d65332e 100644 --- a/src/os/vxworks/src/os-impl-tasks.c +++ b/src/os/vxworks/src/os-impl-tasks.c @@ -117,7 +117,7 @@ int32 OS_VxWorks_TaskAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskCreate_Impl(uint32 task_id, uint32 flags) +int32 OS_TaskCreate_Impl(osal_index_t task_id, uint32 flags) { STATUS status; int vxflags; @@ -268,7 +268,7 @@ int32 OS_TaskCreate_Impl(uint32 task_id, uint32 flags) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskDelete_Impl(uint32 task_id) +int32 OS_TaskDelete_Impl(osal_index_t task_id) { /* ** Try to delete the task @@ -336,7 +336,7 @@ int32 OS_TaskDelay_Impl(uint32 milli_second) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskSetPriority_Impl(uint32 task_id, uint32 new_priority) +int32 OS_TaskSetPriority_Impl(osal_index_t task_id, osal_priority_t new_priority) { /* Set VxWorks Task Priority */ if (taskPrioritySet(OS_impl_task_table[task_id].vxid, new_priority) != OK) @@ -356,7 +356,7 @@ int32 OS_TaskSetPriority_Impl(uint32 task_id, uint32 new_priority) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskMatch_Impl(uint32 task_id) +int32 OS_TaskMatch_Impl(osal_index_t task_id) { /* ** Get VxWorks Task Id @@ -393,7 +393,7 @@ int32 OS_TaskRegister_Impl(osal_id_t global_task_id) osal_id_t OS_TaskGetId_Impl(void) { OS_impl_task_internal_record_t *lrec; - size_t index; + size_t idx; osal_id_t id; id = OS_OBJECT_ID_UNDEFINED; @@ -401,10 +401,10 @@ osal_id_t OS_TaskGetId_Impl(void) if (lrec != NULL) { - index = lrec - &OS_impl_task_table[0]; - if (index < OS_MAX_TASKS) + idx = lrec - &OS_impl_task_table[0]; + if (idx < OS_MAX_TASKS) { - id = OS_global_task_table[index].active_id; + id = OS_global_task_table[idx].active_id; } } @@ -420,7 +420,7 @@ osal_id_t OS_TaskGetId_Impl(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskGetInfo_Impl(uint32 task_id, OS_task_prop_t *task_prop) +int32 OS_TaskGetInfo_Impl(osal_index_t task_id, OS_task_prop_t *task_prop) { return OS_SUCCESS; @@ -434,7 +434,7 @@ int32 OS_TaskGetInfo_Impl(uint32 task_id, OS_task_prop_t *task_prop) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TaskValidateSystemData_Impl(const void *sysdata, uint32 sysdata_size) +int32 OS_TaskValidateSystemData_Impl(const void *sysdata, size_t sysdata_size) { if (sysdata == NULL || sysdata_size != sizeof(TASK_ID)) { @@ -451,7 +451,7 @@ int32 OS_TaskValidateSystemData_Impl(const void *sysdata, uint32 sysdata_size) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -bool OS_TaskIdMatchSystemData_Impl(void *ref, uint32 local_id, const OS_common_record_t *obj) +bool OS_TaskIdMatchSystemData_Impl(void *ref, osal_index_t local_id, const OS_common_record_t *obj) { const TASK_ID *target = (const TASK_ID *)ref; diff --git a/src/os/vxworks/src/os-impl-timebase.c b/src/os/vxworks/src/os-impl-timebase.c index 28955632e..e3d159317 100644 --- a/src/os/vxworks/src/os-impl-timebase.c +++ b/src/os/vxworks/src/os-impl-timebase.c @@ -93,7 +93,7 @@ static uint32 OS_ClockAccuracyNsec; * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -void OS_TimeBaseLock_Impl(uint32 local_id) +void OS_TimeBaseLock_Impl(osal_index_t local_id) { semTake(OS_impl_timebase_table[local_id].handler_mutex, WAIT_FOREVER); } /* end OS_TimeBaseLock_Impl */ @@ -106,7 +106,7 @@ void OS_TimeBaseLock_Impl(uint32 local_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -void OS_TimeBaseUnlock_Impl(uint32 local_id) +void OS_TimeBaseUnlock_Impl(osal_index_t local_id) { semGive(OS_impl_timebase_table[local_id].handler_mutex); } /* end OS_TimeBaseUnlock_Impl */ @@ -140,7 +140,7 @@ void OS_VxWorks_UsecToTimespec(uint32 usecs, struct timespec *time_spec) * Blocks the calling task until the timer tick arrives * *-----------------------------------------------------------------*/ -uint32 OS_VxWorks_SigWait(uint32 local_id) +uint32 OS_VxWorks_SigWait(osal_index_t local_id) { OS_impl_timebase_internal_record_t *local; OS_common_record_t * global; @@ -204,7 +204,7 @@ uint32 OS_VxWorks_SigWait(uint32 local_id) * Purpose: Local helper routine, not part of OSAL API. * *-----------------------------------------------------------------*/ -void OS_VxWorks_RegisterTimer(uint32 local_id) +void OS_VxWorks_RegisterTimer(osal_index_t local_id) { OS_impl_timebase_internal_record_t *local; struct sigevent evp; @@ -253,7 +253,7 @@ void OS_VxWorks_RegisterTimer(uint32 local_id) int OS_VxWorks_TimeBaseTask(int arg) { VxWorks_ID_Buffer_t id; - uint32 local_id; + osal_index_t local_id; id.arg = arg; if (OS_ConvertToArrayIndex(id.id, &local_id) == OS_SUCCESS) @@ -323,7 +323,7 @@ int32 OS_VxWorks_TimeBaseAPI_Impl_Init(void) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseCreate_Impl(uint32 timer_id) +int32 OS_TimeBaseCreate_Impl(osal_index_t timer_id) { /* * The tick_sem is a simple semaphore posted by the ISR and taken by the @@ -334,6 +334,7 @@ int32 OS_TimeBaseCreate_Impl(uint32 timer_id) OS_common_record_t * global; int signo; sigset_t inuse; + osal_index_t idx; uint32 i; VxWorks_ID_Buffer_t idbuf; @@ -367,13 +368,13 @@ int32 OS_TimeBaseCreate_Impl(uint32 timer_id) */ sigemptyset(&inuse); - for (i = 0; i < OS_MAX_TIMEBASES; ++i) + for (idx = 0; idx < OS_MAX_TIMEBASES; ++idx) { - if (OS_ObjectIdDefined(OS_global_timebase_table[i].active_id) && - OS_impl_timebase_table[i].assigned_signal > 0) + if (OS_ObjectIdDefined(OS_global_timebase_table[idx].active_id) && + OS_impl_timebase_table[idx].assigned_signal > 0) { /* mark signal as in-use */ - sigaddset(&inuse, OS_impl_timebase_table[i].assigned_signal); + sigaddset(&inuse, OS_impl_timebase_table[idx].assigned_signal); } } @@ -500,7 +501,7 @@ int32 OS_TimeBaseCreate_Impl(uint32 timer_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseSet_Impl(uint32 timer_id, int32 start_time, int32 interval_time) +int32 OS_TimeBaseSet_Impl(osal_index_t timer_id, int32 start_time, int32 interval_time) { OS_impl_timebase_internal_record_t *local; struct itimerspec timeout; @@ -588,7 +589,7 @@ int32 OS_TimeBaseSet_Impl(uint32 timer_id, int32 start_time, int32 interval_time * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseDelete_Impl(uint32 timer_id) +int32 OS_TimeBaseDelete_Impl(osal_index_t timer_id) { OS_impl_timebase_internal_record_t *local; int32 return_code; @@ -622,7 +623,7 @@ int32 OS_TimeBaseDelete_Impl(uint32 timer_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseGetInfo_Impl(uint32 timer_id, OS_timebase_prop_t *timer_prop) +int32 OS_TimeBaseGetInfo_Impl(osal_index_t timer_id, OS_timebase_prop_t *timer_prop) { return OS_SUCCESS; diff --git a/src/tests/bin-sem-flush-test/bin-sem-flush-test.c b/src/tests/bin-sem-flush-test/bin-sem-flush-test.c index 12c6b1ac8..67bf0a553 100644 --- a/src/tests/bin-sem-flush-test/bin-sem-flush-test.c +++ b/src/tests/bin-sem-flush-test/bin-sem-flush-test.c @@ -222,13 +222,16 @@ void BinSemFlushSetup(void) /* ** Create the tasks */ - status = OS_TaskCreate(&task_1_id, "Task 1", task_1, task_1_stack, TASK_STACK_SIZE, TASK_1_PRIORITY, 0); + status = OS_TaskCreate(&task_1_id, "Task 1", task_1, OSAL_STACKPTR_C(task_1_stack), sizeof(task_1_stack), + OSAL_PRIORITY_C(TASK_1_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 1 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_1_id), (int)status); - status = OS_TaskCreate(&task_2_id, "Task 2", task_2, task_2_stack, TASK_STACK_SIZE, TASK_2_PRIORITY, 0); + status = OS_TaskCreate(&task_2_id, "Task 2", task_2, OSAL_STACKPTR_C(task_2_stack), sizeof(task_2_stack), + OSAL_PRIORITY_C(TASK_2_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 2 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_2_id), (int)status); - status = OS_TaskCreate(&task_3_id, "Task 3", task_3, task_3_stack, TASK_STACK_SIZE, TASK_3_PRIORITY, 0); + status = OS_TaskCreate(&task_3_id, "Task 3", task_3, OSAL_STACKPTR_C(task_3_stack), sizeof(task_3_stack), + OSAL_PRIORITY_C(TASK_3_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 3 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_3_id), (int)status); /* diff --git a/src/tests/bin-sem-test/bin-sem-test.c b/src/tests/bin-sem-test/bin-sem-test.c index 0e645c6ea..4f6b6557c 100644 --- a/src/tests/bin-sem-test/bin-sem-test.c +++ b/src/tests/bin-sem-test/bin-sem-test.c @@ -224,7 +224,8 @@ void BinSemSetup(void) /* ** Create the "consumer" task. */ - status = OS_TaskCreate(&task_1_id, "Task 1", task_1, task_1_stack, TASK_1_STACK_SIZE, TASK_1_PRIORITY, 0); + status = OS_TaskCreate(&task_1_id, "Task 1", task_1, OSAL_STACKPTR_C(task_1_stack), sizeof(task_1_stack), + OSAL_PRIORITY_C(TASK_1_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 1 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_1_id), (int)status); /* diff --git a/src/tests/bin-sem-timeout-test/bin-sem-timeout-test.c b/src/tests/bin-sem-timeout-test/bin-sem-timeout-test.c index b368f12d3..54af1b7ef 100644 --- a/src/tests/bin-sem-timeout-test/bin-sem-timeout-test.c +++ b/src/tests/bin-sem-timeout-test/bin-sem-timeout-test.c @@ -220,7 +220,8 @@ void BinSemTimeoutSetup(void) /* ** Create the "consumer" task. */ - status = OS_TaskCreate(&task_1_id, "Task 1", task_1, task_1_stack, TASK_1_STACK_SIZE, TASK_1_PRIORITY, 0); + status = OS_TaskCreate(&task_1_id, "Task 1", task_1, OSAL_STACKPTR_C(task_1_stack), sizeof(task_1_stack), + OSAL_PRIORITY_C(TASK_1_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 1 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_1_id), (int)status); /* diff --git a/src/tests/count-sem-test/count-sem-test.c b/src/tests/count-sem-test/count-sem-test.c index 6ee4c92fb..61239a590 100644 --- a/src/tests/count-sem-test/count-sem-test.c +++ b/src/tests/count-sem-test/count-sem-test.c @@ -191,13 +191,16 @@ void CountSemSetup(void) /* ** Create the tasks */ - status = OS_TaskCreate(&task_1_id, "Task 1", task_1, task_1_stack, TASK_STACK_SIZE, TASK_1_PRIORITY, 0); + status = OS_TaskCreate(&task_1_id, "Task 1", task_1, OSAL_STACKPTR_C(task_1_stack), sizeof(task_1_stack), + OSAL_PRIORITY_C(TASK_1_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 1 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_1_id), (int)status); - status = OS_TaskCreate(&task_2_id, "Task 2", task_2, task_2_stack, TASK_STACK_SIZE, TASK_2_PRIORITY, 0); + status = OS_TaskCreate(&task_2_id, "Task 2", task_2, OSAL_STACKPTR_C(task_2_stack), sizeof(task_2_stack), + OSAL_PRIORITY_C(TASK_2_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 2 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_2_id), (int)status); - status = OS_TaskCreate(&task_3_id, "Task 3", task_3, task_3_stack, TASK_STACK_SIZE, TASK_3_PRIORITY, 0); + status = OS_TaskCreate(&task_3_id, "Task 3", task_3, OSAL_STACKPTR_C(task_3_stack), sizeof(task_3_stack), + OSAL_PRIORITY_C(TASK_3_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 3 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_3_id), (int)status); /* diff --git a/src/tests/file-api-test/file-api-test.c b/src/tests/file-api-test/file-api-test.c index 8bfda6ea0..3fdb8087f 100644 --- a/src/tests/file-api-test/file-api-test.c +++ b/src/tests/file-api-test/file-api-test.c @@ -89,7 +89,7 @@ void TestMkfsMount(void) int32 status; /* Make the file system */ - status = OS_mkfs(0, "/ramdev0", "RAM", 512, 200); + status = OS_mkfs(0, "/ramdev0", "RAM", OSAL_SIZE_C(512), OSAL_BLOCKCOUNT_C(200)); UtAssert_True(status == OS_SUCCESS, "status after mkfs = %d", (int)status); status = OS_mount("/ramdev0", "/drive0"); @@ -249,8 +249,8 @@ void TestReadWriteLseek(void) char copyofbuffer[30]; char seekbuffer[30]; char newbuffer[30]; - int offset; - int size; + size_t offset; + size_t size; int32 status; osal_id_t fd; @@ -274,7 +274,7 @@ void TestReadWriteLseek(void) /* test write portion of R/W mode */ status = OS_write(fd, (void *)buffer, size); - UtAssert_True(status == size, "status after write = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after write = %d size = %lu", (int)status, (unsigned long)size); strcpy(buffer, ""); @@ -284,7 +284,7 @@ void TestReadWriteLseek(void) /*Read what we wrote to the file */ status = OS_read(fd, (void *)buffer, size); - UtAssert_True(status == size, "status after read = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after read = %d size = %lu", (int)status, (unsigned long)size); if (status >= OS_SUCCESS) { UtAssert_True(strcmp(buffer, copyofbuffer) == 0, "Read: %s, Written: %s", buffer, copyofbuffer); @@ -305,7 +305,7 @@ void TestReadWriteLseek(void) /* try to read in READ ONLY MODE */ status = OS_read(fd, (void *)buffer, size); - UtAssert_True(status == size, "status after read = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after read = %d size = %lu", (int)status, (unsigned long)size); if (status >= OS_SUCCESS) { UtAssert_True(strcmp(buffer, copyofbuffer) == 0, "Read: %s, Written: %s", buffer, copyofbuffer); @@ -317,8 +317,9 @@ void TestReadWriteLseek(void) /* now try to read out only the last chars of the file */ - status = OS_read(fd, (void *)newbuffer, (size - offset)); - UtAssert_True(status == (size - offset), "status after read = %d size = %d", (int)status, (int)(size - offset)); + status = OS_read(fd, (void *)newbuffer, OSAL_SIZE_C(size - offset)); + UtAssert_True(status == (size - offset), "status after read = %d size = %lu", (int)status, + (unsigned long)(size - offset)); if (status >= OS_SUCCESS) { UtAssert_True(strncmp(newbuffer, seekbuffer, size - offset) == 0, "Read: %s, Written: %s", newbuffer, @@ -335,7 +336,7 @@ void TestReadWriteLseek(void) /* test write in WRITE ONLY mode */ status = OS_write(fd, (void *)buffer, size); - UtAssert_True(status == size, "status after write = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after write = %d size = %lu", (int)status, (unsigned long)size); /* try to read in WRITE ONLY MODE */ status = OS_read(fd, (void *)buffer, size); @@ -346,7 +347,7 @@ void TestReadWriteLseek(void) UtAssert_True(status >= OS_SUCCESS, "status after lseek = %d", (int)status); /* now try to read out only the last chars of the file */ - status = OS_read(fd, (void *)newbuffer, (size - offset)); + status = OS_read(fd, (void *)newbuffer, OSAL_SIZE_C(size - offset)); UtAssert_True(status < OS_SUCCESS, "status after read = %d", (int)status); /* close the file */ @@ -374,7 +375,7 @@ void TestMkRmDirFreeBytes(void) char copybuffer2[OS_MAX_PATH_LEN]; osal_id_t fd1; osal_id_t fd2; - int size; + size_t size; /* make the directory names for testing, as well as the filenames and the buffers * to put in the files */ @@ -410,11 +411,11 @@ void TestMkRmDirFreeBytes(void) /* write the propper buffers into each of the files */ size = strlen(buffer1); status = OS_write(fd1, buffer1, size); - UtAssert_True(status == size, "status after write 1 = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after write 1 = %d size = %lu", (int)status, (unsigned long)size); size = strlen(buffer2); status = OS_write(fd2, buffer2, size); - UtAssert_True(status == size, "status after write 2 = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after write 2 = %d size = %lu", (int)status, (unsigned long)size); /* lseek back to the beginning of the file */ status = OS_lseek(fd1, 0, 0); @@ -431,7 +432,7 @@ void TestMkRmDirFreeBytes(void) /* read back out of the files what we wrote into them */ size = strlen(copybuffer1); status = OS_read(fd1, (void *)buffer1, size); - UtAssert_True(status == size, "status after read 1 = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after read 1 = %d size = %lu", (int)status, (unsigned long)size); if (status >= OS_SUCCESS) { UtAssert_True(strncmp(buffer1, copybuffer1, size) == 0, "Read: %s, Written: %s", buffer1, copybuffer1); @@ -439,7 +440,7 @@ void TestMkRmDirFreeBytes(void) size = strlen(copybuffer2); status = OS_read(fd2, (void *)buffer2, size); - UtAssert_True(status == size, "status after read 2 = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after read 2 = %d size = %lu", (int)status, (unsigned long)size); if (status >= OS_SUCCESS) { UtAssert_True(strncmp(buffer2, copybuffer2, size) == 0, "Read: %s, Written: %s", buffer1, copybuffer1); @@ -481,7 +482,7 @@ void TestOpenReadCloseDir(void) char dir2[OS_MAX_PATH_LEN]; char buffer1[OS_MAX_PATH_LEN]; char buffer2[OS_MAX_PATH_LEN]; - int size; + size_t size; osal_id_t fd1; osal_id_t fd2; osal_id_t dirh; @@ -516,11 +517,11 @@ void TestOpenReadCloseDir(void) /* write the proper buffers into each of the files */ size = strlen(buffer1); status = OS_write(fd1, buffer1, size); - UtAssert_True(status == size, "status after write 1 = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after write 1 = %d size = %lu", (int)status, (unsigned long)size); size = strlen(buffer2); status = OS_write(fd2, buffer2, size); - UtAssert_True(status == size, "status after write 2 = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after write 2 = %d size = %lu", (int)status, (unsigned long)size); /* close the files */ @@ -690,7 +691,7 @@ void TestRename(void) char newfilename1[OS_MAX_PATH_LEN]; osal_id_t fd1; - int size; + size_t size; /* make the directory names for testing, as well as the filenames and the buffers * to put in the files */ @@ -719,7 +720,7 @@ void TestRename(void) size = strlen(buffer1); status = OS_write(fd1, buffer1, size); - UtAssert_True(status == size, "status after write 1 = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after write 1 = %d size = %lu", (int)status, (unsigned long)size); /* close the file */ @@ -745,7 +746,7 @@ void TestRename(void) size = strlen(copybuffer1); status = OS_read(fd1, buffer1, size); - UtAssert_True(status == size, "status after read 1 = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after read 1 = %d size = %lu", (int)status, (unsigned long)size); if (status >= OS_SUCCESS) { UtAssert_True(strncmp(buffer1, copybuffer1, size) == 0, "Read and Written Results are equal"); @@ -775,7 +776,7 @@ void TestStat(void) char buffer1[OS_MAX_PATH_LEN]; os_fstat_t StatBuff; osal_id_t fd1; - int size; + size_t size; strcpy(dir1, "/drive0/DirectoryName"); strcpy(dir1slash, dir1); @@ -795,7 +796,7 @@ void TestStat(void) size = strlen(buffer1); status = OS_write(fd1, buffer1, size); - UtAssert_True(status == size, "status after write 1 = %d size = %d", (int)status, (int)size); + UtAssert_True(status == size, "status after write 1 = %d size = %lu", (int)status, (unsigned long)size); status = OS_close(fd1); UtAssert_True(status == OS_SUCCESS, "status after close 1 = %d", (int)status); diff --git a/src/tests/idmap-api-test/idmap-api-test.c b/src/tests/idmap-api-test/idmap-api-test.c index c91aec89c..3a9ab8327 100644 --- a/src/tests/idmap-api-test/idmap-api-test.c +++ b/src/tests/idmap-api-test/idmap-api-test.c @@ -109,9 +109,10 @@ void TestIdMapApi_Setup(void) /* * Create all allowed objects */ - status = OS_TaskCreate(&task_id, "Task", Test_Void_Fn, NULL, 4096, 50, 0); + status = OS_TaskCreate(&task_id, "Task", Test_Void_Fn, OSAL_TASK_STACK_ALLOCATE, OSAL_SIZE_C(4096), + OSAL_PRIORITY_C(50), 0); UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate() (%ld) == OS_SUCCESS", (long)status); - status = OS_QueueCreate(&queue_id, "Queue", 5, 5, 0); + status = OS_QueueCreate(&queue_id, "Queue", OSAL_BLOCKCOUNT_C(5), OSAL_SIZE_C(5), 0); UtAssert_True(status == OS_SUCCESS, "OS_QueueCreate() (%ld) == OS_SUCCESS", (long)status); status = OS_CountSemCreate(&count_sem_id, "CountSem", 1, 0); UtAssert_True(status == OS_SUCCESS, "OS_CountSemCreate() (%ld) == OS_SUCCESS", (long)status); @@ -141,9 +142,9 @@ void TestIdMapApi(void) { int32 expected; int32 actual; - uint32 TestArrayIndex; - uint32 TestMutex1Index; - uint32 TestMutex2Index; + osal_index_t TestArrayIndex; + osal_index_t TestMutex1Index; + osal_index_t TestMutex2Index; osal_id_t badid; Test_OS_ObjTypeCount_t Count; diff --git a/src/tests/mutex-test/mutex-test.c b/src/tests/mutex-test/mutex-test.c index 67baef8e7..dbe69950d 100644 --- a/src/tests/mutex-test/mutex-test.c +++ b/src/tests/mutex-test/mutex-test.c @@ -259,13 +259,16 @@ void MutexSetup(void) /* ** Create the tasks */ - status = OS_TaskCreate(&task_1_id, "Task 1", task_1, task_1_stack, TASK_STACK_SIZE, TASK_1_PRIORITY, 0); + status = OS_TaskCreate(&task_1_id, "Task 1", task_1, OSAL_STACKPTR_C(task_1_stack), sizeof(task_1_stack), + OSAL_PRIORITY_C(TASK_1_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 1 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_1_id), (int)status); - status = OS_TaskCreate(&task_2_id, "Task 2", task_2, task_2_stack, TASK_STACK_SIZE, TASK_2_PRIORITY, 0); + status = OS_TaskCreate(&task_2_id, "Task 2", task_2, OSAL_STACKPTR_C(task_2_stack), sizeof(task_2_stack), + OSAL_PRIORITY_C(TASK_2_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 2 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_2_id), (int)status); - status = OS_TaskCreate(&task_3_id, "Task 3", task_3, task_3_stack, TASK_STACK_SIZE, TASK_3_PRIORITY, 0); + status = OS_TaskCreate(&task_3_id, "Task 3", task_3, OSAL_STACKPTR_C(task_3_stack), sizeof(task_3_stack), + OSAL_PRIORITY_C(TASK_3_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 3 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_3_id), (int)status); /* diff --git a/src/tests/network-api-test/network-api-test.c b/src/tests/network-api-test/network-api-test.c index 5dfee1f34..93a275c62 100644 --- a/src/tests/network-api-test/network-api-test.c +++ b/src/tests/network-api-test/network-api-test.c @@ -266,43 +266,43 @@ void TestDatagramNetworkApi(void) /* OS_SocketSendTo */ expected = OS_INVALID_POINTER; - actual = OS_SocketSendTo(p1_socket_id, NULL, 0, NULL); + actual = OS_SocketSendTo(p1_socket_id, NULL, OSAL_SIZE_C(0), NULL); UtAssert_True(actual == expected, "OS_SocketSendTo(NULL) (%ld) == OS_INVALID_POINTER", (long)actual); expected = OS_INVALID_POINTER; - actual = OS_SocketSendTo(p1_socket_id, NULL, 1, &p2_addr); + actual = OS_SocketSendTo(p1_socket_id, NULL, OSAL_SIZE_C(1), &p2_addr); UtAssert_True(actual == expected, "OS_SocketSendTo() (%ld) == OS_INVALID_POINTER", (long)actual); expected = OS_ERR_INVALID_ID; objid = OS_ObjectIdFromInteger(0xFFFFFFFF); - actual = OS_SocketSendTo(objid, &Buf1, 1, &p2_addr); + actual = OS_SocketSendTo(objid, &Buf1, sizeof(Buf1), &p2_addr); UtAssert_True(actual == expected, "OS_SocketSendTo() (%ld) == OS_ERR_INVALID_ID", (long)actual); /* OS_SocketRecvFrom */ expected = OS_INVALID_POINTER; - actual = OS_SocketRecvFrom(p2_socket_id, NULL, 1, NULL, 100); + actual = OS_SocketRecvFrom(p2_socket_id, NULL, OSAL_SIZE_C(1), NULL, 100); UtAssert_True(actual == expected, "OS_SocketRecvFrom() (%ld) == OS_INVALID_POINTER", (long)actual); expected = OS_INVALID_POINTER; - actual = OS_SocketRecvFrom(p2_socket_id, NULL, 0, NULL, 0); + actual = OS_SocketRecvFrom(p2_socket_id, NULL, OSAL_SIZE_C(0), NULL, 0); UtAssert_True(actual == expected, "OS_SocketRecvFrom(NULL) (%ld) == OS_INVALID_POINTER", (long)actual); expected = OS_ERR_INVALID_ID; objid = OS_ObjectIdFromInteger(0xFFFFFFFF); - actual = OS_SocketRecvFrom(objid, &Buf2, 1, &l_addr, 100); + actual = OS_SocketRecvFrom(objid, &Buf2, sizeof(Buf2), &l_addr, 100); UtAssert_True(actual == expected, "OS_SocketRecvFrom() (%ld) == OS_ERR_INVALID_ID", (long)actual); expected = OS_INVALID_POINTER; - actual = OS_SocketRecvFrom(p2_socket_id, &Buf2, 0, &l_addr, 100); + actual = OS_SocketRecvFrom(p2_socket_id, &Buf2, OSAL_SIZE_C(0), &l_addr, 100); UtAssert_True(actual == expected, "OS_SocketRecvFrom() (%ld) == OS_INVALID_POINTER", (long)actual); expected = OS_INVALID_POINTER; - actual = OS_SocketRecvFrom(p2_socket_id, &Buf2, 0, NULL, 100); + actual = OS_SocketRecvFrom(p2_socket_id, &Buf2, OSAL_SIZE_C(0), NULL, 100); UtAssert_True(actual == expected, "OS_SocketRecvFrom() (%ld) == OS_INVALID_POINTER", (long)actual); /* OS_SocketAddrToString */ expected = OS_INVALID_POINTER; - actual = OS_SocketAddrToString(NULL, 0, NULL); + actual = OS_SocketAddrToString(NULL, OSAL_SIZE_C(0), NULL); UtAssert_True(actual == expected, "OS_SocketAddrToString() (%ld) == OS_INVALID_POINTER", (long)actual); expected = OS_INVALID_POINTER; @@ -310,7 +310,7 @@ void TestDatagramNetworkApi(void) UtAssert_True(actual == expected, "OS_SocketAddrToString() (%ld) == OS_INVALID_POINTER", (long)actual); expected = OS_INVALID_POINTER; - actual = OS_SocketAddrToString(0, 0, &p2_addr); + actual = OS_SocketAddrToString(NULL, OSAL_SIZE_C(0), &p2_addr); UtAssert_True(actual == expected, "OS_SocketAddrToString() (%ld) == OS_INVALID_POINTER", (long)actual); /* OS_SocketAddrGetPort */ @@ -319,7 +319,7 @@ void TestDatagramNetworkApi(void) UtAssert_True(actual == expected, "OS_SocketAddrGetPort() (%ld) == OS_INVALID_POINTER", (long)actual); expected = OS_INVALID_POINTER; - actual = OS_SocketAddrGetPort(0, &l_addr); + actual = OS_SocketAddrGetPort(NULL, &l_addr); UtAssert_True(actual == expected, "OS_SocketAddrGetPort() (%ld) == OS_INVALID_POINTER", (long)actual); expected = OS_INVALID_POINTER; @@ -477,7 +477,8 @@ void TestStreamNetworkApi(void) */ /* Create a server task/thread */ - status = OS_TaskCreate(&s_task_id, "Server", Server_Fn, 0, 16384, 50, 0); + status = OS_TaskCreate(&s_task_id, "Server", Server_Fn, OSAL_TASK_STACK_ALLOCATE, OSAL_SIZE_C(16384), + OSAL_PRIORITY_C(50), 0); UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate() (%ld) == OS_SUCCESS", (long)status); /* Connect to a server */ diff --git a/src/tests/osal-core-test/osal-core-test.c b/src/tests/osal-core-test/osal-core-test.c index d5c04748e..b2771cd6c 100644 --- a/src/tests/osal-core-test/osal-core-test.c +++ b/src/tests/osal-core-test/osal-core-test.c @@ -123,8 +123,9 @@ void TestTasks(void) for (tasknum = 0; tasknum < (OS_MAX_TASKS + 1); ++tasknum) { snprintf(taskname, sizeof(taskname), "Task %d", tasknum); - status = OS_TaskCreate(&TaskData[tasknum].task_id, taskname, task_generic_no_exit, TaskData[tasknum].task_stack, - TASK_0_STACK_SIZE, (250 - OS_MAX_TASKS) + tasknum, 0); + status = OS_TaskCreate(&TaskData[tasknum].task_id, taskname, task_generic_no_exit, + OSAL_STACKPTR_C(TaskData[tasknum].task_stack), sizeof(TaskData[tasknum].task_stack), + OSAL_PRIORITY_C(250 - OS_MAX_TASKS + tasknum), 0); UtDebug("Create %s Status = %d, Id = %lx\n", taskname, (int)status, OS_ObjectIdToInteger(TaskData[tasknum].task_id)); @@ -161,7 +162,8 @@ void TestTasks(void) { snprintf(taskname, sizeof(taskname), "Task %d", tasknum); status = OS_TaskCreate(&TaskData[tasknum].task_id, taskname, task_generic_with_exit, - TaskData[tasknum].task_stack, TASK_0_STACK_SIZE, (250 - OS_MAX_TASKS) + tasknum, 0); + OSAL_STACKPTR_C(TaskData[tasknum].task_stack), sizeof(TaskData[tasknum].task_stack), + OSAL_PRIORITY_C((250 - OS_MAX_TASKS) + tasknum), 0); UtDebug("Create %s Status = %d, Id = %lx\n", taskname, (int)status, OS_ObjectIdToInteger(TaskData[tasknum].task_id)); @@ -193,19 +195,23 @@ void TestTasks(void) InitializeTaskIds(); /* Create Task 0 again */ - status = OS_TaskCreate(&task_0_id, "Task 0", task_0, task_0_stack, TASK_0_STACK_SIZE, TASK_0_PRIORITY, 0); + status = OS_TaskCreate(&task_0_id, "Task 0", task_0, OSAL_STACKPTR_C(task_0_stack), sizeof(task_0_stack), + OSAL_PRIORITY_C(TASK_0_PRIORITY), 0); /*UtDebug("Create Status = %d, Id = %d\n",status,task_0_id); */ UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate, recreate 0"); /* Try and create another "Task 0", should fail as we already have one named "Task 0" */ - status = OS_TaskCreate(&task_1_id, "Task 0", task_0, task_0_stack, TASK_0_STACK_SIZE, TASK_0_PRIORITY, 0); + status = OS_TaskCreate(&task_1_id, "Task 0", task_0, OSAL_STACKPTR_C(task_0_stack), sizeof(task_0_stack), + OSAL_PRIORITY_C(TASK_0_PRIORITY), 0); UtAssert_True(status != OS_SUCCESS, "OS_TaskCreate, dupe name 0"); - status = OS_TaskCreate(&task_2_id, "Task 2", task_2, task_2_stack, TASK_2_STACK_SIZE, TASK_2_PRIORITY, 0); + status = OS_TaskCreate(&task_2_id, "Task 2", task_2, OSAL_STACKPTR_C(task_2_stack), sizeof(task_2_stack), + OSAL_PRIORITY_C(TASK_2_PRIORITY), 0); /* UtDebug("Create Status = %d, Id = %d\n",status,task_2_id); */ UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate, recreate 2"); - status = OS_TaskCreate(&task_3_id, "Task 3", task_3, task_3_stack, TASK_3_STACK_SIZE, TASK_3_PRIORITY, 0); + status = OS_TaskCreate(&task_3_id, "Task 3", task_3, OSAL_STACKPTR_C(task_3_stack), sizeof(task_3_stack), + OSAL_PRIORITY_C(TASK_3_PRIORITY), 0); /* UtDebug("Create Status = %d, Id = %d\n",status,task_3_id); */ UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate, recreate 3"); @@ -255,7 +261,7 @@ void TestQueues(void) for (qnum = 0; qnum < (OS_MAX_QUEUES + 1); ++qnum) { snprintf(qname, sizeof(qname), "q %d", qnum); - status = OS_QueueCreate(&msgq_ids[qnum], qname, MSGQ_DEPTH, MSGQ_SIZE, 0); + status = OS_QueueCreate(&msgq_ids[qnum], qname, OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); UtAssert_True((qnum < OS_MAX_QUEUES && status == OS_SUCCESS) || (qnum >= OS_MAX_QUEUES && status != OS_SUCCESS), "OS_QueueCreate, nominal"); @@ -275,20 +281,20 @@ void TestQueues(void) /* Create Some more Queues for trying to get the id by name */ InitializeQIds(); - status = OS_QueueCreate(&msgq_0, "q 0", MSGQ_DEPTH, MSGQ_SIZE, 0); + status = OS_QueueCreate(&msgq_0, "q 0", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); /* UtDebug("Status after Creating q 0: %d,%d\n",status,msgq_0);*/ UtAssert_True(status == OS_SUCCESS, "OS_QueueCreate, recreate 0"); /* This one should fail */ - status = OS_QueueCreate(&msgq_1, "q 0", MSGQ_DEPTH, MSGQ_SIZE, 0); + status = OS_QueueCreate(&msgq_1, "q 0", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); /* UtDebug("Status after Creating q 0 again: %d,%d\n",status,msgq_1); */ UtAssert_True(status != OS_SUCCESS, "OS_QueueCreate, dupe name 0"); - status = OS_QueueCreate(&msgq_2, "q 2", MSGQ_DEPTH, MSGQ_SIZE, 0); + status = OS_QueueCreate(&msgq_2, "q 2", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); /* UtDebug("Status after Creating q 2: %d,%d\n",status,msgq_2); */ UtAssert_True(status == OS_SUCCESS, "OS_QueueCreate, recreate 2"); - status = OS_QueueCreate(&msgq_3, "q 3", MSGQ_DEPTH, MSGQ_SIZE, 0); + status = OS_QueueCreate(&msgq_3, "q 3", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); /* UtDebug("Status after Creating q 3: %d,%d\n",status,msgq_3); */ UtAssert_True(status == OS_SUCCESS, "OS_QueueCreate, recreate 3"); @@ -613,10 +619,11 @@ void TestGetInfos(void) /* first step is to create an object to to get the properties of */ - status = OS_TaskCreate(&task_0_id, "Task 0", task_0, task_0_stack, TASK_0_STACK_SIZE, TASK_0_PRIORITY, 0); + status = OS_TaskCreate(&task_0_id, "Task 0", task_0, OSAL_STACKPTR_C(task_0_stack), sizeof(task_0_stack), + OSAL_PRIORITY_C(TASK_0_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate"); - status = OS_QueueCreate(&msgq_0, "q 0", MSGQ_DEPTH, MSGQ_SIZE, 0); + status = OS_QueueCreate(&msgq_0, "q 0", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); /* UtDebug("Status after Creating q 0: %d,%d\n",status,msgq_0); */ UtAssert_True(status == OS_SUCCESS, "OS_QueueCreate"); @@ -668,10 +675,11 @@ void TestGenericQueries(void) TestCallbackState_t State; char ResourceName[OS_MAX_API_NAME]; - status = OS_TaskCreate(&task_0_id, "Task 0", task_0, task_0_stack, TASK_0_STACK_SIZE, TASK_0_PRIORITY, 0); + status = OS_TaskCreate(&task_0_id, "Task 0", task_0, OSAL_STACKPTR_C(task_0_stack), sizeof(task_0_stack), + OSAL_PRIORITY_C(TASK_0_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "OS_TaskCreate (%ld) == OS_SUCCESS", (long)status); - status = OS_QueueCreate(&msgq_0, "q 0", MSGQ_DEPTH, MSGQ_SIZE, 0); + status = OS_QueueCreate(&msgq_0, "q 0", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); UtAssert_True(status == OS_SUCCESS, "OS_QueueCreate (%ld) == OS_SUCCESS", (long)status); status = OS_BinSemCreate(&bin_0, "Bin 0", 1, 0); @@ -711,7 +719,7 @@ void TestGenericQueries(void) UtAssert_True(State.NumInvocations >= 4, "State.NumInvocations (%lu) >= 4", (unsigned long)State.NumInvocations); /* Test the OS_GetResourceName() API function */ - status = OS_GetResourceName(mut_0, ResourceName, 0); + status = OS_GetResourceName(mut_0, ResourceName, OSAL_SIZE_C(0)); UtAssert_True(status == OS_INVALID_POINTER, "OS_GetResourceName (%lx,%ld) == OS_INVALID_POINTER", OS_ObjectIdToInteger(mut_0), (long)status); @@ -724,7 +732,7 @@ void TestGenericQueries(void) UtAssert_True(status == OS_ERR_INVALID_ID, "OS_GetResourceName (%lx,%ld) == OS_ERR_INVALID_ID", OS_ObjectIdToInteger(OS_OBJECT_ID_UNDEFINED), (long)status); - status = OS_GetResourceName(bin_0, ResourceName, 1); + status = OS_GetResourceName(bin_0, ResourceName, OSAL_SIZE_C(1)); UtAssert_True(status == OS_ERR_NAME_TOO_LONG, "OS_GetResourceName (%lx,%ld) == OS_ERR_NAME_TOO_LONG", OS_ObjectIdToInteger(bin_0), (long)status); diff --git a/src/tests/queue-timeout-test/queue-timeout-test.c b/src/tests/queue-timeout-test/queue-timeout-test.c index 0e05b6d5e..e8271b51c 100644 --- a/src/tests/queue-timeout-test/queue-timeout-test.c +++ b/src/tests/queue-timeout-test/queue-timeout-test.c @@ -65,7 +65,7 @@ void task_1(void) { int32 status; uint32 data_received; - uint32 data_size; + size_t data_size; OS_printf("Starting task 1\n"); @@ -78,7 +78,7 @@ void task_1(void) while (task_1_failures < 20) { - status = OS_QueueGet(msgq_id, (void *)&data_received, MSGQ_SIZE, &data_size, 1000); + status = OS_QueueGet(msgq_id, (void *)&data_received, OSAL_SIZE_C(MSGQ_SIZE), &data_size, 1000); if (status == OS_SUCCESS) { @@ -149,13 +149,14 @@ void QueueTimeoutSetup(void) task_1_messages = 0; task_1_timeouts = 0; - status = OS_QueueCreate(&msgq_id, "MsgQ", MSGQ_DEPTH, MSGQ_SIZE, 0); + status = OS_QueueCreate(&msgq_id, "MsgQ", OSAL_BLOCKCOUNT_C(MSGQ_DEPTH), OSAL_SIZE_C(MSGQ_SIZE), 0); UtAssert_True(status == OS_SUCCESS, "MsgQ create Id=%lx Rc=%d", OS_ObjectIdToInteger(msgq_id), (int)status); /* ** Create the "consumer" task. */ - status = OS_TaskCreate(&task_1_id, "Task 1", task_1, task_1_stack, TASK_1_STACK_SIZE, TASK_1_PRIORITY, 0); + status = OS_TaskCreate(&task_1_id, "Task 1", task_1, OSAL_STACKPTR_C(task_1_stack), sizeof(task_1_stack), + OSAL_PRIORITY_C(TASK_1_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 1 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_1_id), (int)status); /* diff --git a/src/tests/sem-speed-test/sem-speed-test.c b/src/tests/sem-speed-test/sem-speed-test.c index 6a9b59ca3..797ed8af7 100644 --- a/src/tests/sem-speed-test/sem-speed-test.c +++ b/src/tests/sem-speed-test/sem-speed-test.c @@ -176,10 +176,12 @@ void SemSetup(void) /* ** Create the tasks */ - status = OS_TaskCreate(&task_1_id, "Task 1", task_1, NULL, 4096, SEMTEST_TASK_PRIORITY, 0); + status = OS_TaskCreate(&task_1_id, "Task 1", task_1, OSAL_TASK_STACK_ALLOCATE, OSAL_SIZE_C(4096), + OSAL_PRIORITY_C(SEMTEST_TASK_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 1 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_1_id), (int)status); - status = OS_TaskCreate(&task_2_id, "Task 2", task_2, NULL, 4096, SEMTEST_TASK_PRIORITY, 0); + status = OS_TaskCreate(&task_2_id, "Task 2", task_2, OSAL_TASK_STACK_ALLOCATE, OSAL_SIZE_C(4096), + OSAL_PRIORITY_C(SEMTEST_TASK_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Task 2 create Id=%lx Rc=%d", OS_ObjectIdToInteger(task_2_id), (int)status); /* A small delay just to allow the tasks diff --git a/src/tests/time-base-api-test/time-base-api-test.c b/src/tests/time-base-api-test/time-base-api-test.c index 95ff39e73..4a589a845 100644 --- a/src/tests/time-base-api-test/time-base-api-test.c +++ b/src/tests/time-base-api-test/time-base-api-test.c @@ -35,7 +35,7 @@ #include "uttest.h" #include "utbsp.h" -static uint32 UT_TimerSync(uint32 timer_id) +static uint32 UT_TimerSync(osal_index_t timer_id) { OS_TaskDelay(1); return 1; diff --git a/src/tests/timer-test/timer-test.c b/src/tests/timer-test/timer-test.c index 83a58d923..9d2e82fc3 100644 --- a/src/tests/timer-test/timer-test.c +++ b/src/tests/timer-test/timer-test.c @@ -59,9 +59,9 @@ uint32 timer_idlookup[OS_MAX_TIMERS]; */ void test_func(osal_id_t timer_id) { - uint32 indx; - OS_ConvertToArrayIndex(timer_id, &indx); - timer_counter[timer_idlookup[indx]]++; + osal_index_t idx; + OS_ConvertToArrayIndex(timer_id, &idx); + timer_counter[timer_idlookup[idx]]++; } /* ********************** MAIN **************************** */ @@ -89,8 +89,8 @@ void TimerTestSetup(void) * In the new versions of OSAL, timers do NOT work in the "main" thread, * so we must create a task to handle them. */ - status = OS_TaskCreate(&TimerTestTaskId, "Task 1", TimerTestTask, TimerTestTaskStack, TASK_1_STACK_SIZE, - TASK_1_PRIORITY, 0); + status = OS_TaskCreate(&TimerTestTaskId, "Task 1", TimerTestTask, OSAL_STACKPTR_C(TimerTestTaskStack), + sizeof(TimerTestTaskStack), OSAL_PRIORITY_C(TASK_1_PRIORITY), 0); UtAssert_True(status == OS_SUCCESS, "Timer Test Task Created RC=%d", (int)status); /* @@ -111,12 +111,12 @@ void TimerTestSetup(void) void TimerTestTask(void) { - int i = 0; - int32 TimerStatus[NUMBER_OF_TIMERS]; - uint32 TableId; - osal_id_t TimerID[NUMBER_OF_TIMERS]; - char TimerName[NUMBER_OF_TIMERS][20] = {"TIMER1", "TIMER2", "TIMER3", "TIMER4"}; - uint32 ClockAccuracy; + int i = 0; + int32 TimerStatus[NUMBER_OF_TIMERS]; + osal_index_t TableId; + osal_id_t TimerID[NUMBER_OF_TIMERS]; + char TimerName[NUMBER_OF_TIMERS][20] = {"TIMER1", "TIMER2", "TIMER3", "TIMER4"}; + uint32 ClockAccuracy; for (i = 0; i < NUMBER_OF_TIMERS && i < OS_MAX_TIMERS; i++) { diff --git a/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-io.h b/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-io.h index 98f4377b5..1ec92754d 100644 --- a/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-io.h +++ b/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-io.h @@ -48,7 +48,7 @@ * but are not exposed directly through the implementation API. * *****************************************************/ -void UT_PortablePosixIOTest_Set_Selectable(uint32 local_id, bool is_selectable); +void UT_PortablePosixIOTest_Set_Selectable(osal_index_t local_id, bool is_selectable); #endif /* _UT_OSFILEAPI_H_ */ diff --git a/src/unit-test-coverage/portable/adaptors/src/ut-adaptor-portable-posix-io.c b/src/unit-test-coverage/portable/adaptors/src/ut-adaptor-portable-posix-io.c index 0f54a9677..dea9b84d5 100644 --- a/src/unit-test-coverage/portable/adaptors/src/ut-adaptor-portable-posix-io.c +++ b/src/unit-test-coverage/portable/adaptors/src/ut-adaptor-portable-posix-io.c @@ -31,7 +31,7 @@ #include -void UT_PortablePosixIOTest_Set_Selectable(uint32 local_id, bool is_selectable) +void UT_PortablePosixIOTest_Set_Selectable(osal_index_t local_id, bool is_selectable) { OS_impl_filehandle_table[local_id].selectable = is_selectable; } diff --git a/src/unit-test-coverage/portable/src/coveragetest-bsd-select.c b/src/unit-test-coverage/portable/src/coveragetest-bsd-select.c index 5c0c90acc..39e8fb3e6 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-bsd-select.c +++ b/src/unit-test-coverage/portable/src/coveragetest-bsd-select.c @@ -35,15 +35,15 @@ void Test_OS_SelectSingle_Impl(void) * int32 OS_SelectSingle_Impl(uint32 stream_id, uint32 *SelectFlags, int32 msecs) */ uint32 SelectFlags; - uint32 StreamID; + osal_index_t StreamID; struct OCS_timespec nowtime; struct OCS_timespec latertime; - StreamID = 0; - UT_PortablePosixIOTest_Set_Selectable(0, false); + StreamID = UT_INDEX_0; + UT_PortablePosixIOTest_Set_Selectable(UT_INDEX_0, false); SelectFlags = OS_STREAM_STATE_READABLE | OS_STREAM_STATE_WRITABLE; OSAPI_TEST_FUNCTION_RC(OS_SelectSingle_Impl, (StreamID, &SelectFlags, 0), OS_ERR_OPERATION_NOT_SUPPORTED); - UT_PortablePosixIOTest_Set_Selectable(0, true); + UT_PortablePosixIOTest_Set_Selectable(UT_INDEX_0, true); OSAPI_TEST_FUNCTION_RC(OS_SelectSingle_Impl, (StreamID, &SelectFlags, 0), OS_SUCCESS); SelectFlags = OS_STREAM_STATE_READABLE | OS_STREAM_STATE_WRITABLE; OSAPI_TEST_FUNCTION_RC(OS_SelectSingle_Impl, (StreamID, &SelectFlags, -1), OS_SUCCESS); diff --git a/src/unit-test-coverage/portable/src/coveragetest-no-loader.c b/src/unit-test-coverage/portable/src/coveragetest-no-loader.c index c3df0c998..7d64ed5c1 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-no-loader.c +++ b/src/unit-test-coverage/portable/src/coveragetest-no-loader.c @@ -32,7 +32,7 @@ void Test_OS_ModuleLoad_Impl(void) /* Test Case For: * int32 OS_ModuleLoad_Impl ( uint32 module_id, char *translated_path ) */ - OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl, (0, "local"), OS_ERR_NOT_IMPLEMENTED); + OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl, (UT_INDEX_0, "local"), OS_ERR_NOT_IMPLEMENTED); } void Test_OS_ModuleUnload_Impl(void) @@ -40,7 +40,7 @@ void Test_OS_ModuleUnload_Impl(void) /* Test Case For: * int32 OS_ModuleUnload_Impl ( uint32 module_id ) */ - OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl, (0), OS_ERR_NOT_IMPLEMENTED); + OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl, (UT_INDEX_0), OS_ERR_NOT_IMPLEMENTED); } void Test_OS_ModuleGetInfo_Impl(void) @@ -51,7 +51,7 @@ void Test_OS_ModuleGetInfo_Impl(void) OS_module_prop_t module_prop; memset(&module_prop, 0, sizeof(module_prop)); - OSAPI_TEST_FUNCTION_RC(OS_ModuleGetInfo_Impl, (0, &module_prop), OS_ERR_NOT_IMPLEMENTED); + OSAPI_TEST_FUNCTION_RC(OS_ModuleGetInfo_Impl, (UT_INDEX_0, &module_prop), OS_ERR_NOT_IMPLEMENTED); } /* ------------------- End of test cases --------------------------------------*/ diff --git a/src/unit-test-coverage/portable/src/coveragetest-no-shell.c b/src/unit-test-coverage/portable/src/coveragetest-no-shell.c index 1973e407d..776612532 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-no-shell.c +++ b/src/unit-test-coverage/portable/src/coveragetest-no-shell.c @@ -33,7 +33,7 @@ void Test_OS_ShellOutputToFile_Impl(void) /* Test Case For: * int32 OS_ShellOutputToFile_Impl(uint32 stream_id, const char* Cmd) */ - OSAPI_TEST_FUNCTION_RC(OS_ShellOutputToFile_Impl, (0, "ut"), OS_ERR_NOT_IMPLEMENTED); + OSAPI_TEST_FUNCTION_RC(OS_ShellOutputToFile_Impl, (UT_INDEX_0, "ut"), OS_ERR_NOT_IMPLEMENTED); } /* ------------------- End of test cases --------------------------------------*/ diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-files.c b/src/unit-test-coverage/portable/src/coveragetest-posix-files.c index 7f1080e27..d151748e5 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-files.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-files.c @@ -41,14 +41,14 @@ void Test_OS_FileOpen_Impl(void) * Test Case For: * int32 OS_FileOpen_Impl(uint32 local_id, const char *local_path, int32 flags, int32 access) */ - OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (0, "local", OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY), OS_SUCCESS); - OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (0, "local", 0, OS_READ_ONLY), OS_SUCCESS); - OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (0, "local", OS_FILE_FLAG_CREATE, OS_READ_WRITE), OS_SUCCESS); - OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (0, "local", 0, -1234), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (UT_INDEX_0, "local", OS_FILE_FLAG_TRUNCATE, OS_WRITE_ONLY), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (UT_INDEX_0, "local", 0, OS_READ_ONLY), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (UT_INDEX_0, "local", OS_FILE_FLAG_CREATE, OS_READ_WRITE), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (UT_INDEX_0, "local", 0, -1234), OS_ERROR); /* failure mode */ UT_SetForceFail(UT_KEY(OCS_open), -1); - OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (0, "local", 0, OS_READ_ONLY), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (UT_INDEX_0, "local", 0, OS_READ_ONLY), OS_ERROR); } void Test_OS_FileStat_Impl(void) diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-io.c b/src/unit-test-coverage/portable/src/coveragetest-posix-io.c index 26fdf3059..a6d62de90 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-io.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-io.c @@ -43,14 +43,14 @@ void Test_OS_GenericClose_Impl(void) * Test Case For: * int32 OS_GenericClose_Impl(uint32 local_id) */ - OSAPI_TEST_FUNCTION_RC(OS_GenericClose_Impl, (0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_GenericClose_Impl, (UT_INDEX_0), OS_SUCCESS); /* * Test path where underlying close() fails. * Should still return success. */ UT_SetForceFail(UT_KEY(OCS_close), -1); - OSAPI_TEST_FUNCTION_RC(OS_GenericClose_Impl, (0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_GenericClose_Impl, (UT_INDEX_0), OS_SUCCESS); } void Test_OS_GenericSeek_Impl(void) @@ -62,22 +62,22 @@ void Test_OS_GenericSeek_Impl(void) /* note on success this wrapper returns the result of lseek(), not OS_SUCCESS */ UT_SetForceFail(UT_KEY(OCS_lseek), 111); - OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_CUR), 111); + OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, OS_SEEK_CUR), 111); UT_SetForceFail(UT_KEY(OCS_lseek), 222); - OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_SET), 222); + OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, OS_SEEK_SET), 222); UT_SetForceFail(UT_KEY(OCS_lseek), 333); - OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_END), 333); + OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, OS_SEEK_END), 333); /* bad whence */ - OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, -1234), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, -1234), OS_ERROR); /* generic failure of lseek() */ UT_SetForceFail(UT_KEY(OCS_lseek), -1); - OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_END), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, OS_SEEK_END), OS_ERROR); /* The seek implementation also checks for this specific pipe errno */ OCS_errno = OCS_ESPIPE; - OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_END), OS_ERR_NOT_IMPLEMENTED); + OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, OS_SEEK_END), OS_ERR_NOT_IMPLEMENTED); } void Test_OS_GenericRead_Impl(void) @@ -90,20 +90,20 @@ void Test_OS_GenericRead_Impl(void) char DestData[sizeof(SrcData)] = {0}; UT_SetDataBuffer(UT_KEY(OCS_read), SrcData, sizeof(SrcData), false); - UT_PortablePosixIOTest_Set_Selectable(0, false); - OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (0, DestData, sizeof(DestData), 0), sizeof(DestData)); + UT_PortablePosixIOTest_Set_Selectable(UT_INDEX_0, false); + OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (UT_INDEX_0, DestData, sizeof(DestData), 0), sizeof(DestData)); UtAssert_MemCmp(SrcData, DestData, sizeof(SrcData), "read() data Valid"); /* test invocation of select() in nonblocking mode */ UT_ResetState(UT_KEY(OCS_read)); UT_SetDataBuffer(UT_KEY(OCS_read), SrcData, sizeof(SrcData), false); - UT_PortablePosixIOTest_Set_Selectable(0, true); - OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (0, DestData, sizeof(DestData), 0), sizeof(DestData)); + UT_PortablePosixIOTest_Set_Selectable(UT_INDEX_0, true); + OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (UT_INDEX_0, DestData, sizeof(DestData), 0), sizeof(DestData)); UtAssert_True(UT_GetStubCount(UT_KEY(OS_SelectSingle_Impl)) == 1, "OS_SelectSingle() called"); /* read() failure */ UT_SetForceFail(UT_KEY(OCS_read), -1); - OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (0, DestData, sizeof(DestData), 0), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (UT_INDEX_0, DestData, sizeof(DestData), 0), OS_ERROR); } void Test_OS_GenericWrite_Impl(void) @@ -116,20 +116,20 @@ void Test_OS_GenericWrite_Impl(void) char DestData[sizeof(SrcData)] = {0}; UT_SetDataBuffer(UT_KEY(OCS_write), DestData, sizeof(DestData), false); - UT_PortablePosixIOTest_Set_Selectable(0, false); - OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (0, SrcData, sizeof(SrcData), 0), sizeof(SrcData)); + UT_PortablePosixIOTest_Set_Selectable(UT_INDEX_0, false); + OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (UT_INDEX_0, SrcData, sizeof(SrcData), 0), sizeof(SrcData)); UtAssert_MemCmp(SrcData, DestData, sizeof(SrcData), "write() data valid"); /* test invocation of select() in nonblocking mode */ UT_ResetState(UT_KEY(OCS_write)); UT_SetDataBuffer(UT_KEY(OCS_write), DestData, sizeof(DestData), false); - UT_PortablePosixIOTest_Set_Selectable(0, true); - OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (0, SrcData, sizeof(SrcData), 0), sizeof(SrcData)); + UT_PortablePosixIOTest_Set_Selectable(UT_INDEX_0, true); + OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (UT_INDEX_0, SrcData, sizeof(SrcData), 0), sizeof(SrcData)); UtAssert_True(UT_GetStubCount(UT_KEY(OS_SelectSingle_Impl)) == 1, "OS_SelectSingle() called"); /* write() failure */ UT_SetForceFail(UT_KEY(OCS_write), -1); - OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (0, DestData, sizeof(DestData), 0), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (UT_INDEX_0, DestData, sizeof(DestData), 0), OS_ERROR); } /* ------------------- End of test cases --------------------------------------*/ diff --git a/src/unit-test-coverage/portable/src/os-portable-coveragetest.h b/src/unit-test-coverage/portable/src/os-portable-coveragetest.h index 287d4c005..127fc14dd 100644 --- a/src/unit-test-coverage/portable/src/os-portable-coveragetest.h +++ b/src/unit-test-coverage/portable/src/os-portable-coveragetest.h @@ -57,6 +57,17 @@ #define ADD_TEST(test) UtTest_Add((Test_##test), Osapi_Test_Setup, Osapi_Test_Teardown, #test) +/* + * The default/primary table index used by most coverage tests. + */ +#define UT_INDEX_0 OSAL_INDEX_C(0) + +/* + * A secondary table index for coverage tests which require + * more than one entry + */ +#define UT_INDEX_1 OSAL_INDEX_C(1) + /* Osapi_Test_Setup * * Purpose: diff --git a/src/unit-test-coverage/shared/src/coveragetest-binsem.c b/src/unit-test-coverage/shared/src/coveragetest-binsem.c index 07c605722..28c7c82ea 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-binsem.c +++ b/src/unit-test-coverage/shared/src/coveragetest-binsem.c @@ -168,7 +168,7 @@ void Test_OS_BinSemGetInfo(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; OS_bin_sem_prop_t prop; - uint32 local_index = 1; + osal_index_t local_index = UT_INDEX_1; OS_common_record_t utrec; OS_common_record_t *rptr = &utrec; diff --git a/src/unit-test-coverage/shared/src/coveragetest-countsem.c b/src/unit-test-coverage/shared/src/coveragetest-countsem.c index 5afc26277..4e59c4062 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-countsem.c +++ b/src/unit-test-coverage/shared/src/coveragetest-countsem.c @@ -156,7 +156,7 @@ void Test_OS_CountSemGetInfo(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; OS_count_sem_prop_t prop; - uint32 local_index = 1; + osal_index_t local_index = UT_INDEX_1; OS_common_record_t utrec; OS_common_record_t *rptr = &utrec; diff --git a/src/unit-test-coverage/shared/src/coveragetest-file.c b/src/unit-test-coverage/shared/src/coveragetest-file.c index 74893e81a..72b06b924 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-file.c +++ b/src/unit-test-coverage/shared/src/coveragetest-file.c @@ -313,7 +313,7 @@ void Test_OS_FDGetInfo(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; OS_file_prop_t file_prop; - uint32 local_index = 1; + osal_index_t local_index = UT_INDEX_1; OS_common_record_t utrec; OS_common_record_t *rptr = &utrec; diff --git a/src/unit-test-coverage/shared/src/coveragetest-filesys.c b/src/unit-test-coverage/shared/src/coveragetest-filesys.c index 528d33886..2f9234c89 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-filesys.c +++ b/src/unit-test-coverage/shared/src/coveragetest-filesys.c @@ -86,40 +86,40 @@ void Test_OS_mkfs(void) char TestBuffer[128]; - actual = OS_mkfs(TestBuffer, "/ramdev0", "vol", 0, 0); + actual = OS_mkfs(TestBuffer, "/ramdev0", "vol", OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_SUCCESS", (long)actual); /* * Test an entry NOT found in the OS_VolumeTable */ - actual = OS_mkfs(TestBuffer, "/rd1", "vol1", 0, 0); + actual = OS_mkfs(TestBuffer, "/rd1", "vol1", OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_SUCCESS", (long)actual); expected = OS_INVALID_POINTER; - actual = OS_mkfs(NULL, NULL, NULL, 0, 0); + actual = OS_mkfs(NULL, NULL, NULL, OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_INVALID_POINTER", (long)actual); UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_FS_DEV_NAME_LEN); expected = OS_FS_ERR_PATH_TOO_LONG; - actual = OS_mkfs(TestBuffer, "/ramdev0", "vol", 0, 0); + actual = OS_mkfs(TestBuffer, "/ramdev0", "vol", OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); UT_ClearForceFail(UT_KEY(OCS_strlen)); /* set up for failure due to empty strings */ expected = OS_FS_ERR_PATH_INVALID; - actual = OS_mkfs(TestBuffer, "", "", 0, 0); + actual = OS_mkfs(TestBuffer, "", "", OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_PATH_INVALID", (long)actual); /* set up for failure due to formatting */ UT_SetForceFail(UT_KEY(OS_FileSysFormatVolume_Impl), OS_FS_ERR_DRIVE_NOT_CREATED); expected = OS_FS_ERR_DRIVE_NOT_CREATED; - actual = OS_mkfs(TestBuffer, "/ramdev0", "vol", 0, 0); + actual = OS_mkfs(TestBuffer, "/ramdev0", "vol", OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_DRIVE_NOT_CREATED (format failure)", (long)actual); /* set up for failure due to no free slots */ UT_SetForceFail(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS); expected = OS_FS_ERR_DEVICE_NOT_FREE; - actual = OS_mkfs(TestBuffer, "/ramdev0", "vol", 0, 0); + actual = OS_mkfs(TestBuffer, "/ramdev0", "vol", OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_mkfs() (%ld) == OS_FS_ERR_DEVICE_NOT_FREE", (long)actual); } @@ -164,26 +164,26 @@ void Test_OS_initfs(void) char TestBuffer[128]; - actual = OS_initfs(TestBuffer, "/ramdev0", "vol", 0, 0); + actual = OS_initfs(TestBuffer, "/ramdev0", "vol", OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_initfs() (%ld) == OS_SUCCESS", (long)actual); - actual = OS_initfs(NULL, "/hda2", "vol2", 0, 0); + actual = OS_initfs(NULL, "/hda2", "vol2", OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_initfs() (%ld) == OS_SUCCESS", (long)actual); expected = OS_INVALID_POINTER; - actual = OS_initfs(NULL, NULL, NULL, 0, 0); + actual = OS_initfs(NULL, NULL, NULL, OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_initfs() (%ld) == OS_INVALID_POINTER", (long)actual); UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_FS_DEV_NAME_LEN); expected = OS_FS_ERR_PATH_TOO_LONG; - actual = OS_initfs(TestBuffer, "/ramdev0", "vol", 0, 0); + actual = OS_initfs(TestBuffer, "/ramdev0", "vol", OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_initfs() (%ld) == OS_FS_ERR_PATH_TOO_LONG", (long)actual); UT_ClearForceFail(UT_KEY(OCS_strlen)); /* set up for failure */ UT_SetForceFail(UT_KEY(OS_ObjectIdAllocateNew), OS_ERR_NO_FREE_IDS); expected = OS_FS_ERR_DEVICE_NOT_FREE; - actual = OS_initfs(TestBuffer, "/ramdev0", "vol", 0, 0); + actual = OS_initfs(TestBuffer, "/ramdev0", "vol", OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)); UtAssert_True(actual == expected, "OS_initfs() (%ld) == OS_FS_ERR_DEVICE_NOT_FREE", (long)actual); } @@ -263,9 +263,9 @@ void Test_OS_fsBlocksFree(void) int32 actual = ~OS_SUCCESS; OS_statvfs_t statval; - statval.block_size = 1024; - statval.blocks_free = 1111; - statval.total_blocks = 2222; + statval.block_size = OSAL_SIZE_C(1024); + statval.blocks_free = OSAL_BLOCKCOUNT_C(1111); + statval.total_blocks = OSAL_BLOCKCOUNT_C(2222); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume_Impl), &statval, sizeof(statval), false); OS_filesys_table[1].flags = OS_FILESYS_FLAG_IS_READY | OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; @@ -300,9 +300,9 @@ void Test_OS_fsBytesFree(void) OS_statvfs_t statval; uint64 bytes_free = 0; - statval.block_size = 1024; - statval.blocks_free = 1111; - statval.total_blocks = 2222; + statval.block_size = OSAL_SIZE_C(1024); + statval.blocks_free = OSAL_BLOCKCOUNT_C(1111); + statval.total_blocks = OSAL_BLOCKCOUNT_C(2222); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume_Impl), &statval, sizeof(statval), false); OS_filesys_table[1].flags = OS_FILESYS_FLAG_IS_READY | OS_FILESYS_FLAG_IS_MOUNTED_SYSTEM | OS_FILESYS_FLAG_IS_MOUNTED_VIRTUAL; diff --git a/src/unit-test-coverage/shared/src/coveragetest-idmap.c b/src/unit-test-coverage/shared/src/coveragetest-idmap.c index 07fc471de..5e3498693 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-idmap.c +++ b/src/unit-test-coverage/shared/src/coveragetest-idmap.c @@ -39,7 +39,7 @@ typedef struct } Test_OS_ObjTypeCount_t; /* a match function that always matches */ -static bool TestAlwaysMatch(void *ref, uint32 local_id, const OS_common_record_t *obj) +static bool TestAlwaysMatch(void *ref, osal_index_t local_id, const OS_common_record_t *obj) { return true; } @@ -113,7 +113,7 @@ void Test_OS_ObjectIdConvertLock(void) */ int32 expected; int32 actual; - uint32 array_index; + osal_index_t array_index; OS_common_record_t *record; osal_id_t objid; UT_idbuf_t corrupt_objid; @@ -186,9 +186,9 @@ void Test_OS_GetMaxForObjectType(void) * Test Case For: * uint32 OS_GetMaxForObjectType(uint32 idtype); */ - uint32 idtype = 0; - uint32 expected = 0xFFFFFFFF; - uint32 max = 0; + osal_objtype_t idtype; + uint32 expected = 0xFFFFFFFF; + uint32 max = 0; for (idtype = 0; idtype < OS_OBJECT_TYPE_USER; ++idtype) { @@ -219,9 +219,9 @@ void Test_OS_GetBaseForObjectType(void) * Test Case For: * uint32 OS_GetBaseForObjectType(uint32 idtype); */ - uint32 idtype = 0; - uint32 expected = 0xFFFFFFFF; - uint32 max = 0; + osal_objtype_t idtype; + uint32 expected = 0xFFFFFFFF; + uint32 max = 0; for (idtype = 0; idtype < OS_OBJECT_TYPE_USER; ++idtype) { @@ -256,10 +256,10 @@ void Test_OS_ObjectIdToArrayIndex(void) * different test case. The only additional test here is to provide a value * which is out of range. */ - osal_id_t objid; - uint32 local_idx = 0xFFFFFFFF; - int32 expected = OS_SUCCESS; - int32 actual = ~OS_SUCCESS; + osal_id_t objid; + osal_index_t local_idx; + int32 expected = OS_SUCCESS; + int32 actual = ~OS_SUCCESS; /* need to get a "valid" objid for the nominal case */ OS_ObjectIdCompose_Impl(OS_OBJECT_TYPE_OS_TASK, 1, &objid); @@ -271,7 +271,7 @@ void Test_OS_ObjectIdToArrayIndex(void) /* coverage for off-nominal case */ expected = OS_ERR_INVALID_ID; - actual = OS_ObjectIdToArrayIndex(0xFFFFFFFF, UT_OBJID_OTHER, &local_idx); + actual = OS_ObjectIdToArrayIndex(0xFFFF, UT_OBJID_OTHER, &local_idx); UtAssert_True(actual == expected, "OS_ObjectIdToArrayIndex() (%ld) == OS_ERR_INVALID_ID", (long)actual); } @@ -335,8 +335,8 @@ void Test_OS_ObjectIdGetById(void) int32 actual = ~OS_SUCCESS; int32 expected = OS_SUCCESS; osal_id_t refobjid; - uint32 local_idx = 0xFFFFFFFF; - OS_common_record_t *rptr = NULL; + osal_index_t local_idx; + OS_common_record_t *rptr = NULL; /* verify that the call returns ERROR when not initialized */ OS_SharedGlobalVars.Initialized = false; @@ -373,7 +373,7 @@ void Test_OS_ObjectIdGetById(void) /* attempt to get lock for invalid type object should fail */ expected = OS_ERR_INVALID_ID; - actual = OS_ObjectIdGetById(OS_LOCK_MODE_NONE, 0xFFFFFFFF, refobjid, &local_idx, &rptr); + actual = OS_ObjectIdGetById(OS_LOCK_MODE_NONE, 0xFFFF, refobjid, &local_idx, &rptr); UtAssert_True(actual == expected, "OS_ObjectIdGetById() (%ld) == OS_ERR_INVALID_ID", (long)actual); OS_SharedGlobalVars.ShutdownFlag = 0; @@ -532,32 +532,32 @@ void Test_OS_ObjectIdAllocateNew(void) */ int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; - uint32 indx; + osal_index_t idx; OS_common_record_t *rptr = NULL; - actual = OS_ObjectIdAllocateNew(OS_OBJECT_TYPE_OS_TASK, "UT_alloc", &indx, &rptr); + actual = OS_ObjectIdAllocateNew(OS_OBJECT_TYPE_OS_TASK, "UT_alloc", &idx, &rptr); /* Verify Outputs */ UtAssert_True(actual == expected, "OS_ObjectIdAllocate() (%ld) == OS_SUCCESS", (long)actual); UtAssert_True(rptr != NULL, "rptr (%p) != NULL", (void *)rptr); /* Passing a NULL name also should work here (used for internal objects) */ - actual = OS_ObjectIdAllocateNew(OS_OBJECT_TYPE_OS_TASK, NULL, &indx, &rptr); + actual = OS_ObjectIdAllocateNew(OS_OBJECT_TYPE_OS_TASK, NULL, &idx, &rptr); UtAssert_True(actual == expected, "OS_ObjectIdAllocate(NULL) (%ld) == OS_SUCCESS", (long)actual); rptr->name_entry = "UT_alloc"; expected = OS_ERR_NAME_TAKEN; - actual = OS_ObjectIdAllocateNew(OS_OBJECT_TYPE_OS_TASK, "UT_alloc", &indx, &rptr); + actual = OS_ObjectIdAllocateNew(OS_OBJECT_TYPE_OS_TASK, "UT_alloc", &idx, &rptr); UtAssert_True(actual == expected, "OS_ObjectIdAllocate() (%ld) == OS_ERR_NAME_TAKEN", (long)actual); OS_SharedGlobalVars.ShutdownFlag = OS_SHUTDOWN_MAGIC_NUMBER; expected = OS_ERROR; - actual = OS_ObjectIdAllocateNew(OS_OBJECT_TYPE_OS_TASK, "UT_alloc", &indx, &rptr); + actual = OS_ObjectIdAllocateNew(OS_OBJECT_TYPE_OS_TASK, "UT_alloc", &idx, &rptr); OS_SharedGlobalVars.ShutdownFlag = 0; UtAssert_True(actual == expected, "OS_ObjectIdAllocate() (%ld) == OS_ERR_NAME_TAKEN", (long)actual); expected = OS_ERR_INCORRECT_OBJ_TYPE; - actual = OS_ObjectIdAllocateNew(0xFFFFFFFF, "UT_alloc", &indx, &rptr); + actual = OS_ObjectIdAllocateNew(0xFFFF, "UT_alloc", &idx, &rptr); UtAssert_True(actual == expected, "OS_ObjectIdAllocate() (%ld) == OS_ERR_INCORRECT_OBJ_TYPE", (long)actual); } @@ -569,11 +569,11 @@ void Test_OS_ConvertToArrayIndex(void) * * */ - int32 expected = OS_SUCCESS; - int32 actual = ~OS_SUCCESS; // OS_ConvertToArrayIndex(); - uint32 local_idx1 = 0xFFFFFFF0; - uint32 local_idx2 = 0xFFFFFFF1; - OS_common_record_t *rptr = NULL; + int32 expected = OS_SUCCESS; + int32 actual = ~OS_SUCCESS; // OS_ConvertToArrayIndex(); + osal_index_t local_idx1; + osal_index_t local_idx2; + OS_common_record_t *rptr = NULL; /* Need a valid ID to work with */ OS_ObjectIdFindNext(OS_OBJECT_TYPE_OS_TASK, &local_idx1, &rptr); @@ -593,9 +593,9 @@ void Test_OS_ForEachObject(void) * Test Case For: * void OS_ForEachObject (uint32 creator_id, OS_ArgCallback_t callback_ptr, void *callback_arg); */ - uint32 objtype = OS_OBJECT_TYPE_UNDEFINED; - OS_common_record_t * rptr = NULL; - uint32 local_idx = 0xFFFFFFFF; + osal_objtype_t objtype; + OS_common_record_t * rptr = NULL; + osal_index_t local_idx; UT_idbuf_t self_id; Test_OS_ObjTypeCount_t Count; @@ -603,6 +603,7 @@ void Test_OS_ForEachObject(void) memset(&Count, 0, sizeof(Count)); + objtype = OS_OBJECT_TYPE_UNDEFINED; while (objtype < OS_OBJECT_TYPE_USER) { OS_ObjectIdFindNext(objtype, &local_idx, &rptr); @@ -641,8 +642,8 @@ void Test_OS_GetResourceName(void) * Test Case For: * int32 OS_GetResourceName(uint32 id, char *buffer, uint32 buffer_size) */ - uint32 local_idx = 0xFFFFFFFF; - OS_common_record_t *rptr = NULL; + osal_index_t local_idx; + OS_common_record_t *rptr = NULL; char NameBuffer[OS_MAX_API_NAME]; int32 expected; int32 actual; @@ -659,11 +660,11 @@ void Test_OS_GetResourceName(void) UtAssert_True(strcmp(NameBuffer, "UTTask") == 0, "NameBuffer (%s) == UTTask", NameBuffer); expected = OS_ERR_NAME_TOO_LONG; - actual = OS_GetResourceName(rptr->active_id, NameBuffer, 2); + actual = OS_GetResourceName(rptr->active_id, NameBuffer, OSAL_SIZE_C(2)); UtAssert_True(actual == expected, "OS_GetResourceName() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); expected = OS_INVALID_POINTER; - actual = OS_GetResourceName(rptr->active_id, NULL, 0); + actual = OS_GetResourceName(rptr->active_id, NULL, OSAL_SIZE_C(0)); UtAssert_True(actual == expected, "OS_GetResourceName() (%ld) == OS_INVALID_POINTER", (long)actual); } diff --git a/src/unit-test-coverage/shared/src/coveragetest-module.c b/src/unit-test-coverage/shared/src/coveragetest-module.c index 69d71290e..d553629ff 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-module.c +++ b/src/unit-test-coverage/shared/src/coveragetest-module.c @@ -210,16 +210,16 @@ void Test_OS_SymbolTableDump(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; - actual = OS_SymbolTableDump("test", 555); + actual = OS_SymbolTableDump("test", OSAL_SIZE_C(555)); UtAssert_True(actual == expected, "OS_SymbolTableDump() (%ld) == OS_SUCCESS", (long)actual); expected = OS_INVALID_POINTER; - actual = OS_SymbolTableDump(NULL, 555); + actual = OS_SymbolTableDump(NULL, OSAL_SIZE_C(555)); UtAssert_True(actual == expected, "OS_SymbolTableDump() (%ld) == OS_INVALID_POINTER", (long)actual); UT_SetForceFail(UT_KEY(OS_TranslatePath), OS_ERROR); expected = OS_ERROR; - actual = OS_SymbolTableDump("test", 555); + actual = OS_SymbolTableDump("test", OSAL_SIZE_C(555)); UtAssert_True(actual == expected, "OS_SymbolTableDump() (%ld) == OS_ERROR", (long)actual); } @@ -232,10 +232,11 @@ void Test_OS_ModuleGetInfo(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; OS_module_prop_t module_prop; - uint32 local_index = 1; + osal_index_t local_index; OS_common_record_t utrec; OS_common_record_t *rptr = &utrec; + local_index = UT_INDEX_1; memset(&utrec, 0, sizeof(utrec)); utrec.creator = UT_OBJID_OTHER; utrec.name_entry = "ABC"; diff --git a/src/unit-test-coverage/shared/src/coveragetest-mutex.c b/src/unit-test-coverage/shared/src/coveragetest-mutex.c index ad13a1539..4d2cd0728 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-mutex.c +++ b/src/unit-test-coverage/shared/src/coveragetest-mutex.c @@ -139,7 +139,7 @@ void Test_OS_MutSemGetInfo(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; OS_mut_sem_prop_t prop; - uint32 local_index = 1; + osal_index_t local_index = UT_INDEX_1; OS_common_record_t utrec; OS_common_record_t *rptr = &utrec; diff --git a/src/unit-test-coverage/shared/src/coveragetest-queue.c b/src/unit-test-coverage/shared/src/coveragetest-queue.c index 4c8bfa89a..3dd21200f 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-queue.c +++ b/src/unit-test-coverage/shared/src/coveragetest-queue.c @@ -56,23 +56,23 @@ void Test_OS_QueueCreate(void) */ int32 expected = OS_SUCCESS; osal_id_t objid; - int32 actual = OS_QueueCreate(&objid, "UT", 0, 0, 0); + int32 actual = OS_QueueCreate(&objid, "UT", OSAL_BLOCKCOUNT_C(0), OSAL_SIZE_C(0), 0); UtAssert_True(actual == expected, "OS_QueueCreate() (%ld) == OS_SUCCESS", (long)actual); /* test error cases */ expected = OS_INVALID_POINTER; - actual = OS_QueueCreate(NULL, "UT", 0, 0, 0); + actual = OS_QueueCreate(NULL, "UT", OSAL_BLOCKCOUNT_C(0), OSAL_SIZE_C(0), 0); UtAssert_True(actual == expected, "OS_QueueCreate() (%ld) == OS_INVALID_POINTER", (long)actual); UT_SetForceFail(UT_KEY(OCS_strlen), 2 + OS_MAX_API_NAME); expected = OS_ERR_NAME_TOO_LONG; - actual = OS_QueueCreate(&objid, "UT", 0, 0, 0); + actual = OS_QueueCreate(&objid, "UT", OSAL_BLOCKCOUNT_C(0), OSAL_SIZE_C(0), 0); UtAssert_True(actual == expected, "OS_QueueCreate() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); UT_ClearForceFail(UT_KEY(OCS_strlen)); expected = OS_QUEUE_INVALID_SIZE; - actual = OS_QueueCreate(&objid, "UT", 1 + OS_QUEUE_MAX_DEPTH, 0, 0); + actual = OS_QueueCreate(&objid, "UT", OSAL_BLOCKCOUNT_C(1 + OS_QUEUE_MAX_DEPTH), OSAL_SIZE_C(0), 0); UtAssert_True(actual == expected, "OS_QueueCreate() (%ld) == OS_QUEUE_INVALID_SIZE", (long)actual); } @@ -98,7 +98,7 @@ void Test_OS_QueueGet(void) */ int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; - uint32 actual_size; + size_t actual_size; char Buf[4]; actual = OS_QueueGet(UT_OBJID_1, Buf, sizeof(Buf), &actual_size, 0); @@ -170,7 +170,7 @@ void Test_OS_QueueGetInfo(void) int32 actual = ~OS_SUCCESS; OS_queue_prop_t queue_prop; osal_id_t id; - uint32 local_index = 1; + osal_index_t local_index = UT_INDEX_1; OS_common_record_t utrec; OS_common_record_t *rptr = &utrec; diff --git a/src/unit-test-coverage/shared/src/coveragetest-sockets.c b/src/unit-test-coverage/shared/src/coveragetest-sockets.c index 13c7314a6..9c7acd65b 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-sockets.c +++ b/src/unit-test-coverage/shared/src/coveragetest-sockets.c @@ -150,10 +150,11 @@ void Test_OS_SocketAccept(void) */ int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; - uint32 local_id = 0; + osal_index_t local_id; osal_id_t connsock_id; OS_SockAddr_t Addr; + local_id = UT_INDEX_0; connsock_id = OS_OBJECT_ID_UNDEFINED; OS_stream_table[local_id].socket_type = OS_SocketType_STREAM; @@ -210,10 +211,10 @@ void Test_OS_SocketConnect(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; OS_SockAddr_t Addr; - uint32 idbuf; + osal_index_t idbuf; memset(&Addr, 0, sizeof(Addr)); - idbuf = 1; + idbuf = UT_INDEX_1; UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &idbuf, sizeof(idbuf), false); OS_stream_table[idbuf].socket_domain = OS_SocketDomain_INET; OS_stream_table[idbuf].socket_type = OS_SocketType_STREAM; @@ -263,19 +264,20 @@ void Test_OS_SocketRecvFrom(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; OS_SockAddr_t Addr; - uint32 idbuf; + osal_index_t idbuf; memset(&Addr, 0, sizeof(Addr)); - idbuf = 1; + idbuf = UT_INDEX_1; UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &idbuf, sizeof(idbuf), false); OS_stream_table[idbuf].socket_type = OS_SocketType_DATAGRAM; OS_stream_table[idbuf].stream_state = OS_STREAM_STATE_BOUND; actual = OS_SocketRecvFrom(UT_OBJID_1, &Buf, 1, &Addr, 0); + actual = OS_SocketRecvFrom(UT_OBJID_1, &Buf, sizeof(Buf), &Addr, 0); UtAssert_True(actual == expected, "OS_SocketRecvFrom() (%ld) == OS_SUCCESS", (long)actual); expected = OS_INVALID_POINTER; - actual = OS_SocketRecvFrom(UT_OBJID_1, NULL, 0, NULL, 0); + actual = OS_SocketRecvFrom(UT_OBJID_1, NULL, OSAL_SIZE_C(0), NULL, 0); UtAssert_True(actual == expected, "OS_SocketRecvFrom(NULL) (%ld) == OS_INVALID_POINTER", (long)actual); /* @@ -283,7 +285,7 @@ void Test_OS_SocketRecvFrom(void) */ OS_stream_table[1].socket_type = OS_SocketType_INVALID; expected = OS_ERR_INCORRECT_OBJ_TYPE; - actual = OS_SocketRecvFrom(UT_OBJID_1, &Buf, 1, &Addr, 0); + actual = OS_SocketRecvFrom(UT_OBJID_1, &Buf, sizeof(Buf), &Addr, 0); UtAssert_True(actual == expected, "OS_SocketRecvFrom() non-datagram (%ld) == OS_ERR_INCORRECT_OBJ_TYPE", (long)actual); @@ -293,7 +295,7 @@ void Test_OS_SocketRecvFrom(void) OS_stream_table[1].socket_type = OS_SocketType_DATAGRAM; OS_stream_table[1].stream_state = 0; expected = OS_ERR_INCORRECT_OBJ_STATE; - actual = OS_SocketRecvFrom(UT_OBJID_1, &Buf, 1, &Addr, 0); + actual = OS_SocketRecvFrom(UT_OBJID_1, &Buf, sizeof(Buf), &Addr, 0); UtAssert_True(actual == expected, "OS_SocketRecvFrom() non-bound (%ld) == OS_ERR_INCORRECT_OBJ_STATE", (long)actual); } @@ -313,19 +315,19 @@ void Test_OS_SocketSendTo(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; OS_SockAddr_t Addr; - uint32 idbuf; + osal_index_t idbuf; memset(&Addr, 0, sizeof(Addr)); - idbuf = 1; + idbuf = UT_INDEX_1; UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &idbuf, sizeof(idbuf), false); OS_stream_table[idbuf].socket_type = OS_SocketType_DATAGRAM; OS_stream_table[idbuf].stream_state = OS_STREAM_STATE_BOUND; - actual = OS_SocketSendTo(UT_OBJID_1, &Buf, 1, &Addr); + actual = OS_SocketSendTo(UT_OBJID_1, &Buf, sizeof(Buf), &Addr); UtAssert_True(actual == expected, "OS_SocketSendTo() (%ld) == OS_SUCCESS", (long)actual); expected = OS_INVALID_POINTER; - actual = OS_SocketSendTo(UT_OBJID_1, NULL, 0, NULL); + actual = OS_SocketSendTo(UT_OBJID_1, NULL, OSAL_SIZE_C(0), NULL); UtAssert_True(actual == expected, "OS_SocketSendTo(NULL) (%ld) == OS_INVALID_POINTER", (long)actual); /* @@ -333,7 +335,7 @@ void Test_OS_SocketSendTo(void) */ OS_stream_table[1].socket_type = OS_SocketType_INVALID; expected = OS_ERR_INCORRECT_OBJ_TYPE; - actual = OS_SocketSendTo(UT_OBJID_1, &Buf, 1, &Addr); + actual = OS_SocketSendTo(UT_OBJID_1, &Buf, sizeof(Buf), &Addr); UtAssert_True(actual == expected, "OS_SocketSendTo() non-datagram (%ld) == OS_ERR_INCORRECT_OBJ_TYPE", (long)actual); } @@ -382,7 +384,7 @@ void Test_OS_SocketGetInfo(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; OS_socket_prop_t prop; - uint32 local_index = 1; + osal_index_t local_index = UT_INDEX_1; OS_common_record_t utrec; OS_common_record_t *rptr = &utrec; @@ -439,7 +441,7 @@ void Test_OS_SocketAddr(void) actual = OS_SocketAddrInit(NULL, OS_SocketDomain_INVALID); UtAssert_True(actual == expected, "OS_SocketAddrInit() (%ld) == OS_INVALID_POINTER", (long)actual); - actual = OS_SocketAddrToString(NULL, 0, NULL); + actual = OS_SocketAddrToString(NULL, OSAL_SIZE_C(0), NULL); UtAssert_True(actual == expected, "OS_SocketAddrToString() (%ld) == OS_INVALID_POINTER", (long)actual); actual = OS_SocketAddrFromString(NULL, NULL); diff --git a/src/unit-test-coverage/shared/src/coveragetest-task.c b/src/unit-test-coverage/shared/src/coveragetest-task.c index f1e640c6d..7a0e9c63f 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-task.c +++ b/src/unit-test-coverage/shared/src/coveragetest-task.c @@ -106,17 +106,23 @@ void Test_OS_TaskCreate(void) */ int32 expected = OS_SUCCESS; osal_id_t objid; - int32 actual = OS_TaskCreate(&objid, "UT", UT_TestHook, NULL, 128, 0, 0); + int32 actual; + + actual = OS_TaskCreate(&objid, "UT", UT_TestHook, OSAL_TASK_STACK_ALLOCATE, OSAL_SIZE_C(128), OSAL_PRIORITY_C(0), 0); UtAssert_True(actual == expected, "OS_TaskCreate() (%ld) == OS_SUCCESS", (long)actual); OSAPI_TEST_OBJID(objid, !=, OS_OBJECT_ID_UNDEFINED); - OSAPI_TEST_FUNCTION_RC(OS_TaskCreate(NULL, NULL, NULL, NULL, 0, 0, 0), OS_INVALID_POINTER); - OSAPI_TEST_FUNCTION_RC(OS_TaskCreate(&objid, "UT", UT_TestHook, NULL, 0, 0, 0), OS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_TaskCreate(&objid, "UT", UT_TestHook, NULL, 128, 10 + OS_MAX_TASK_PRIORITY, 0), - OS_ERR_INVALID_PRIORITY); + OSAPI_TEST_FUNCTION_RC( + OS_TaskCreate(NULL, NULL, NULL, OSAL_TASK_STACK_ALLOCATE, OSAL_SIZE_C(0), OSAL_PRIORITY_C(0), 0), + OS_INVALID_POINTER); + OSAPI_TEST_FUNCTION_RC( + OS_TaskCreate(&objid, "UT", UT_TestHook, OSAL_TASK_STACK_ALLOCATE, OSAL_SIZE_C(0), OSAL_PRIORITY_C(0), 0), + OS_ERROR); UT_SetForceFail(UT_KEY(OCS_strlen), 10 + OS_MAX_API_NAME); - OSAPI_TEST_FUNCTION_RC(OS_TaskCreate(&objid, "UT", UT_TestHook, NULL, 128, 0, 0), OS_ERR_NAME_TOO_LONG); + OSAPI_TEST_FUNCTION_RC( + OS_TaskCreate(&objid, "UT", UT_TestHook, OSAL_TASK_STACK_ALLOCATE, OSAL_SIZE_C(128), OSAL_PRIORITY_C(0), 0), + OS_ERR_NAME_TOO_LONG); } void Test_OS_TaskDelete(void) @@ -148,7 +154,7 @@ void Test_OS_TaskExit(void) * Test Case For: * void OS_TaskExit() */ - uint32 local_index = 0; + osal_index_t local_index = UT_INDEX_0; OS_common_record_t utrec; OS_common_record_t *rptr = &utrec; @@ -180,11 +186,9 @@ void Test_OS_TaskSetPriority(void) * int32 OS_TaskSetPriority (uint32 task_id, uint32 new_priority) */ int32 expected = OS_SUCCESS; - int32 actual = OS_TaskSetPriority(UT_OBJID_1, 1); + int32 actual = OS_TaskSetPriority(UT_OBJID_1, OSAL_PRIORITY_C(1)); UtAssert_True(actual == expected, "OS_TaskSetPriority() (%ld) == OS_SUCCESS", (long)actual); - - OSAPI_TEST_FUNCTION_RC(OS_TaskSetPriority(UT_OBJID_1, 10 + OS_MAX_TASK_PRIORITY), OS_ERR_INVALID_PRIORITY); } void Test_OS_TaskRegister(void) { @@ -248,15 +252,15 @@ void Test_OS_TaskGetInfo(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; OS_task_prop_t task_prop; - uint32 local_index = 1; + osal_index_t local_index = UT_INDEX_1; OS_common_record_t utrec; OS_common_record_t *rptr = &utrec; memset(&utrec, 0, sizeof(utrec)); utrec.creator = UT_OBJID_OTHER; utrec.name_entry = "ABC"; - OS_task_table[1].stack_size = 222; - OS_task_table[1].priority = 333; + OS_task_table[1].stack_size = OSAL_SIZE_C(222); + OS_task_table[1].priority = OSAL_PRIORITY_C(133); UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &local_index, sizeof(local_index), false); UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &rptr, sizeof(rptr), false); actual = OS_TaskGetInfo(UT_OBJID_1, &task_prop); @@ -266,10 +270,10 @@ void Test_OS_TaskGetInfo(void) UtAssert_True(strcmp(task_prop.name, "ABC") == 0, "task_prop.name (%s) == ABC", task_prop.name); UtAssert_True(task_prop.stack_size == 222, "task_prop.stack_size (%lu) == 222", (unsigned long)task_prop.stack_size); - UtAssert_True(task_prop.priority == 333, "task_prop.priority (%lu) == 333", (unsigned long)task_prop.priority); + UtAssert_True(task_prop.priority == 133, "task_prop.priority (%lu) == 133", (unsigned long)task_prop.priority); - OS_task_table[1].stack_size = 0; - OS_task_table[1].priority = 0; + OS_task_table[1].stack_size = OSAL_SIZE_C(0); + OS_task_table[1].priority = OSAL_PRIORITY_C(0); OSAPI_TEST_FUNCTION_RC(OS_TaskGetInfo(OS_OBJECT_ID_UNDEFINED, NULL), OS_INVALID_POINTER); } diff --git a/src/unit-test-coverage/shared/src/coveragetest-time.c b/src/unit-test-coverage/shared/src/coveragetest-time.c index d62a28fb1..6c3f0b17d 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-time.c +++ b/src/unit-test-coverage/shared/src/coveragetest-time.c @@ -116,11 +116,11 @@ void Test_OS_TimerCreate(void) * Test Case For: * int32 OS_TimerCreate(uint32 *timer_id, const char *timer_name, uint32 *accuracy, OS_TimerCallback_t callback_ptr) */ - int32 expected = OS_SUCCESS; - osal_id_t objid = OS_OBJECT_ID_UNDEFINED; - uint32 local_id = 0xFFFFFFFF; - uint32 accuracy = 0xFFFFFFFF; - int32 actual = OS_TimerCreate(&objid, "UT", &accuracy, UT_TimerCallback); + int32 expected = OS_SUCCESS; + osal_id_t objid = OS_OBJECT_ID_UNDEFINED; + osal_index_t local_id; + uint32 accuracy = 0xFFFFFFFF; + int32 actual = OS_TimerCreate(&objid, "UT", &accuracy, UT_TimerCallback); UtAssert_True(actual == expected, "OS_TimerCreate() (%ld) == OS_SUCCESS", (long)actual); @@ -170,7 +170,7 @@ void Test_OS_TimerSet(void) actual = OS_TimerSet(UT_OBJID_1, 0, 1); UtAssert_True(actual == expected, "OS_TimerSet() (%ld) == OS_SUCCESS", (long)actual); - OS_timecb_table[2].timebase_ref = 0; + OS_timecb_table[2].timebase_ref = UT_INDEX_0; OS_timecb_table[2].flags = TIMECB_FLAG_DEDICATED_TIMEBASE; OS_global_timebase_table[0].active_id = UT_OBJID_2; actual = OS_TimerSet(UT_OBJID_2, 0, 1); @@ -199,10 +199,10 @@ void Test_OS_TimerDelete(void) UtAssert_True(actual == expected, "OS_TimerDelete() (%ld) == OS_SUCCESS", (long)actual); - OS_timecb_table[1].timebase_ref = 0; - OS_timecb_table[2].timebase_ref = 0; - OS_timecb_table[2].next_ref = 1; - OS_timecb_table[1].next_ref = 1; + OS_timecb_table[1].timebase_ref = UT_INDEX_0; + OS_timecb_table[2].timebase_ref = UT_INDEX_0; + OS_timecb_table[2].next_ref = UT_INDEX_1; + OS_timecb_table[1].next_ref = UT_INDEX_1; OS_timebase_table[0].first_cb = UT_OBJID_2; actual = OS_TimerDelete(UT_OBJID_2); UtAssert_True(actual == expected, "OS_TimerDelete() (%ld) == OS_SUCCESS", (long)actual); @@ -215,7 +215,7 @@ void Test_OS_TimerDelete(void) * these are implicitly created as part of timer creation for API compatibility */ OS_TimeBaseCreate(&OS_global_timebase_table[0].active_id, "ut", NULL); OS_timecb_table[1].flags = TIMECB_FLAG_DEDICATED_TIMEBASE; - OS_timecb_table[1].timebase_ref = 0; + OS_timecb_table[1].timebase_ref = UT_INDEX_0; actual = OS_TimerDelete(UT_OBJID_1); UtAssert_True(actual == expected, "OS_TimerDelete() (%ld) == OS_SUCCESS", (long)actual); UtAssert_True(UT_GetStubCount(UT_KEY(OS_TimeBaseDelete)) == 1, "OS_TimerDelete() invoked OS_TimeBaseDelete()"); @@ -269,7 +269,7 @@ void Test_OS_TimerGetInfo(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; OS_timer_prop_t timer_prop; - uint32 local_index = 1; + osal_index_t local_index = UT_INDEX_1; OS_common_record_t utrec; OS_common_record_t *rptr = &utrec; @@ -277,7 +277,7 @@ void Test_OS_TimerGetInfo(void) utrec.creator = UT_OBJID_OTHER; utrec.name_entry = "ABC"; OS_timecb_table[1].interval_time = 2222; - OS_timecb_table[1].timebase_ref = 0; + OS_timecb_table[1].timebase_ref = UT_INDEX_0; OS_timebase_table[0].accuracy_usec = 3333; UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &local_index, sizeof(local_index), false); UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &rptr, sizeof(rptr), false); diff --git a/src/unit-test-coverage/shared/src/coveragetest-timebase.c b/src/unit-test-coverage/shared/src/coveragetest-timebase.c index 9484cb9c0..544b4c052 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-timebase.c +++ b/src/unit-test-coverage/shared/src/coveragetest-timebase.c @@ -38,7 +38,7 @@ static uint32 TimerSyncCount = 0; static uint32 TimerSyncRetVal = 0; static uint32 TimeCB = 0; -static uint32 UT_TimerSync(uint32 timer_id) +static uint32 UT_TimerSync(osal_index_t timer_id) { ++TimerSyncCount; return TimerSyncRetVal; @@ -192,7 +192,7 @@ void Test_OS_TimeBaseGetInfo(void) int32 expected = OS_SUCCESS; int32 actual = ~OS_SUCCESS; OS_timebase_prop_t timebase_prop; - uint32 local_index = 1; + osal_index_t local_index = UT_INDEX_1; OS_common_record_t utrec; OS_common_record_t *rptr = &utrec; @@ -249,8 +249,9 @@ void Test_OS_TimeBase_CallbackThread(void) */ OS_common_record_t fake_record; OS_common_record_t *recptr = &fake_record; - osal_id_t idbuf; + osal_index_t local_index; + local_index = UT_INDEX_2; memset(&fake_record, 0, sizeof(fake_record)); fake_record.active_id = UT_OBJID_2; @@ -260,8 +261,7 @@ void Test_OS_TimeBase_CallbackThread(void) TimerSyncCount = 0; TimerSyncRetVal = 0; TimeCB = 0; - idbuf = UT_OBJID_2; - UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &idbuf, sizeof(idbuf), false); + UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &local_index, sizeof(local_index), false); UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &recptr, sizeof(recptr), false); UT_SetHookFunction(UT_KEY(OS_TimeBaseLock_Impl), ClearObjectsHook, recptr); OS_TimeBase_CallbackThread(UT_OBJID_2); @@ -272,8 +272,7 @@ void Test_OS_TimeBase_CallbackThread(void) TimerSyncCount = 0; TimerSyncRetVal = 1000; fake_record.active_id = UT_OBJID_2; - idbuf = UT_OBJID_2; - UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &idbuf, sizeof(idbuf), false); + UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &local_index, sizeof(local_index), false); UT_SetDataBuffer(UT_KEY(OS_ObjectIdGetById), &recptr, sizeof(recptr), false); UT_SetHookFunction(UT_KEY(OS_TimeBaseLock_Impl), ClearObjectsHook, recptr); OS_TimeBase_CallbackThread(UT_OBJID_2); diff --git a/src/unit-test-coverage/shared/src/os-shared-coveragetest.h b/src/unit-test-coverage/shared/src/os-shared-coveragetest.h index 86c23d952..55397f6fb 100644 --- a/src/unit-test-coverage/shared/src/os-shared-coveragetest.h +++ b/src/unit-test-coverage/shared/src/os-shared-coveragetest.h @@ -74,6 +74,10 @@ typedef union #define UT_OBJID_OTHER ((osal_id_t) {0x12345}) #define UT_OBJID_MAX ((osal_id_t) {0xFFFFFFFF}) +#define UT_INDEX_0 OSAL_INDEX_C(0) +#define UT_INDEX_1 OSAL_INDEX_C(1) +#define UT_INDEX_2 OSAL_INDEX_C(2) + /* * Setup function prior to every test */ diff --git a/src/unit-test-coverage/ut-stubs/inc/OCS_bsp-impl.h b/src/unit-test-coverage/ut-stubs/inc/OCS_bsp-impl.h index 5cefc0938..8a6a906e2 100644 --- a/src/unit-test-coverage/ut-stubs/inc/OCS_bsp-impl.h +++ b/src/unit-test-coverage/ut-stubs/inc/OCS_bsp-impl.h @@ -70,7 +70,7 @@ Note: This should write the string as-is without buffering. ------------------------------------------------------------------*/ -extern void OCS_OS_BSP_ConsoleOutput_Impl(const char *Str, uint32_t DataLen); +extern void OCS_OS_BSP_ConsoleOutput_Impl(const char *Str, size_t DataLen); /*---------------------------------------------------------------- Function: OS_BSP_ConsoleSetMode_Impl diff --git a/src/unit-test-coverage/ut-stubs/src/bsp-console-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/bsp-console-impl-stubs.c index 23aeb900c..d3ed86ea3 100644 --- a/src/unit-test-coverage/ut-stubs/src/bsp-console-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/bsp-console-impl-stubs.c @@ -43,7 +43,7 @@ Note: This should write the string as-is without buffering. ------------------------------------------------------------------*/ -void OCS_OS_BSP_ConsoleOutput_Impl(const char *Str, uint32_t DataLen) +void OCS_OS_BSP_ConsoleOutput_Impl(const char *Str, size_t DataLen) { int32_t retcode = UT_DEFAULT_IMPL(OCS_OS_BSP_ConsoleOutput_Impl); diff --git a/src/unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c b/src/unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c index aa67f8aa2..5ffc9c262 100644 --- a/src/unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/libc-stdio-stubs.c @@ -45,7 +45,7 @@ int OCS_fclose(OCS_FILE *stream) char *OCS_fgets(char *s, int n, OCS_FILE *stream) { int32 Status; - uint32 CopySize; + size_t CopySize; Status = UT_DEFAULT_IMPL_RC(OCS_fgets, OCS_STDIO_MAX_SIZE); diff --git a/src/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c b/src/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c index 88eabb995..721dece9b 100644 --- a/src/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/libc-stdlib-stubs.c @@ -92,7 +92,7 @@ void *OCS_malloc(size_t sz) cpuaddr PoolEnd; cpuaddr NextBlock; size_t NextSize; - uint32 PoolSize; + size_t PoolSize; uint32 CallCnt; struct MPOOL_REC *Rec; @@ -163,7 +163,7 @@ void OCS_free(void *ptr) int32 Status; cpuaddr BlockAddr; void * PoolPtr; - uint32 PoolSize; + size_t PoolSize; struct MPOOL_REC *Rec; /* diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-binsem-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-binsem-impl-stubs.c index c54b742e1..d1b8bfede 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-binsem-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-binsem-impl-stubs.c @@ -38,10 +38,10 @@ ** Semaphore API */ -UT_DEFAULT_STUB(OS_BinSemCreate_Impl, (uint32 sem_id, uint32 sem_initial_value, uint32 options)) -UT_DEFAULT_STUB(OS_BinSemFlush_Impl, (uint32 sem_id)) -UT_DEFAULT_STUB(OS_BinSemGive_Impl, (uint32 sem_id)) -UT_DEFAULT_STUB(OS_BinSemTake_Impl, (uint32 sem_id)) -UT_DEFAULT_STUB(OS_BinSemTimedWait_Impl, (uint32 sem_id, uint32 msecs)) -UT_DEFAULT_STUB(OS_BinSemDelete_Impl, (uint32 sem_id)) -UT_DEFAULT_STUB(OS_BinSemGetInfo_Impl, (uint32 sem_id, OS_bin_sem_prop_t *bin_prop)) +UT_DEFAULT_STUB(OS_BinSemCreate_Impl, (osal_index_t sem_id, uint32 sem_initial_value, uint32 options)) +UT_DEFAULT_STUB(OS_BinSemFlush_Impl, (osal_index_t sem_id)) +UT_DEFAULT_STUB(OS_BinSemGive_Impl, (osal_index_t sem_id)) +UT_DEFAULT_STUB(OS_BinSemTake_Impl, (osal_index_t sem_id)) +UT_DEFAULT_STUB(OS_BinSemTimedWait_Impl, (osal_index_t sem_id, uint32 msecs)) +UT_DEFAULT_STUB(OS_BinSemDelete_Impl, (osal_index_t sem_id)) +UT_DEFAULT_STUB(OS_BinSemGetInfo_Impl, (osal_index_t sem_id, OS_bin_sem_prop_t *bin_prop)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-common-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-common-impl-stubs.c index 07393f74f..5f3ee077a 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-common-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-common-impl-stubs.c @@ -34,7 +34,7 @@ #include "os-shared-common.h" -UT_DEFAULT_STUB(OS_API_Impl_Init, (uint32 idtype)) +UT_DEFAULT_STUB(OS_API_Impl_Init, (osal_objtype_t idtype)) void OS_IdleLoop_Impl(void) { diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-console-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-console-impl-stubs.c index 6a0d202fb..ec77389bb 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-console-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-console-impl-stubs.c @@ -37,11 +37,11 @@ /* ** Console output API (printf) */ -void OS_ConsoleWakeup_Impl(uint32 local_id) +void OS_ConsoleWakeup_Impl(osal_index_t local_id) { UT_DEFAULT_IMPL(OS_ConsoleWakeup_Impl); } -int32 OS_ConsoleCreate_Impl(uint32 local_id) +int32 OS_ConsoleCreate_Impl(osal_index_t local_id) { return UT_DEFAULT_IMPL(OS_ConsoleCreate_Impl); } diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-countsem-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-countsem-impl-stubs.c index caa024050..c48a8168b 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-countsem-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-countsem-impl-stubs.c @@ -38,9 +38,9 @@ ** Semaphore API */ -UT_DEFAULT_STUB(OS_CountSemCreate_Impl, (uint32 sem_id, uint32 sem_initial_value, uint32 options)) -UT_DEFAULT_STUB(OS_CountSemGive_Impl, (uint32 sem_id)) -UT_DEFAULT_STUB(OS_CountSemTake_Impl, (uint32 sem_id)) -UT_DEFAULT_STUB(OS_CountSemTimedWait_Impl, (uint32 sem_id, uint32 msecs)) -UT_DEFAULT_STUB(OS_CountSemDelete_Impl, (uint32 sem_id)) -UT_DEFAULT_STUB(OS_CountSemGetInfo_Impl, (uint32 sem_id, OS_count_sem_prop_t *count_prop)) +UT_DEFAULT_STUB(OS_CountSemCreate_Impl, (osal_index_t sem_id, uint32 sem_initial_value, uint32 options)) +UT_DEFAULT_STUB(OS_CountSemGive_Impl, (osal_index_t sem_id)) +UT_DEFAULT_STUB(OS_CountSemTake_Impl, (osal_index_t sem_id)) +UT_DEFAULT_STUB(OS_CountSemTimedWait_Impl, (osal_index_t sem_id, uint32 msecs)) +UT_DEFAULT_STUB(OS_CountSemDelete_Impl, (osal_index_t sem_id)) +UT_DEFAULT_STUB(OS_CountSemGetInfo_Impl, (osal_index_t sem_id, OS_count_sem_prop_t *count_prop)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-file-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-file-impl-stubs.c index 26fec0ba1..ae3b5ac87 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-file-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-file-impl-stubs.c @@ -39,27 +39,27 @@ * File API abstraction layer */ -UT_DEFAULT_STUB(OS_FileOpen_Impl, (uint32 file_id, const char *local_path, int32 flags, int32 access)) +UT_DEFAULT_STUB(OS_FileOpen_Impl, (osal_index_t file_id, const char *local_path, int32 flags, int32 access)) UT_DEFAULT_STUB(OS_FileStat_Impl, (const char *local_path, os_fstat_t *filestat)) UT_DEFAULT_STUB(OS_FileRemove_Impl, (const char *local_path)) UT_DEFAULT_STUB(OS_FileRename_Impl, (const char *old_path, const char *new_path)) UT_DEFAULT_STUB(OS_FileChmod_Impl, (const char *local_path, uint32 access)) -UT_DEFAULT_STUB(OS_ShellOutputToFile_Impl, (uint32 file_id, const char *Cmd)) +UT_DEFAULT_STUB(OS_ShellOutputToFile_Impl, (osal_index_t file_id, const char *Cmd)) /* * Directory API abstraction layer */ UT_DEFAULT_STUB(OS_DirCreate_Impl, (const char *local_path, uint32 access)) -UT_DEFAULT_STUB(OS_DirOpen_Impl, (uint32 dir_id, const char *local_path)) -UT_DEFAULT_STUB(OS_DirClose_Impl, (uint32 dir_id)) -UT_DEFAULT_STUB(OS_DirRead_Impl, (uint32 dir_id, os_dirent_t *dirent)) -UT_DEFAULT_STUB(OS_DirRewind_Impl, (uint32 dir_id)) +UT_DEFAULT_STUB(OS_DirOpen_Impl, (osal_index_t dir_id, const char *local_path)) +UT_DEFAULT_STUB(OS_DirClose_Impl, (osal_index_t dir_id)) +UT_DEFAULT_STUB(OS_DirRead_Impl, (osal_index_t dir_id, os_dirent_t *dirent)) +UT_DEFAULT_STUB(OS_DirRewind_Impl, (osal_index_t dir_id)) UT_DEFAULT_STUB(OS_DirRemove_Impl, (const char *local_path)) /* * Stream abstraction layer (applies to sockets and files) */ -int32 OS_GenericRead_Impl(uint32 stream_id, void *buffer, uint32 nbytes, int32 timeout) +int32 OS_GenericRead_Impl(osal_index_t local_id, void *buffer, size_t nbytes, int32 timeout) { int32 Status = UT_DEFAULT_IMPL(OS_GenericRead_Impl); @@ -71,7 +71,7 @@ int32 OS_GenericRead_Impl(uint32 stream_id, void *buffer, uint32 nbytes, int32 t return Status; } -int32 OS_GenericWrite_Impl(uint32 stream_id, const void *buffer, uint32 nbytes, int32 timeout) +int32 OS_GenericWrite_Impl(osal_index_t local_id, const void *buffer, size_t nbytes, int32 timeout) { int32 Status = UT_DEFAULT_IMPL(OS_GenericWrite_Impl); @@ -83,5 +83,5 @@ int32 OS_GenericWrite_Impl(uint32 stream_id, const void *buffer, uint32 nbytes, return Status; } -UT_DEFAULT_STUB(OS_GenericSeek_Impl, (uint32 file_id, int32 offset, uint32 whence)) -UT_DEFAULT_STUB(OS_GenericClose_Impl, (uint32 file_id)) +UT_DEFAULT_STUB(OS_GenericSeek_Impl, (osal_index_t file_id, int32 offset, uint32 whence)) +UT_DEFAULT_STUB(OS_GenericClose_Impl, (osal_index_t file_id)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-filesys-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-filesys-impl-stubs.c index 8c0ac6f24..e3f5d1037 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-filesys-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-filesys-impl-stubs.c @@ -36,14 +36,14 @@ /* * File system abstraction layer */ -UT_DEFAULT_STUB(OS_FileSysStartVolume_Impl, (uint32 filesys_id)) -UT_DEFAULT_STUB(OS_FileSysStopVolume_Impl, (uint32 filesys_id)) -UT_DEFAULT_STUB(OS_FileSysFormatVolume_Impl, (uint32 filesys_id)) -UT_DEFAULT_STUB(OS_FileSysCheckVolume_Impl, (uint32 filesys_id, bool repair)) -UT_DEFAULT_STUB(OS_FileSysMountVolume_Impl, (uint32 filesys_id)) -UT_DEFAULT_STUB(OS_FileSysUnmountVolume_Impl, (uint32 filesys_id)) +UT_DEFAULT_STUB(OS_FileSysStartVolume_Impl, (osal_index_t filesys_id)) +UT_DEFAULT_STUB(OS_FileSysStopVolume_Impl, (osal_index_t filesys_id)) +UT_DEFAULT_STUB(OS_FileSysFormatVolume_Impl, (osal_index_t filesys_id)) +UT_DEFAULT_STUB(OS_FileSysCheckVolume_Impl, (osal_index_t filesys_id, bool repair)) +UT_DEFAULT_STUB(OS_FileSysMountVolume_Impl, (osal_index_t filesys_id)) +UT_DEFAULT_STUB(OS_FileSysUnmountVolume_Impl, (osal_index_t filesys_id)) -int32 OS_FileSysStatVolume_Impl(uint32 filesys_id, OS_statvfs_t *result) +int32 OS_FileSysStatVolume_Impl(osal_index_t filesys_id, OS_statvfs_t *result) { int32 Status = UT_DEFAULT_IMPL(OS_FileSysStatVolume_Impl); diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-idmap-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-idmap-impl-stubs.c index f3546e9f9..93440c93d 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-idmap-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-idmap-impl-stubs.c @@ -38,5 +38,5 @@ * Table locking and unlocking for global objects can be done at the shared code * layer but the actual implementation is OS-specific */ -UT_DEFAULT_STUB(OS_Lock_Global_Impl, (uint32 idtype)) -UT_DEFAULT_STUB(OS_Unlock_Global_Impl, (uint32 idtype)) +UT_DEFAULT_STUB(OS_Lock_Global_Impl, (osal_objtype_t idtype)) +UT_DEFAULT_STUB(OS_Unlock_Global_Impl, (osal_objtype_t idtype)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c index 621bcab7c..c92e8ce31 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-loader-impl-stubs.c @@ -36,9 +36,9 @@ /* * Module Loader API */ -UT_DEFAULT_STUB(OS_ModuleLoad_Impl, (uint32 module_id, const char *translated_path)) -UT_DEFAULT_STUB(OS_ModuleUnload_Impl, (uint32 module_id)) -UT_DEFAULT_STUB(OS_ModuleGetInfo_Impl, (uint32 module_id, OS_module_prop_t *module_prop)) +UT_DEFAULT_STUB(OS_ModuleLoad_Impl, (osal_index_t module_id, const char *translated_path)) +UT_DEFAULT_STUB(OS_ModuleUnload_Impl, (osal_index_t module_id)) +UT_DEFAULT_STUB(OS_ModuleGetInfo_Impl, (osal_index_t module_id, OS_module_prop_t *module_prop)) UT_DEFAULT_STUB(OS_GlobalSymbolLookup_Impl, (cpuaddr * SymbolAddress, const char *SymbolName)) -UT_DEFAULT_STUB(OS_ModuleSymbolLookup_Impl, (uint32 module_id, cpuaddr * SymbolAddress, const char *SymbolName)) -UT_DEFAULT_STUB(OS_SymbolTableDump_Impl, (const char *filename, uint32 size_limit)) +UT_DEFAULT_STUB(OS_ModuleSymbolLookup_Impl, (osal_index_t module_id, cpuaddr *SymbolAddress, const char *SymbolName)) +UT_DEFAULT_STUB(OS_SymbolTableDump_Impl, (const char *filename, size_t size_limit)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-mutex-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-mutex-impl-stubs.c index 7bc4230bc..6bbe47829 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-mutex-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-mutex-impl-stubs.c @@ -38,8 +38,8 @@ ** Mutex API */ -UT_DEFAULT_STUB(OS_MutSemCreate_Impl, (uint32 sem_id, uint32 options)) -UT_DEFAULT_STUB(OS_MutSemGive_Impl, (uint32 sem_id)) -UT_DEFAULT_STUB(OS_MutSemTake_Impl, (uint32 sem_id)) -UT_DEFAULT_STUB(OS_MutSemDelete_Impl, (uint32 sem_id)) -UT_DEFAULT_STUB(OS_MutSemGetInfo_Impl, (uint32 sem_id, OS_mut_sem_prop_t *mut_prop)) +UT_DEFAULT_STUB(OS_MutSemCreate_Impl, (osal_index_t sem_id, uint32 options)) +UT_DEFAULT_STUB(OS_MutSemGive_Impl, (osal_index_t sem_id)) +UT_DEFAULT_STUB(OS_MutSemTake_Impl, (osal_index_t sem_id)) +UT_DEFAULT_STUB(OS_MutSemDelete_Impl, (osal_index_t sem_id)) +UT_DEFAULT_STUB(OS_MutSemGetInfo_Impl, (osal_index_t sem_id, OS_mut_sem_prop_t *mut_prop)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-network-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-network-impl-stubs.c index e576d35ca..32cb5e40c 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-network-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-network-impl-stubs.c @@ -37,23 +37,24 @@ /* * Sockets API abstraction layer */ -UT_DEFAULT_STUB(OS_SocketOpen_Impl, (uint32 sock_id)) -UT_DEFAULT_STUB(OS_SocketClose_Impl, (uint32 sock_id)) -UT_DEFAULT_STUB(OS_SocketBind_Impl, (uint32 sock_id, const OS_SockAddr_t *Addr)) -UT_DEFAULT_STUB(OS_SocketAccept_Impl, (uint32 sock_id, uint32 connsock_id, OS_SockAddr_t *Addr, int32 timeout)) -UT_DEFAULT_STUB(OS_SocketConnect_Impl, (uint32 sock_id, const OS_SockAddr_t *Addr, int32 timeout)) +UT_DEFAULT_STUB(OS_SocketOpen_Impl, (osal_index_t sock_id)) +UT_DEFAULT_STUB(OS_SocketClose_Impl, (osal_index_t sock_id)) +UT_DEFAULT_STUB(OS_SocketBind_Impl, (osal_index_t sock_id, const OS_SockAddr_t *Addr)) +UT_DEFAULT_STUB(OS_SocketAccept_Impl, + (osal_index_t sock_id, osal_index_t connsock_id, OS_SockAddr_t *Addr, int32 timeout)) +UT_DEFAULT_STUB(OS_SocketConnect_Impl, (osal_index_t sock_id, const OS_SockAddr_t *Addr, int32 timeout)) UT_DEFAULT_STUB(OS_SocketRecvFrom_Impl, - (uint32 sock_id, void *buffer, uint32 buflen, OS_SockAddr_t *RemoteAddr, int32 timeout)) + (osal_index_t sock_id, void *buffer, size_t buflen, OS_SockAddr_t *RemoteAddr, int32 timeout)) UT_DEFAULT_STUB(OS_SocketSendTo_Impl, - (uint32 sock_id, const void *buffer, uint32 buflen, const OS_SockAddr_t *RemoteAddr)) -UT_DEFAULT_STUB(OS_SocketGetInfo_Impl, (uint32 sock_id, OS_socket_prop_t *sock_prop)) + (osal_index_t sock_id, const void *buffer, size_t buflen, const OS_SockAddr_t *RemoteAddr)) +UT_DEFAULT_STUB(OS_SocketGetInfo_Impl, (osal_index_t sock_id, OS_socket_prop_t *sock_prop)) UT_DEFAULT_STUB(OS_SocketAddrInit_Impl, (OS_SockAddr_t * Addr, OS_SocketDomain_t Domain)) -UT_DEFAULT_STUB(OS_SocketAddrToString_Impl, (char *buffer, uint32 buflen, const OS_SockAddr_t *Addr)) +UT_DEFAULT_STUB(OS_SocketAddrToString_Impl, (char *buffer, size_t buflen, const OS_SockAddr_t *Addr)) UT_DEFAULT_STUB(OS_SocketAddrGetPort_Impl, (uint16 * PortNum, const OS_SockAddr_t *Addr)) UT_DEFAULT_STUB(OS_SocketAddrFromString_Impl, (OS_SockAddr_t * Addr, const char *string)) UT_DEFAULT_STUB(OS_SocketAddrSetPort_Impl, (OS_SockAddr_t * Addr, uint16 PortNum)) -UT_DEFAULT_STUB(OS_NetworkGetHostName_Impl, (char *host_name, uint32 name_len)) +UT_DEFAULT_STUB(OS_NetworkGetHostName_Impl, (char *host_name, size_t name_len)) int32 OS_NetworkGetID_Impl(int32 *IdBuf) { diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-queue-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-queue-impl-stubs.c index 306733f5b..222204017 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-queue-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-queue-impl-stubs.c @@ -38,8 +38,8 @@ ** Message Queue API */ -UT_DEFAULT_STUB(OS_QueueCreate_Impl, (uint32 queue_id, uint32 flags)) -UT_DEFAULT_STUB(OS_QueueDelete_Impl, (uint32 queue_id)) -UT_DEFAULT_STUB(OS_QueueGet_Impl, (uint32 queue_id, void *data, uint32 size, uint32 *size_copied, int32 timeout)) -UT_DEFAULT_STUB(OS_QueuePut_Impl, (uint32 queue_id, const void *data, uint32 size, uint32 flags)) -UT_DEFAULT_STUB(OS_QueueGetInfo_Impl, (uint32 queue_id, OS_queue_prop_t *queue_prop)) +UT_DEFAULT_STUB(OS_QueueCreate_Impl, (osal_index_t queue_id, uint32 flags)) +UT_DEFAULT_STUB(OS_QueueDelete_Impl, (osal_index_t queue_id)) +UT_DEFAULT_STUB(OS_QueueGet_Impl, (osal_index_t queue_id, void *data, size_t size, size_t *size_copied, int32 timeout)) +UT_DEFAULT_STUB(OS_QueuePut_Impl, (osal_index_t queue_id, const void *data, size_t size, uint32 flags)) +UT_DEFAULT_STUB(OS_QueueGetInfo_Impl, (osal_index_t queue_id, OS_queue_prop_t *queue_prop)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-select-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-select-impl-stubs.c index f30e43840..1e3d84f25 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-select-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-select-impl-stubs.c @@ -33,5 +33,5 @@ #include "utstubs.h" #include "os-shared-select.h" -UT_DEFAULT_STUB(OS_SelectSingle_Impl, (uint32 stream_id, uint32 *SelectFlags, int32 msecs)) +UT_DEFAULT_STUB(OS_SelectSingle_Impl, (osal_index_t stream_id, uint32 *SelectFlags, int32 msecs)) UT_DEFAULT_STUB(OS_SelectMultiple_Impl, (OS_FdSet * ReadSet, OS_FdSet *WriteSet, int32 msecs)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-task-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-task-impl-stubs.c index 76acb04f9..56ad1c2ff 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-task-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-task-impl-stubs.c @@ -37,16 +37,16 @@ /* ** Task API */ -UT_DEFAULT_STUB(OS_TaskMatch_Impl, (uint32 task_id)) -UT_DEFAULT_STUB(OS_TaskCreate_Impl, (uint32 task_id, uint32 flags)) -UT_DEFAULT_STUB(OS_TaskDelete_Impl, (uint32 task_id)) +UT_DEFAULT_STUB(OS_TaskMatch_Impl, (osal_index_t task_id)) +UT_DEFAULT_STUB(OS_TaskCreate_Impl, (osal_index_t task_id, uint32 flags)) +UT_DEFAULT_STUB(OS_TaskDelete_Impl, (osal_index_t task_id)) void OS_TaskExit_Impl(void) { UT_DEFAULT_IMPL(OS_TaskExit_Impl); } UT_DEFAULT_STUB(OS_TaskDelay_Impl, (uint32 millisecond)) -UT_DEFAULT_STUB(OS_TaskSetPriority_Impl, (uint32 task_id, uint32 new_priority)) +UT_DEFAULT_STUB(OS_TaskSetPriority_Impl, (osal_index_t task_id, osal_priority_t new_priority)) osal_id_t OS_TaskGetId_Impl(void) { int32 status; @@ -60,12 +60,12 @@ osal_id_t OS_TaskGetId_Impl(void) return id; } -UT_DEFAULT_STUB(OS_TaskGetInfo_Impl, (uint32 task_id, OS_task_prop_t *task_prop)) +UT_DEFAULT_STUB(OS_TaskGetInfo_Impl, (osal_index_t task_id, OS_task_prop_t *task_prop)) UT_DEFAULT_STUB(OS_TaskRegister_Impl, (osal_id_t global_task_id)) -bool OS_TaskIdMatchSystemData_Impl(void *ref, uint32 local_id, const OS_common_record_t *obj) +bool OS_TaskIdMatchSystemData_Impl(void *ref, osal_index_t local_id, const OS_common_record_t *obj) { return UT_DEFAULT_IMPL(OS_TaskIdMatchSystemData_Impl); } -UT_DEFAULT_STUB(OS_TaskValidateSystemData_Impl, (const void *sysdata, uint32 sysdata_size)) +UT_DEFAULT_STUB(OS_TaskValidateSystemData_Impl, (const void *sysdata, size_t sysdata_size)) diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-timer-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-timer-impl-stubs.c index 5d7e89fe6..31a28c24c 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-timer-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-timer-impl-stubs.c @@ -37,22 +37,22 @@ /* ** OS Time/Tick related API */ -UT_DEFAULT_STUB(OS_TimeBaseCreate_Impl, (uint32 timer_id)) -UT_DEFAULT_STUB(OS_TimeBaseSet_Impl, (uint32 timer_id, int32 start_time, int32 interval_time)) -UT_DEFAULT_STUB(OS_TimeBaseDelete_Impl, (uint32 timer_id)) -void OS_TimeBaseLock_Impl(uint32 timebase_id) +UT_DEFAULT_STUB(OS_TimeBaseCreate_Impl, (osal_index_t timer_id)) +UT_DEFAULT_STUB(OS_TimeBaseSet_Impl, (osal_index_t timer_id, int32 start_time, int32 interval_time)) +UT_DEFAULT_STUB(OS_TimeBaseDelete_Impl, (osal_index_t timer_id)) +void OS_TimeBaseLock_Impl(osal_index_t timebase_id) { UT_DEFAULT_IMPL(OS_TimeBaseLock_Impl); } -void OS_TimeBaseUnlock_Impl(uint32 timebase_id) +void OS_TimeBaseUnlock_Impl(osal_index_t timebase_id) { UT_DEFAULT_IMPL(OS_TimeBaseUnlock_Impl); } -UT_DEFAULT_STUB(OS_TimeBaseGetInfo_Impl, (uint32 timer_id, OS_timebase_prop_t *timer_prop)) +UT_DEFAULT_STUB(OS_TimeBaseGetInfo_Impl, (osal_index_t timer_id, OS_timebase_prop_t *timer_prop)) -UT_DEFAULT_STUB(OS_TimeBaseRegister_Impl, (uint32 timebase_id)) +UT_DEFAULT_STUB(OS_TimeBaseRegister_Impl, (osal_index_t timebase_id)) /* * Clock API low-level handlers */ diff --git a/src/unit-test-coverage/ut-stubs/src/portable-console-bsp-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/portable-console-bsp-impl-stubs.c index 58778d7f0..c4fdbee58 100644 --- a/src/unit-test-coverage/ut-stubs/src/portable-console-bsp-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/portable-console-bsp-impl-stubs.c @@ -37,7 +37,7 @@ /* ** Console output API (printf) */ -void OS_ConsoleOutput_Impl(uint32 local_id) +void OS_ConsoleOutput_Impl(osal_index_t local_id) { UT_DEFAULT_IMPL(OS_ConsoleOutput_Impl); } diff --git a/src/unit-test-coverage/ut-stubs/src/posix-unistd-stubs.c b/src/unit-test-coverage/ut-stubs/src/posix-unistd-stubs.c index 20cff601a..b23a44845 100644 --- a/src/unit-test-coverage/ut-stubs/src/posix-unistd-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/posix-unistd-stubs.c @@ -99,7 +99,7 @@ OCS_off_t OCS_lseek(int fd, OCS_off_t offset, int whence) OCS_ssize_t OCS_read(int fd, void *buf, size_t n) { int32 Status; - uint32 CopySize; + size_t CopySize; Status = UT_DEFAULT_IMPL_RC(OCS_read, OCS_MAX_RDWR_SIZE); @@ -159,7 +159,7 @@ long int OCS_sysconf(int name) OCS_ssize_t OCS_write(int fd, const void *buf, size_t n) { int32 Status; - uint32 CopySize; + size_t CopySize; Status = UT_DEFAULT_IMPL_RC(OCS_write, OCS_MAX_RDWR_SIZE); diff --git a/src/unit-test-coverage/ut-stubs/src/vxworks-intLib-stubs.c b/src/unit-test-coverage/ut-stubs/src/vxworks-intLib-stubs.c index d72d25a91..61499b1a3 100644 --- a/src/unit-test-coverage/ut-stubs/src/vxworks-intLib-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/vxworks-intLib-stubs.c @@ -53,7 +53,7 @@ OCS_VOIDFUNCPTR *OCS_INUM_TO_IVEC(unsigned int ui) int32 Status = UT_DEFAULT_IMPL(OCS_INUM_TO_IVEC); OCS_VOIDFUNCPTR *VecTbl; OCS_VOIDFUNCPTR DummyVec; - uint32 VecTblSize; + size_t VecTblSize; if (Status == 0) { diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-console.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-console.h index 72dec2e7a..09e32d736 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-console.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-console.h @@ -42,6 +42,6 @@ extern void UT_ConsoleTest_TaskEntry(int arg); /** * Force the "is_async" field to a given state for coverage testing */ -extern void UT_ConsoleTest_SetConsoleAsync(uint32 local_id, bool is_async); +extern void UT_ConsoleTest_SetConsoleAsync(osal_index_t local_id, bool is_async); #endif /* INCLUDE_UT_ADAPTOR_CONSOLE_H_ */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-files.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-files.h index 23ddfad9d..949902ff8 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-files.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-files.h @@ -53,6 +53,6 @@ extern int32 UT_Call_OS_VxWorks_StreamAPI_Impl_Init(void); unsigned int UT_FileTest_GetSelfEUID(void); unsigned int UT_FileTest_GetSelfEGID(void); -void UT_FileTest_Set_Selectable(uint32 local_id, bool is_selectable); +void UT_FileTest_Set_Selectable(osal_index_t local_id, bool is_selectable); #endif /* INCLUDE_UT_ADAPTOR_FILES_H_ */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-filesys.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-filesys.h index 8049ee0d9..8bba10b82 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-filesys.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-filesys.h @@ -34,6 +34,6 @@ extern void *const UT_Ref_OS_impl_filesys_table; extern size_t const UT_Ref_OS_impl_filesys_table_SIZE; -void UT_FileSysTest_SetupFileSysEntry(uint32 id, OCS_BLK_DEV *blkdev, OCS_device_t xbddev, uint32 MaxParts); +void UT_FileSysTest_SetupFileSysEntry(osal_index_t id, OCS_BLK_DEV *blkdev, OCS_device_t xbddev, uint32 MaxParts); #endif /* INCLUDE_UT_ADAPTOR_FILESYS_H_ */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-idmap.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-idmap.h index cd8b50127..53e158e1e 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-idmap.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-idmap.h @@ -39,7 +39,7 @@ * but are not part of the implementation API. * *****************************************************/ -int32 UT_Call_OS_VxWorks_TableMutex_Init(uint32 idtype); -void UT_IdMapTest_SetImplTableMutex(uint32 idtype, OCS_SEM_ID vxid); +int32 UT_Call_OS_VxWorks_TableMutex_Init(osal_objtype_t idtype); +void UT_IdMapTest_SetImplTableMutex(osal_objtype_t idtype, OCS_SEM_ID vxid); #endif /* INCLUDE_UT_ADAPTOR_IDMAP_H_ */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-symtab.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-symtab.h index b29ec05c4..a234335fe 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-symtab.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-symtab.h @@ -30,6 +30,6 @@ #include -int32 UT_SymTabTest_CallIteratorFunc(const char *name, void *val, uint32 TestSize, uint32 SizeLimit); +int32 UT_SymTabTest_CallIteratorFunc(const char *name, void *val, size_t TestSize, size_t SizeLimit); #endif /* INCLUDE_UT_ADAPTOR_SYMTAB_H_ */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-tasks.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-tasks.h index d2b3a44bc..e63fc68a6 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-tasks.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-tasks.h @@ -44,8 +44,8 @@ extern size_t const UT_Ref_OS_impl_task_table_SIZE; *****************************************************/ int32 UT_Call_OS_VxWorks_TaskAPI_Impl_Init(void); -void UT_TaskTest_SetImplTaskId(uint32 local_id, OCS_TASK_ID TaskId); +void UT_TaskTest_SetImplTaskId(osal_index_t local_id, OCS_TASK_ID TaskId); int UT_TaskTest_CallEntryPoint(int arg); -OCS_WIND_TCB *UT_TaskTest_GetTaskTcb(uint32 local_id); +OCS_WIND_TCB *UT_TaskTest_GetTaskTcb(osal_index_t local_id); #endif /* INCLUDE_UT_ADAPTOR_TASKS_H_ */ diff --git a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-timebase.h b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-timebase.h index 19cac7f67..6bb020cfd 100644 --- a/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-timebase.h +++ b/src/unit-test-coverage/vxworks/adaptors/inc/ut-adaptor-timebase.h @@ -37,27 +37,27 @@ extern size_t const UT_Ref_OS_impl_timebase_table_SIZE; int32 UT_Call_OS_VxWorks_TimeBaseAPI_Impl_Init(void); -void UT_TimeBaseTest_Setup(uint32 local_id, int signo, bool reset_flag); +void UT_TimeBaseTest_Setup(osal_index_t local_id, int signo, bool reset_flag); /** * Invokes OS_VxWorks_SigWait() with the given arguments. * This is normally a static function but exposed via a non-static wrapper for UT purposes. */ -int32 UT_TimeBaseTest_CallSigWaitFunc(uint32 local_id); +int32 UT_TimeBaseTest_CallSigWaitFunc(osal_index_t local_id); /* Invokes the static OS_VxWorks_TimeBaseTask() function with given argument */ int UT_TimeBaseTest_CallHelperTaskFunc(int arg); /* Invokes the static OS_VxWorks_RegisterTimer() function with given argument */ -void UT_TimeBaseTest_CallRegisterTimer(uint32 local_id); +void UT_TimeBaseTest_CallRegisterTimer(osal_index_t local_id); /* Hook functions which set the timer registration state */ -void UT_TimeBaseTest_SetTimeBaseRegState(uint32 local_id, bool is_success); -void UT_TimeBaseTest_ClearTimeBaseRegState(uint32 local_id); +void UT_TimeBaseTest_SetTimeBaseRegState(osal_index_t local_id, bool is_success); +void UT_TimeBaseTest_ClearTimeBaseRegState(osal_index_t local_id); /* Hook functions which test the timer registration state */ -bool UT_TimeBaseTest_CheckTimeBaseRegisteredState(uint32 local_id); -bool UT_TimeBaseTest_CheckTimeBaseErrorState(uint32 local_id); +bool UT_TimeBaseTest_CheckTimeBaseRegisteredState(osal_index_t local_id); +bool UT_TimeBaseTest_CheckTimeBaseErrorState(osal_index_t local_id); /* Invoke the internal UsecToTimespec API */ void UT_TimeBaseTest_UsecToTimespec(uint32 usecs, struct OCS_timespec *time_spec); diff --git a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-console.c b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-console.c index b0f280feb..8d474d81c 100644 --- a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-console.c +++ b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-console.c @@ -40,7 +40,7 @@ void UT_ConsoleTest_TaskEntry(int arg) OS_VxWorks_ConsoleTask_Entry(arg); } -void UT_ConsoleTest_SetConsoleAsync(uint32 local_id, bool is_async) +void UT_ConsoleTest_SetConsoleAsync(osal_index_t local_id, bool is_async) { OS_impl_console_table[local_id].is_async = is_async; } diff --git a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-files.c b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-files.c index 2cdd8d7c2..017750b9e 100644 --- a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-files.c +++ b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-files.c @@ -53,7 +53,7 @@ unsigned int UT_FileTest_GetSelfEGID(void) return OS_IMPL_SELF_EGID; } -void UT_FileTest_Set_Selectable(uint32 local_id, bool is_selectable) +void UT_FileTest_Set_Selectable(osal_index_t local_id, bool is_selectable) { OS_impl_filehandle_table[local_id].selectable = is_selectable; } diff --git a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-filesys.c b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-filesys.c index 9094de350..0e5331f22 100644 --- a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-filesys.c +++ b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-filesys.c @@ -34,7 +34,7 @@ void *const UT_Ref_OS_impl_filesys_table = OS_impl_filesys_table; size_t const UT_Ref_OS_impl_filesys_table_SIZE = sizeof(OS_impl_filesys_table); -void UT_FileSysTest_SetupFileSysEntry(uint32 id, OCS_BLK_DEV *blkdev, OCS_device_t xbddev, uint32 MaxParts) +void UT_FileSysTest_SetupFileSysEntry(osal_index_t id, OCS_BLK_DEV *blkdev, OCS_device_t xbddev, uint32 MaxParts) { OS_impl_filesys_table[id].blkDev = blkdev; OS_impl_filesys_table[id].xbd = xbddev; diff --git a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-filetable-stub.c b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-filetable-stub.c index 9af7e1383..20af8c951 100644 --- a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-filetable-stub.c +++ b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-filetable-stub.c @@ -31,7 +31,7 @@ #include #include -OS_VxWorks_filehandle_entry_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; +OS_impl_file_internal_record_t OS_impl_filehandle_table[OS_MAX_NUM_OPEN_FILES]; void *const UT_FileTableTest_OS_impl_filehandle_table = OS_impl_filehandle_table; size_t const UT_FileTableTest_OS_impl_filehandle_table_SIZE = sizeof(OS_impl_filehandle_table); diff --git a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-idmap.c b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-idmap.c index f4053559b..4b4440eb7 100644 --- a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-idmap.c +++ b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-idmap.c @@ -32,12 +32,12 @@ #include #include "ut-adaptor-idmap.h" -int32 UT_Call_OS_VxWorks_TableMutex_Init(uint32 idtype) +int32 UT_Call_OS_VxWorks_TableMutex_Init(osal_objtype_t idtype) { return OS_VxWorks_TableMutex_Init(idtype); } -void UT_IdMapTest_SetImplTableMutex(uint32 idtype, OCS_SEM_ID vxid) +void UT_IdMapTest_SetImplTableMutex(osal_objtype_t idtype, OCS_SEM_ID vxid) { VX_MUTEX_TABLE[idtype].vxid = vxid; } diff --git a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-symtab.c b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-symtab.c index 61e5a37a7..5cdbb8d10 100644 --- a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-symtab.c +++ b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-symtab.c @@ -36,7 +36,7 @@ * A UT-specific wrapper function to invoke the Symbol Table Iterator. * This is normally static so it needs this wrapper to call it. */ -int32 UT_SymTabTest_CallIteratorFunc(const char *name, void *val, uint32 TestSize, uint32 SizeLimit) +int32 UT_SymTabTest_CallIteratorFunc(const char *name, void *val, size_t TestSize, size_t SizeLimit) { OS_VxWorks_SymbolDumpState.Sizelimit = SizeLimit; OS_VxWorks_SymbolDumpState.CurrSize = TestSize; diff --git a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-tasks.c b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-tasks.c index 10f06f39e..2b2d19edf 100644 --- a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-tasks.c +++ b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-tasks.c @@ -40,7 +40,7 @@ int32 UT_Call_OS_VxWorks_TaskAPI_Impl_Init(void) return OS_VxWorks_TaskAPI_Impl_Init(); } -void UT_TaskTest_SetImplTaskId(uint32 local_id, OCS_TASK_ID TaskId) +void UT_TaskTest_SetImplTaskId(osal_index_t local_id, OCS_TASK_ID TaskId) { OS_impl_task_table[local_id].vxid = TaskId; } @@ -55,7 +55,7 @@ int UT_TaskTest_CallEntryPoint(int arg) return OS_VxWorks_TaskEntry(arg); } -OCS_WIND_TCB *UT_TaskTest_GetTaskTcb(uint32 local_id) +OCS_WIND_TCB *UT_TaskTest_GetTaskTcb(osal_index_t local_id) { return &OS_impl_task_table[local_id].tcb; } diff --git a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-timebase.c b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-timebase.c index 0806059b8..0ec0b7a2b 100644 --- a/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-timebase.c +++ b/src/unit-test-coverage/vxworks/adaptors/src/ut-adaptor-timebase.c @@ -40,7 +40,7 @@ int32 UT_Call_OS_VxWorks_TimeBaseAPI_Impl_Init(void) return OS_VxWorks_TimeBaseAPI_Impl_Init(); } -int32 UT_TimeBaseTest_CallSigWaitFunc(uint32 local_id) +int32 UT_TimeBaseTest_CallSigWaitFunc(osal_index_t local_id) { return OS_VxWorks_SigWait(local_id); } @@ -50,27 +50,27 @@ int UT_TimeBaseTest_CallHelperTaskFunc(int arg) return OS_VxWorks_TimeBaseTask(arg); } -void UT_TimeBaseTest_CallRegisterTimer(uint32 local_id) +void UT_TimeBaseTest_CallRegisterTimer(osal_index_t local_id) { OS_VxWorks_RegisterTimer(local_id); } -bool UT_TimeBaseTest_CheckTimeBaseRegisteredState(uint32 local_id) +bool UT_TimeBaseTest_CheckTimeBaseRegisteredState(osal_index_t local_id) { return (OS_impl_timebase_table[local_id].timer_state == OS_TimerRegState_SUCCESS); } -bool UT_TimeBaseTest_CheckTimeBaseErrorState(uint32 local_id) +bool UT_TimeBaseTest_CheckTimeBaseErrorState(osal_index_t local_id) { return (OS_impl_timebase_table[local_id].timer_state == OS_TimerRegState_ERROR); } -void UT_TimeBaseTest_ClearTimeBaseRegState(uint32 local_id) +void UT_TimeBaseTest_ClearTimeBaseRegState(osal_index_t local_id) { OS_impl_timebase_table[local_id].timer_state = OS_TimerRegState_INIT; } -void UT_TimeBaseTest_SetTimeBaseRegState(uint32 local_id, bool is_success) +void UT_TimeBaseTest_SetTimeBaseRegState(osal_index_t local_id, bool is_success) { /* Mimic the setting of the Reg state global, which * is typically done by the task after spawning @@ -90,7 +90,7 @@ void UT_TimeBaseTest_UsecToTimespec(uint32 usecs, struct OCS_timespec *time_spec OS_VxWorks_UsecToTimespec(usecs, time_spec); } -void UT_TimeBaseTest_Setup(uint32 local_id, int signo, bool reset_flag) +void UT_TimeBaseTest_Setup(osal_index_t local_id, int signo, bool reset_flag) { static OCS_WIND_TCB FAKE_TASK; static OCS_SEM FAKE_SEM; diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-binsem.c b/src/unit-test-coverage/vxworks/src/coveragetest-binsem.c index 931f7f37d..646205e51 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-binsem.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-binsem.c @@ -50,10 +50,10 @@ void Test_OS_BinSemCreate_Impl(void) * Test Case For: * int32 OS_BinSemCreate_Impl (uint32 sem_id, uint32 initial_value, uint32 options) */ - OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate_Impl(0, 0, 0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate_Impl(UT_INDEX_0, 0, 0), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_semBInitialize), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate_Impl(0, 0, 0), OS_SEM_FAILURE); + OSAPI_TEST_FUNCTION_RC(OS_BinSemCreate_Impl(UT_INDEX_0, 0, 0), OS_SEM_FAILURE); } void Test_OS_BinSemDelete_Impl(void) @@ -62,7 +62,7 @@ void Test_OS_BinSemDelete_Impl(void) * Test Case For: * int32 OS_BinSemDelete_Impl (uint32 sem_id) */ - OSAPI_TEST_FUNCTION_RC(OS_BinSemDelete_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_BinSemDelete_Impl(UT_INDEX_0), OS_SUCCESS); } void Test_OS_BinSemGive_Impl(void) @@ -71,10 +71,10 @@ void Test_OS_BinSemGive_Impl(void) * Test Case For: * int32 OS_BinSemGive_Impl ( uint32 sem_id ) */ - OSAPI_TEST_FUNCTION_RC(OS_BinSemGive_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_BinSemGive_Impl(UT_INDEX_0), OS_SUCCESS); UT_SetForceFail(UT_StubKey_GenericSemGive, OS_SEM_FAILURE); - OSAPI_TEST_FUNCTION_RC(OS_BinSemGive_Impl(0), OS_SEM_FAILURE); + OSAPI_TEST_FUNCTION_RC(OS_BinSemGive_Impl(UT_INDEX_0), OS_SEM_FAILURE); } void Test_OS_BinSemFlush_Impl(void) @@ -83,10 +83,10 @@ void Test_OS_BinSemFlush_Impl(void) * Test Case For: * int32 OS_BinSemFlush_Impl (uint32 sem_id) */ - OSAPI_TEST_FUNCTION_RC(OS_BinSemFlush_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_BinSemFlush_Impl(UT_INDEX_0), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_semFlush), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_BinSemFlush_Impl(0), OS_SEM_FAILURE); + OSAPI_TEST_FUNCTION_RC(OS_BinSemFlush_Impl(UT_INDEX_0), OS_SEM_FAILURE); } void Test_OS_BinSemTake_Impl(void) @@ -95,7 +95,7 @@ void Test_OS_BinSemTake_Impl(void) * Test Case For: * int32 OS_BinSemTake_Impl ( uint32 sem_id ) */ - OSAPI_TEST_FUNCTION_RC(OS_BinSemTake_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_BinSemTake_Impl(UT_INDEX_0), OS_SUCCESS); } void Test_OS_BinSemTimedWait_Impl(void) @@ -104,13 +104,13 @@ void Test_OS_BinSemTimedWait_Impl(void) * Test Case For: * int32 OS_BinSemTimedWait_Impl ( uint32 sem_id, uint32 msecs ) */ - OSAPI_TEST_FUNCTION_RC(OS_BinSemTimedWait_Impl(0, 100), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_BinSemTimedWait_Impl(UT_INDEX_0, 100), OS_SUCCESS); UT_SetForceFail(UT_StubKey_GenericSemTake, OS_SEM_FAILURE); - OSAPI_TEST_FUNCTION_RC(OS_BinSemTimedWait_Impl(0, 100), OS_SEM_FAILURE); + OSAPI_TEST_FUNCTION_RC(OS_BinSemTimedWait_Impl(UT_INDEX_0, 100), OS_SEM_FAILURE); UT_SetForceFail(UT_KEY(OS_Milli2Ticks), OS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_BinSemTimedWait_Impl(0, 100), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_BinSemTimedWait_Impl(UT_INDEX_0, 100), OS_ERROR); } void Test_OS_BinSemGetInfo_Impl(void) @@ -121,7 +121,7 @@ void Test_OS_BinSemGetInfo_Impl(void) */ OS_bin_sem_prop_t sem_prop; memset(&sem_prop, 0xEE, sizeof(sem_prop)); - OSAPI_TEST_FUNCTION_RC(OS_BinSemGetInfo_Impl(0, &sem_prop), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_BinSemGetInfo_Impl(UT_INDEX_0, &sem_prop), OS_SUCCESS); } /* ------------------- End of test cases --------------------------------------*/ diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-countsem.c b/src/unit-test-coverage/vxworks/src/coveragetest-countsem.c index f29a015c4..77e3e5a81 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-countsem.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-countsem.c @@ -46,10 +46,10 @@ void Test_OS_CountSemCreate_Impl(void) * Test Case For: * int32 OS_CountSemCreate_Impl (uint32 sem_id, uint32 sem_initial_value, uint32 options) */ - OSAPI_TEST_FUNCTION_RC(OS_CountSemCreate_Impl(0, 0, 0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_CountSemCreate_Impl(UT_INDEX_0, 0, 0), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_semCInitialize), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_CountSemCreate_Impl(0, 0, 0), OS_SEM_FAILURE); + OSAPI_TEST_FUNCTION_RC(OS_CountSemCreate_Impl(UT_INDEX_0, 0, 0), OS_SEM_FAILURE); } void Test_OS_CountSemDelete_Impl(void) @@ -58,7 +58,7 @@ void Test_OS_CountSemDelete_Impl(void) * Test Case For: * int32 OS_CountSemDelete_Impl (uint32 sem_id) */ - OSAPI_TEST_FUNCTION_RC(OS_CountSemDelete_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_CountSemDelete_Impl(UT_INDEX_0), OS_SUCCESS); } void Test_OS_CountSemGive_Impl(void) @@ -67,7 +67,7 @@ void Test_OS_CountSemGive_Impl(void) * Test Case For: * int32 OS_CountSemGive_Impl ( uint32 sem_id ) */ - OSAPI_TEST_FUNCTION_RC(OS_CountSemGive_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_CountSemGive_Impl(UT_INDEX_0), OS_SUCCESS); } void Test_OS_CountSemTake_Impl(void) @@ -76,7 +76,7 @@ void Test_OS_CountSemTake_Impl(void) * Test Case For: * int32 OS_CountSemTake_Impl ( uint32 sem_id ) */ - OSAPI_TEST_FUNCTION_RC(OS_CountSemTake_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_CountSemTake_Impl(UT_INDEX_0), OS_SUCCESS); } void Test_OS_CountSemTimedWait_Impl(void) @@ -85,10 +85,10 @@ void Test_OS_CountSemTimedWait_Impl(void) * Test Case For: * int32 OS_CountSemTimedWait_Impl ( uint32 sem_id, uint32 msecs ) */ - OSAPI_TEST_FUNCTION_RC(OS_CountSemTimedWait_Impl(0, 100), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_CountSemTimedWait_Impl(UT_INDEX_0, 100), OS_SUCCESS); UT_SetForceFail(UT_KEY(OS_Milli2Ticks), OS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_CountSemTimedWait_Impl(0, 100), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_CountSemTimedWait_Impl(UT_INDEX_0, 100), OS_ERROR); } void Test_OS_CountSemGetInfo_Impl(void) @@ -99,7 +99,7 @@ void Test_OS_CountSemGetInfo_Impl(void) */ OS_count_sem_prop_t count_prop; memset(&count_prop, 0xEE, sizeof(count_prop)); - OSAPI_TEST_FUNCTION_RC(OS_CountSemGetInfo_Impl(0, &count_prop), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_CountSemGetInfo_Impl(UT_INDEX_0, &count_prop), OS_SUCCESS); } /* ------------------- End of test cases --------------------------------------*/ diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-dirs.c b/src/unit-test-coverage/vxworks/src/coveragetest-dirs.c index f896cb598..62c981df6 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-dirs.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-dirs.c @@ -63,9 +63,9 @@ void Test_OS_DirOpen_Impl(void) * Test Case For: * int32 OS_DirOpen_Impl(uint32 local_id, const char *local_path) */ - OSAPI_TEST_FUNCTION_RC(OS_DirOpen_Impl(0, "dir"), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_DirOpen_Impl(UT_INDEX_0, "dir"), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_opendir), -1); - OSAPI_TEST_FUNCTION_RC(OS_DirOpen_Impl(0, "dir"), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_DirOpen_Impl(UT_INDEX_0, "dir"), OS_ERROR); } void Test_OS_DirClose_Impl(void) @@ -74,7 +74,7 @@ void Test_OS_DirClose_Impl(void) * Test Case For: * int32 OS_DirClose_Impl(uint32 local_id) */ - OSAPI_TEST_FUNCTION_RC(OS_DirClose_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_DirClose_Impl(UT_INDEX_0), OS_SUCCESS); } void Test_OS_DirRead_Impl(void) @@ -85,10 +85,10 @@ void Test_OS_DirRead_Impl(void) */ os_dirent_t dirent_buff; - OSAPI_TEST_FUNCTION_RC(OS_DirRead_Impl(0, &dirent_buff), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_DirRead_Impl(UT_INDEX_0, &dirent_buff), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_readdir), -1); - OSAPI_TEST_FUNCTION_RC(OS_DirRead_Impl(0, &dirent_buff), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_DirRead_Impl(UT_INDEX_0, &dirent_buff), OS_ERROR); } void Test_OS_DirRewind_Impl(void) @@ -97,7 +97,7 @@ void Test_OS_DirRewind_Impl(void) * Test Case For: * int32 OS_DirRewind_Impl(uint32 local_id) */ - OSAPI_TEST_FUNCTION_RC(OS_DirRewind_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_DirRewind_Impl(UT_INDEX_0), OS_SUCCESS); } void Test_OS_DirRemove_Impl(void) diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-loader.c b/src/unit-test-coverage/vxworks/src/coveragetest-loader.c index 4fede680c..c22d56229 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-loader.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-loader.c @@ -50,12 +50,12 @@ void Test_OS_ModuleLoad_Impl(void) /* Test Case For: * int32 OS_ModuleLoad_Impl ( uint32 module_id, char *translated_path ) */ - OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(0, "local"), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(UT_INDEX_0, "local"), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_open), -1); - OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(0, "local"), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(UT_INDEX_0, "local"), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_open)); UT_SetForceFail(UT_KEY(OCS_loadModule), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(0, "local"), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_ModuleLoad_Impl(UT_INDEX_0, "local"), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_loadModule)); } @@ -64,9 +64,9 @@ void Test_OS_ModuleUnload_Impl(void) /* Test Case For: * int32 OS_ModuleUnload_Impl ( uint32 module_id ) */ - OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl(UT_INDEX_0), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_unldByModuleId), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl(0), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_ModuleUnload_Impl(UT_INDEX_0), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_unldByModuleId)); } @@ -78,7 +78,7 @@ void Test_OS_ModuleGetInfo_Impl(void) OS_module_prop_t module_prop; memset(&module_prop, 0, sizeof(module_prop)); - OSAPI_TEST_FUNCTION_RC(OS_ModuleGetInfo_Impl(0, &module_prop), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_ModuleGetInfo_Impl(UT_INDEX_0, &module_prop), OS_SUCCESS); UtAssert_True(module_prop.addr.valid, "addresses in output valid"); /* @@ -87,7 +87,7 @@ void Test_OS_ModuleGetInfo_Impl(void) */ memset(&module_prop, 0, sizeof(module_prop)); UT_SetForceFail(UT_KEY(OCS_moduleInfoGet), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_ModuleGetInfo_Impl(0, &module_prop), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_ModuleGetInfo_Impl(UT_INDEX_0, &module_prop), OS_SUCCESS); UT_ClearForceFail(UT_KEY(OCS_moduleInfoGet)); UtAssert_True(!module_prop.addr.valid, "addresses in output not valid"); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-mutex.c b/src/unit-test-coverage/vxworks/src/coveragetest-mutex.c index bceac85b3..b9bcf518f 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-mutex.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-mutex.c @@ -43,10 +43,10 @@ void Test_OS_MutSemCreate_Impl(void) * Test Case For: * int32 OS_MutSemCreate_Impl (uint32 sem_id, uint32 options) */ - OSAPI_TEST_FUNCTION_RC(OS_MutSemCreate_Impl(0, 0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_MutSemCreate_Impl(UT_INDEX_0, 0), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_semMInitialize), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_MutSemCreate_Impl(0, 0), OS_SEM_FAILURE); + OSAPI_TEST_FUNCTION_RC(OS_MutSemCreate_Impl(UT_INDEX_0, 0), OS_SEM_FAILURE); } void Test_OS_MutSemDelete_Impl(void) @@ -55,7 +55,7 @@ void Test_OS_MutSemDelete_Impl(void) * Test Case For: * int32 OS_MutSemDelete_Impl (uint32 sem_id) */ - OSAPI_TEST_FUNCTION_RC(OS_MutSemDelete_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_MutSemDelete_Impl(UT_INDEX_0), OS_SUCCESS); } void Test_OS_MutSemGive_Impl(void) @@ -64,7 +64,7 @@ void Test_OS_MutSemGive_Impl(void) * Test Case For: * int32 OS_MutSemGive_Impl ( uint32 sem_id ) */ - OSAPI_TEST_FUNCTION_RC(OS_MutSemGive_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_MutSemGive_Impl(UT_INDEX_0), OS_SUCCESS); } void Test_OS_MutSemTake_Impl(void) @@ -73,7 +73,7 @@ void Test_OS_MutSemTake_Impl(void) * Test Case For: * int32 OS_MutSemTake_Impl ( uint32 sem_id ) */ - OSAPI_TEST_FUNCTION_RC(OS_MutSemTake_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_MutSemTake_Impl(UT_INDEX_0), OS_SUCCESS); } void Test_OS_MutSemGetInfo_Impl(void) @@ -84,7 +84,7 @@ void Test_OS_MutSemGetInfo_Impl(void) */ OS_mut_sem_prop_t mut_prop; memset(&mut_prop, 0xEE, sizeof(mut_prop)); - OSAPI_TEST_FUNCTION_RC(OS_MutSemGetInfo_Impl(0, &mut_prop), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_MutSemGetInfo_Impl(UT_INDEX_0, &mut_prop), OS_SUCCESS); } /* ------------------- End of test cases --------------------------------------*/ diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-queues.c b/src/unit-test-coverage/vxworks/src/coveragetest-queues.c index 7c059a148..3df7923ad 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-queues.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-queues.c @@ -47,10 +47,10 @@ void Test_OS_QueueCreate_Impl(void) * Test Case For: * int32 OS_QueueCreate_Impl (uint32 queue_id, uint32 flags) */ - OSAPI_TEST_FUNCTION_RC(OS_QueueCreate_Impl(0, 0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_QueueCreate_Impl(UT_INDEX_0, 0), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_msgQCreate), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_QueueCreate_Impl(0, 0), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_QueueCreate_Impl(UT_INDEX_0, 0), OS_ERROR); } void Test_OS_QueueDelete_Impl(void) @@ -59,10 +59,10 @@ void Test_OS_QueueDelete_Impl(void) * Test Case For: * int32 OS_QueueDelete_Impl (uint32 queue_id) */ - OSAPI_TEST_FUNCTION_RC(OS_QueueDelete_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_QueueDelete_Impl(UT_INDEX_0), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_msgQDelete), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_QueueDelete_Impl(0), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_QueueDelete_Impl(UT_INDEX_0), OS_ERROR); } void Test_OS_QueueGet_Impl(void) @@ -72,22 +72,22 @@ void Test_OS_QueueGet_Impl(void) * int32 OS_QueueGet_Impl (uint32 queue_id, void *data, uint32 size, uint32 *size_copied, int32 timeout) */ char Data[16]; - uint32 ActSz; + size_t ActSz; - OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(0, &Data, sizeof(Data), &ActSz, OS_PEND), OS_SUCCESS); - OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(0, &Data, sizeof(Data), &ActSz, OS_CHECK), OS_SUCCESS); - OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(0, &Data, sizeof(Data), &ActSz, 100), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(UT_INDEX_0, &Data, sizeof(Data), &ActSz, OS_PEND), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(UT_INDEX_0, &Data, sizeof(Data), &ActSz, OS_CHECK), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(UT_INDEX_0, &Data, sizeof(Data), &ActSz, 100), OS_SUCCESS); UT_SetForceFail(UT_KEY(OS_Milli2Ticks), OS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(0, &Data, sizeof(Data), &ActSz, 100), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(UT_INDEX_0, &Data, sizeof(Data), &ActSz, 100), OS_ERROR); UT_SetForceFail(UT_KEY(OCS_msgQReceive), OCS_ERROR); OCS_errno = OCS_S_objLib_OBJ_TIMEOUT; - OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(0, &Data, sizeof(Data), &ActSz, OS_CHECK), OS_QUEUE_TIMEOUT); + OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(UT_INDEX_0, &Data, sizeof(Data), &ActSz, OS_CHECK), OS_QUEUE_TIMEOUT); OCS_errno = OCS_S_objLib_OBJ_UNAVAILABLE; - OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(0, &Data, sizeof(Data), &ActSz, OS_CHECK), OS_QUEUE_EMPTY); + OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(UT_INDEX_0, &Data, sizeof(Data), &ActSz, OS_CHECK), OS_QUEUE_EMPTY); OCS_errno = 0; - OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(0, &Data, sizeof(Data), &ActSz, OS_CHECK), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_QueueGet_Impl(UT_INDEX_0, &Data, sizeof(Data), &ActSz, OS_CHECK), OS_ERROR); } void Test_OS_QueuePut_Impl(void) @@ -97,13 +97,13 @@ void Test_OS_QueuePut_Impl(void) * int32 OS_QueuePut_Impl (uint32 queue_id, const void *data, uint32 size, uint32 flags) */ char Data[16] = "Test"; - OSAPI_TEST_FUNCTION_RC(OS_QueuePut_Impl(0, Data, sizeof(Data), 0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_QueuePut_Impl(UT_INDEX_0, Data, sizeof(Data), 0), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_msgQSend), OCS_ERROR); OCS_errno = OCS_S_objLib_OBJ_UNAVAILABLE; - OSAPI_TEST_FUNCTION_RC(OS_QueuePut_Impl(0, Data, sizeof(Data), 0), OS_QUEUE_FULL); + OSAPI_TEST_FUNCTION_RC(OS_QueuePut_Impl(UT_INDEX_0, Data, sizeof(Data), 0), OS_QUEUE_FULL); OCS_errno = 0; - OSAPI_TEST_FUNCTION_RC(OS_QueuePut_Impl(0, Data, sizeof(Data), 0), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_QueuePut_Impl(UT_INDEX_0, Data, sizeof(Data), 0), OS_ERROR); } void Test_OS_QueueGetInfo_Impl(void) @@ -114,7 +114,7 @@ void Test_OS_QueueGetInfo_Impl(void) */ OS_queue_prop_t queue_prop; memset(&queue_prop, 0xEE, sizeof(queue_prop)); - OSAPI_TEST_FUNCTION_RC(OS_QueueGetInfo_Impl(0, &queue_prop), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_QueueGetInfo_Impl(UT_INDEX_0, &queue_prop), OS_SUCCESS); } /* ------------------- End of test cases --------------------------------------*/ diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-shell.c b/src/unit-test-coverage/vxworks/src/coveragetest-shell.c index af2897453..f60a15d07 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-shell.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-shell.c @@ -47,7 +47,7 @@ void Test_OS_ShellOutputToFile_Impl(void) */ UT_SetDeferredRetcode(UT_KEY(OCS_taskNameToId), 2, -1); - actual = OS_ShellOutputToFile_Impl(0, "TestCmd"); + actual = OS_ShellOutputToFile_Impl(UT_INDEX_0, "TestCmd"); UtAssert_True(actual == expected, "OS_ShellOutputToFile_Impl() (%ld) == OS_SUCCESS", (long)actual); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_shellGenericInit)) == 1, "shellGenericInit() called"); @@ -55,7 +55,7 @@ void Test_OS_ShellOutputToFile_Impl(void) /* failure to open the output file */ UT_SetForceFail(UT_KEY(OS_OpenCreate), OS_ERROR); expected = OS_ERROR; - actual = OS_ShellOutputToFile_Impl(0, "TestCmd"); + actual = OS_ShellOutputToFile_Impl(UT_INDEX_0, "TestCmd"); UtAssert_True(actual == expected, "OS_ShellOutputToFile_Impl() (%ld) == OS_ERROR", (long)actual); } diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c b/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c index b2f107f08..af92067f8 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c @@ -54,10 +54,10 @@ void Test_OS_ModuleSymbolLookup_Impl(void) */ cpuaddr SymAddr; - OSAPI_TEST_FUNCTION_RC(OS_ModuleSymbolLookup_Impl(0, &SymAddr, "symname"), OS_SUCCESS); - OSAPI_TEST_FUNCTION_RC(OS_ModuleSymbolLookup_Impl(0, NULL, NULL), OS_INVALID_POINTER); + OSAPI_TEST_FUNCTION_RC(OS_ModuleSymbolLookup_Impl(UT_INDEX_0, &SymAddr, "symname"), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_ModuleSymbolLookup_Impl(UT_INDEX_0, NULL, NULL), OS_INVALID_POINTER); UT_SetForceFail(UT_KEY(OCS_symFind), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_ModuleSymbolLookup_Impl(0, &SymAddr, "symname"), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_ModuleSymbolLookup_Impl(UT_INDEX_0, &SymAddr, "symname"), OS_ERROR); } void Test_OS_SymTableIterator_Impl(void) diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c b/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c index 0fd7b96ab..f67a8822e 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-tasks.c @@ -71,10 +71,10 @@ void Test_OS_TaskCreate_Impl(void) * The first call checks the failure path and ensures that a malloc failure gets handled */ OS_task_table[0].stack_size = 250; UT_SetForceFail(UT_KEY(OCS_malloc), OS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(0, 0), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(UT_INDEX_0, 0), OS_ERROR); UT_ClearForceFail(UT_KEY(OCS_malloc)); - OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(0, OS_FP_ENABLED), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(UT_INDEX_0, OS_FP_ENABLED), OS_SUCCESS); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_malloc)) == 2, "malloc() called"); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_free)) == 0, "free() not called"); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_taskInit)) == 1, "taskInit() called"); @@ -82,7 +82,7 @@ void Test_OS_TaskCreate_Impl(void) /* create again with smaller stack - this should re-use existing buffer */ OS_task_table[0].stack_size = 100; - OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(0, OS_FP_ENABLED), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(UT_INDEX_0, OS_FP_ENABLED), OS_SUCCESS); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_malloc)) == 2, "malloc() not called"); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_free)) == 0, "free() not called"); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_taskInit)) == 2, "taskInit() called"); @@ -90,7 +90,7 @@ void Test_OS_TaskCreate_Impl(void) /* create again with larger stack - this should free existing and malloc() new buffer */ OS_task_table[0].stack_size = 400; - OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(0, OS_FP_ENABLED), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(UT_INDEX_0, OS_FP_ENABLED), OS_SUCCESS); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_malloc)) == 3, "malloc() called"); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_free)) == 1, "free() called"); UtAssert_True(UT_GetStubCount(UT_KEY(OCS_taskInit)) == 3, "taskInit() called"); @@ -98,7 +98,7 @@ void Test_OS_TaskCreate_Impl(void) /* other failure modes */ UT_SetForceFail(UT_KEY(OCS_taskInit), -1); - OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(0, 0), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_TaskCreate_Impl(UT_INDEX_0, 0), OS_ERROR); } void Test_OS_TaskMatch_Impl(void) @@ -107,10 +107,10 @@ void Test_OS_TaskMatch_Impl(void) * Test Case For: * int32 OS_TaskMatch_Impl(uint32 task_id) */ - UT_TaskTest_SetImplTaskId(0, OCS_taskIdSelf()); - OSAPI_TEST_FUNCTION_RC(OS_TaskMatch_Impl(0), OS_SUCCESS); - UT_TaskTest_SetImplTaskId(0, (OCS_TASK_ID)0); - OSAPI_TEST_FUNCTION_RC(OS_TaskMatch_Impl(0), OS_ERROR); + UT_TaskTest_SetImplTaskId(UT_INDEX_0, OCS_taskIdSelf()); + OSAPI_TEST_FUNCTION_RC(OS_TaskMatch_Impl(UT_INDEX_0), OS_SUCCESS); + UT_TaskTest_SetImplTaskId(UT_INDEX_0, (OCS_TASK_ID)0); + OSAPI_TEST_FUNCTION_RC(OS_TaskMatch_Impl(UT_INDEX_0), OS_ERROR); } void Test_OS_TaskDelete_Impl(void) @@ -119,11 +119,11 @@ void Test_OS_TaskDelete_Impl(void) * Test Case For: * int32 OS_TaskDelete_Impl (uint32 task_id) */ - OSAPI_TEST_FUNCTION_RC(OS_TaskDelete_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_TaskDelete_Impl(UT_INDEX_0), OS_SUCCESS); /* failure mode */ UT_SetForceFail(UT_KEY(OCS_taskDelete), -1); - OSAPI_TEST_FUNCTION_RC(OS_TaskDelete_Impl(0), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_TaskDelete_Impl(UT_INDEX_0), OS_ERROR); } void Test_OS_TaskExit_Impl(void) @@ -157,10 +157,10 @@ void Test_OS_TaskSetPriority_Impl(void) * Test Case For: * int32 OS_TaskSetPriority_Impl (uint32 task_id, uint32 new_priority) */ - OSAPI_TEST_FUNCTION_RC(OS_TaskSetPriority_Impl(0, 100), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_TaskSetPriority_Impl(UT_INDEX_0, OSAL_PRIORITY_C(100)), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_taskPrioritySet), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_TaskSetPriority_Impl(0, 100), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_TaskSetPriority_Impl(UT_INDEX_0, OSAL_PRIORITY_C(100)), OS_ERROR); } void Test_OS_TaskRegister_Impl(void) @@ -184,7 +184,7 @@ void Test_OS_TaskGetId_Impl(void) memset(&id1, 0x11, sizeof(osal_id_t)); OS_global_task_table[1].active_id = id1; - TaskTcb = UT_TaskTest_GetTaskTcb(1); + TaskTcb = UT_TaskTest_GetTaskTcb(UT_INDEX_1); UT_SetDataBuffer(UT_KEY(OCS_taskTcb), &TaskTcb, sizeof(TaskTcb), false); id2 = OS_TaskGetId_Impl(); UtAssert_MemCmp(&id1, &id2, sizeof(osal_id_t), "OS_TaskGetId_Impl()"); @@ -198,7 +198,7 @@ void Test_OS_TaskGetInfo_Impl(void) */ OS_task_prop_t task_prop; memset(&task_prop, 0xEE, sizeof(task_prop)); - OSAPI_TEST_FUNCTION_RC(OS_TaskGetInfo_Impl(0, &task_prop), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_TaskGetInfo_Impl(UT_INDEX_0, &task_prop), OS_SUCCESS); } void Test_OS_TaskValidateSystemData_Impl(void) @@ -226,11 +226,11 @@ void Test_OS_TaskIdMatchSystemData_Impl(void) memset(&test_sys_id, 'x', sizeof(test_sys_id)); - UT_TaskTest_SetImplTaskId(0, test_sys_id); - OSAPI_TEST_FUNCTION_RC(OS_TaskIdMatchSystemData_Impl(&test_sys_id, 0, NULL), true); + UT_TaskTest_SetImplTaskId(UT_INDEX_0, test_sys_id); + OSAPI_TEST_FUNCTION_RC(OS_TaskIdMatchSystemData_Impl(&test_sys_id, UT_INDEX_0, NULL), true); memset(&test_sys_id, 'y', sizeof(test_sys_id)); - OSAPI_TEST_FUNCTION_RC(OS_TaskIdMatchSystemData_Impl(&test_sys_id, 0, NULL), false); + OSAPI_TEST_FUNCTION_RC(OS_TaskIdMatchSystemData_Impl(&test_sys_id, UT_INDEX_0, NULL), false); } /* ------------------- End of test cases --------------------------------------*/ diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c b/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c index 92ad9198a..36a747985 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-timebase.c @@ -50,7 +50,7 @@ void Test_OS_TimeBaseLock_Impl(void) /* Test Case For: * void OS_TimeBaseLock_Impl(uint32 local_id) */ - OS_TimeBaseLock_Impl(0); + OS_TimeBaseLock_Impl(UT_INDEX_0); } void Test_OS_TimeBaseUnlock_Impl(void) @@ -58,13 +58,13 @@ void Test_OS_TimeBaseUnlock_Impl(void) /* Test Case For: * void OS_TimeBaseUnlock_Impl(uint32 local_id) */ - OS_TimeBaseUnlock_Impl(0); + OS_TimeBaseUnlock_Impl(UT_INDEX_0); } static int32 UT_TimeBaseTest_TimeBaseRegHook(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { - UT_TimeBaseTest_SetTimeBaseRegState(0, true); + UT_TimeBaseTest_SetTimeBaseRegState(UT_INDEX_0, true); return 0; } @@ -109,19 +109,19 @@ void Test_OS_TimeBaseCreate_Impl(void) */ memset(&id, 0x01, sizeof(id)); OS_global_timebase_table[1].active_id = id; - UT_TimeBaseTest_Setup(1, OCS_SIGRTMIN, false); + UT_TimeBaseTest_Setup(UT_INDEX_1, OCS_SIGRTMIN, false); UT_SetForceFail(UT_KEY(OCS_sigismember), true); - OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(0), OS_TIMER_ERR_UNAVAILABLE); + OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(UT_INDEX_0), OS_TIMER_ERR_UNAVAILABLE); UT_ResetState(UT_KEY(OCS_sigismember)); /* fail to initialize the sem */ UT_SetForceFail(UT_KEY(OCS_semMInitialize), -1); - OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(0), OS_TIMER_ERR_INTERNAL); + OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(UT_INDEX_0), OS_TIMER_ERR_INTERNAL); UT_ClearForceFail(UT_KEY(OCS_semMInitialize)); /* fail to spawn the task */ UT_SetForceFail(UT_KEY(OCS_taskSpawn), -1); - OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(0), OS_TIMER_ERR_INTERNAL); + OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(UT_INDEX_0), OS_TIMER_ERR_INTERNAL); UT_ClearForceFail(UT_KEY(OCS_taskSpawn)); /* @@ -129,7 +129,7 @@ void Test_OS_TimeBaseCreate_Impl(void) * this mimics the situation where the reg global is never * set past OS_TimerRegState_INIT */ - OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(0), OS_TIMER_ERR_INTERNAL); + OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(UT_INDEX_0), OS_TIMER_ERR_INTERNAL); /* * Do Nominal/success case now. @@ -137,7 +137,7 @@ void Test_OS_TimeBaseCreate_Impl(void) * mimic registration success */ UT_SetHookFunction(UT_KEY(OCS_taskSpawn), UT_TimeBaseTest_TimeBaseRegHook, NULL); - OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(0), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_TimeBaseCreate_Impl(UT_INDEX_0), OS_SUCCESS); /* * For coverage, call the OS_VxWorks_TimeBaseTask() function. @@ -147,14 +147,14 @@ void Test_OS_TimeBaseCreate_Impl(void) /* * Check outputs of OS_VxWorks_RegisterTimer() function. */ - UT_TimeBaseTest_ClearTimeBaseRegState(0); - UT_TimeBaseTest_CallRegisterTimer(0); - UtAssert_True(UT_TimeBaseTest_CheckTimeBaseRegisteredState(0), "timer successfully registered"); + UT_TimeBaseTest_ClearTimeBaseRegState(UT_INDEX_0); + UT_TimeBaseTest_CallRegisterTimer(UT_INDEX_0); + UtAssert_True(UT_TimeBaseTest_CheckTimeBaseRegisteredState(UT_INDEX_0), "timer successfully registered"); - UT_TimeBaseTest_ClearTimeBaseRegState(0); + UT_TimeBaseTest_ClearTimeBaseRegState(UT_INDEX_0); UT_SetForceFail(UT_KEY(OCS_timer_create), -1); - UT_TimeBaseTest_CallRegisterTimer(0); - UtAssert_True(UT_TimeBaseTest_CheckTimeBaseErrorState(0), "timer registration failure state"); + UT_TimeBaseTest_CallRegisterTimer(UT_INDEX_0); + UtAssert_True(UT_TimeBaseTest_CheckTimeBaseErrorState(UT_INDEX_0), "timer registration failure state"); } void Test_OS_VxWorks_SigWait(void) @@ -175,17 +175,17 @@ void Test_OS_VxWorks_SigWait(void) memset(&config_value, 0, sizeof(config_value)); UT_SetDataBuffer(UT_KEY(OCS_timer_settime), &config_value, sizeof(config_value), false); UT_SetDataBuffer(UT_KEY(OCS_timer_gettime), &config_value, sizeof(config_value), false); - UT_TimeBaseTest_Setup(0, signo, true); - OS_TimeBaseSet_Impl(0, 1111111, 2222222); + UT_TimeBaseTest_Setup(UT_INDEX_0, signo, true); + OS_TimeBaseSet_Impl(UT_INDEX_0, 1111111, 2222222); UT_SetDataBuffer(UT_KEY(OCS_sigwait), &signo, sizeof(signo), false); - OSAPI_TEST_FUNCTION_RC(UT_TimeBaseTest_CallSigWaitFunc(0), 1111111); + OSAPI_TEST_FUNCTION_RC(UT_TimeBaseTest_CallSigWaitFunc(UT_INDEX_0), 1111111); UT_SetDataBuffer(UT_KEY(OCS_sigwait), &signo, sizeof(signo), false); - OSAPI_TEST_FUNCTION_RC(UT_TimeBaseTest_CallSigWaitFunc(0), 2222222); + OSAPI_TEST_FUNCTION_RC(UT_TimeBaseTest_CallSigWaitFunc(UT_INDEX_0), 2222222); UT_SetDataBuffer(UT_KEY(OCS_sigwait), &signo, sizeof(signo), false); - OSAPI_TEST_FUNCTION_RC(UT_TimeBaseTest_CallSigWaitFunc(0), 2222222); + OSAPI_TEST_FUNCTION_RC(UT_TimeBaseTest_CallSigWaitFunc(UT_INDEX_0), 2222222); - UT_TimeBaseTest_Setup(0, 0, false); + UT_TimeBaseTest_Setup(UT_INDEX_0, 0, false); OS_global_timebase_table[0].active_id = OS_OBJECT_ID_UNDEFINED; OS_timebase_table[0].nominal_interval_time = 0; } @@ -195,13 +195,13 @@ void Test_OS_TimeBaseSet_Impl(void) /* Test Case For: * int32 OS_TimeBaseSet_Impl(uint32 timer_id, int32 start_time, int32 interval_time) */ - OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(0, 1, 1), OS_ERR_NOT_IMPLEMENTED); + OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(UT_INDEX_0, 1, 1), OS_ERR_NOT_IMPLEMENTED); - UT_TimeBaseTest_Setup(0, OCS_SIGRTMIN, false); - OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(0, 1, 1), OS_SUCCESS); + UT_TimeBaseTest_Setup(UT_INDEX_0, OCS_SIGRTMIN, false); + OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(UT_INDEX_0, 1, 1), OS_SUCCESS); UT_SetForceFail(UT_KEY(OCS_timer_settime), -1); - OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(0, 1, 1), OS_TIMER_ERR_INVALID_ARGS); + OSAPI_TEST_FUNCTION_RC(OS_TimeBaseSet_Impl(UT_INDEX_0, 1, 1), OS_TIMER_ERR_INVALID_ARGS); } void Test_OS_TimeBaseDelete_Impl(void) @@ -209,8 +209,8 @@ void Test_OS_TimeBaseDelete_Impl(void) /* Test Case For: * int32 OS_TimeBaseDelete_Impl(uint32 timer_id) */ - UT_TimeBaseTest_Setup(0, OCS_SIGRTMIN, false); - OSAPI_TEST_FUNCTION_RC(OS_TimeBaseDelete_Impl(0), OS_SUCCESS); + UT_TimeBaseTest_Setup(UT_INDEX_0, OCS_SIGRTMIN, false); + OSAPI_TEST_FUNCTION_RC(OS_TimeBaseDelete_Impl(UT_INDEX_0), OS_SUCCESS); } void Test_OS_TimeBaseGetInfo_Impl(void) @@ -219,7 +219,7 @@ void Test_OS_TimeBaseGetInfo_Impl(void) * int32 OS_TimeBaseGetInfo_Impl (uint32 timer_id, OS_timebase_prop_t *timer_prop) */ OS_timebase_prop_t timer_prop; - OSAPI_TEST_FUNCTION_RC(OS_TimeBaseGetInfo_Impl(0, &timer_prop), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_TimeBaseGetInfo_Impl(UT_INDEX_0, &timer_prop), OS_SUCCESS); } /* ------------------- End of test cases --------------------------------------*/ diff --git a/src/unit-test-coverage/vxworks/src/os-vxworks-coveragetest.h b/src/unit-test-coverage/vxworks/src/os-vxworks-coveragetest.h index d51d0fb41..989f27da7 100644 --- a/src/unit-test-coverage/vxworks/src/os-vxworks-coveragetest.h +++ b/src/unit-test-coverage/vxworks/src/os-vxworks-coveragetest.h @@ -43,6 +43,10 @@ #define ADD_TEST(test) UtTest_Add((Test_##test), Osapi_Test_Setup, Osapi_Test_Teardown, #test) +#define UT_INDEX_0 OSAL_INDEX_C(0) +#define UT_INDEX_1 OSAL_INDEX_C(1) +#define UT_INDEX_2 OSAL_INDEX_C(2) + /* Osapi_Test_Setup * * Purpose: diff --git a/src/unit-test-coverage/vxworks/ut-stubs/src/vxworks-os-impl-common-stubs.c b/src/unit-test-coverage/vxworks/ut-stubs/src/vxworks-os-impl-common-stubs.c index 3457f101d..27339e688 100644 --- a/src/unit-test-coverage/vxworks/ut-stubs/src/vxworks-os-impl-common-stubs.c +++ b/src/unit-test-coverage/vxworks/ut-stubs/src/vxworks-os-impl-common-stubs.c @@ -31,7 +31,7 @@ #include #include -UT_DEFAULT_STUB(OS_API_Impl_Init, (uint32 idtype)) +UT_DEFAULT_STUB(OS_API_Impl_Init, (osal_objtype_t idtype)) int OS_VxWorks_GenericSemTake(OCS_SEM_ID vxid, int sys_ticks) { diff --git a/src/unit-tests/oscore-test/ut_oscore_misc_test.c b/src/unit-tests/oscore-test/ut_oscore_misc_test.c index 07b066140..f54ca186e 100644 --- a/src/unit-tests/oscore-test/ut_oscore_misc_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_misc_test.c @@ -88,12 +88,14 @@ *--------------------------------------------------------------------------------*/ void UT_os_apiinit_test() { - int32 res = 0; - const char *testDesc; - osal_id_t qId; - uint32 qDepth = 10, qSize = 4, qFlags = 0; - osal_id_t semIds[3]; - uint32 semInitValue = 1, semOptions = 0; + int32 res = 0; + const char * testDesc; + osal_id_t qId; + osal_blockcount_t qDepth = OSAL_BLOCKCOUNT_C(10); + size_t qSize = OSAL_SIZE_C(4); + uint32 qFlags = 0; + osal_id_t semIds[3]; + uint32 semInitValue = 1, semOptions = 0; /*-----------------------------------------------------*/ testDesc = "#1 Init-not-call-first"; diff --git a/src/unit-tests/oscore-test/ut_oscore_queue_test.c b/src/unit-tests/oscore-test/ut_oscore_queue_test.c index d47dc6629..c991f3324 100644 --- a/src/unit-tests/oscore-test/ut_oscore_queue_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_queue_test.c @@ -83,7 +83,7 @@ void UT_os_queue_create_test() /*-----------------------------------------------------*/ testDesc = "API not implemented"; - res = OS_QueueCreate(&queue_id, "Good", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "Good", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res == OS_ERR_NOT_IMPLEMENTED) { UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_NA); @@ -95,7 +95,7 @@ void UT_os_queue_create_test() /*-----------------------------------------------------*/ testDesc = "#1 Null-pointer-arg-1"; - res = OS_QueueCreate(NULL, "Queue1", 10, 4, 0); + res = OS_QueueCreate(NULL, "Queue1", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res == OS_INVALID_POINTER) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -104,7 +104,7 @@ void UT_os_queue_create_test() /*-----------------------------------------------------*/ testDesc = "#2 Null-pointer-arg-2"; - res = OS_QueueCreate(&queue_id, NULL, 10, 4, 0); + res = OS_QueueCreate(&queue_id, NULL, OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res == OS_INVALID_POINTER) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -115,7 +115,7 @@ void UT_os_queue_create_test() memset(long_queue_name, 'X', sizeof(long_queue_name)); long_queue_name[sizeof(long_queue_name) - 1] = '\0'; - res = OS_QueueCreate(&queue_id, long_queue_name, 10, 4, 0); + res = OS_QueueCreate(&queue_id, long_queue_name, OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res == OS_ERR_NAME_TOO_LONG) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -129,7 +129,7 @@ void UT_os_queue_create_test() { memset(queue_name, '\0', sizeof(queue_name)); UT_os_sprintf(queue_name, "QUEUE%d", i); - res = OS_QueueCreate(&queue_id, queue_name, 2, 4, 0); + res = OS_QueueCreate(&queue_id, queue_name, OSAL_BLOCKCOUNT_C(2), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#4 No-free-IDs - Queue Create failed"; @@ -141,7 +141,7 @@ void UT_os_queue_create_test() if (test_setup_invalid == 0) { - res = OS_QueueCreate(&queue_id, "OneTooMany", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "OneTooMany", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res == OS_ERR_NO_FREE_IDS) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -155,14 +155,14 @@ void UT_os_queue_create_test() testDesc = "#5 Duplicate-name"; /* Setup */ - res = OS_QueueCreate(&queue_id2, "DUPLICATE", 10, 4, 0); + res = OS_QueueCreate(&queue_id2, "DUPLICATE", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { UT_OS_TEST_RESULT("Queue Create failed", UTASSERT_CASETYPE_TSF); } else { - res = OS_QueueCreate(&queue_id, "DUPLICATE", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "DUPLICATE", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res == OS_ERR_NAME_TAKEN) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -180,7 +180,7 @@ void UT_os_queue_create_test() /*-----------------------------------------------------*/ testDesc = "#7 Nominal"; - res = OS_QueueCreate(&queue_id, "Good", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "Good", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res == OS_SUCCESS) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -235,7 +235,7 @@ void UT_os_queue_delete_test() testDesc = "#3 Nominal"; /* Setup */ - res = OS_QueueCreate(&queue_id, "DeleteTest", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "DeleteTest", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#3 Nominal - Queue Create failed"; @@ -272,13 +272,13 @@ void UT_os_queue_get_test() osal_id_t queue_id; uint32 queue_data_out; uint32 queue_data_in; - uint32 size_copied; - uint32 data_size; + size_t size_copied; + size_t data_size; /*-----------------------------------------------------*/ testDesc = "API not implemented"; - res = OS_QueueGet(OS_OBJECT_ID_UNDEFINED, (void *)&queue_data_in, 4, &size_copied, OS_CHECK); + res = OS_QueueGet(OS_OBJECT_ID_UNDEFINED, (void *)&queue_data_in, sizeof(uint32), &size_copied, OS_CHECK); if (res == OS_ERR_NOT_IMPLEMENTED) { UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_NA); @@ -288,7 +288,7 @@ void UT_os_queue_get_test() /*-----------------------------------------------------*/ testDesc = "#1 Invalid-ID-arg"; - res = OS_QueueGet(UT_OBJID_INCORRECT, (void *)&queue_data_in, 4, &size_copied, OS_CHECK); + res = OS_QueueGet(UT_OBJID_INCORRECT, (void *)&queue_data_in, sizeof(uint32), &size_copied, OS_CHECK); if (res == OS_ERR_INVALID_ID) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -298,7 +298,7 @@ void UT_os_queue_get_test() testDesc = "#2 Invalid-pointer-arg-1"; /* Setup */ - res = OS_QueueCreate(&queue_id, "QueueGet", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "QueueGet", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#2 Invalid-pointer-arg-1 - Queue Create failed"; @@ -306,7 +306,7 @@ void UT_os_queue_get_test() } else { - res = OS_QueueGet(queue_id, NULL, 4, &size_copied, OS_CHECK); + res = OS_QueueGet(queue_id, NULL, sizeof(uint32), &size_copied, OS_CHECK); if (res == OS_INVALID_POINTER) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -319,7 +319,7 @@ void UT_os_queue_get_test() testDesc = "#3 Invalid-pointer-arg-2"; /* Setup */ - res = OS_QueueCreate(&queue_id, "QueueGet", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "QueueGet", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#3 Invalid-pointer-arg-2 - Queue Create failed"; @@ -327,7 +327,7 @@ void UT_os_queue_get_test() } else { - res = OS_QueueGet(queue_id, (void *)&queue_data_in, 4, NULL, OS_CHECK); + res = OS_QueueGet(queue_id, (void *)&queue_data_in, sizeof(uint32), NULL, OS_CHECK); if (res == OS_INVALID_POINTER) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -340,7 +340,7 @@ void UT_os_queue_get_test() testDesc = "#4 Queue-empty"; /* Setup */ - res = OS_QueueCreate(&queue_id, "QueueEmpty", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "QueueEmpty", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#4 Queue-empty - Queue Create failed"; @@ -348,7 +348,7 @@ void UT_os_queue_get_test() } else { - res = OS_QueueGet(queue_id, (void *)&queue_data_in, 4, &data_size, OS_CHECK); + res = OS_QueueGet(queue_id, (void *)&queue_data_in, sizeof(uint32), &data_size, OS_CHECK); if (res == OS_QUEUE_EMPTY) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -361,7 +361,7 @@ void UT_os_queue_get_test() testDesc = "#5 Queue-timed-out"; /* Setup */ - res = OS_QueueCreate(&queue_id, "QueueTimeout", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "QueueTimeout", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#5 Queue-timed-out - Queue Create failed"; @@ -369,7 +369,7 @@ void UT_os_queue_get_test() } else { - res = OS_QueueGet(queue_id, (void *)&queue_data_in, 4, &data_size, 2); + res = OS_QueueGet(queue_id, (void *)&queue_data_in, sizeof(uint32), &data_size, 2); if (res == OS_QUEUE_TIMEOUT) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -382,7 +382,7 @@ void UT_os_queue_get_test() testDesc = "#6 Invalid-queue-size"; /* Setup */ - res = OS_QueueCreate(&queue_id, "QueuePut", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "QueuePut", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#6 Invalid-queue-size - Queue Create failed"; @@ -391,7 +391,7 @@ void UT_os_queue_get_test() else { queue_data_out = 0x11223344; - res = OS_QueuePut(queue_id, (void *)&queue_data_out, 2, 0); + res = OS_QueuePut(queue_id, (void *)&queue_data_out, OSAL_SIZE_C(2), 0); if (res != OS_SUCCESS) { testDesc = "#6 Invalid-queue-size - Queue Put failed"; @@ -399,7 +399,7 @@ void UT_os_queue_get_test() } else { - res = OS_QueueGet(queue_id, (void *)&queue_data_in, 3, &data_size, OS_CHECK); + res = OS_QueueGet(queue_id, (void *)&queue_data_in, OSAL_SIZE_C(3), &data_size, OS_CHECK); if (res == OS_QUEUE_INVALID_SIZE) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -417,7 +417,7 @@ void UT_os_queue_get_test() testDesc = "#8 Nominal Pend"; /* Setup */ - res = OS_QueueCreate(&queue_id, "QueueGet", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "QueueGet", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#8 Nominal Pend - Queue Create failed"; @@ -426,7 +426,7 @@ void UT_os_queue_get_test() else { queue_data_out = 0x11223344; - res = OS_QueuePut(queue_id, (void *)&queue_data_out, 4, 0); + res = OS_QueuePut(queue_id, (void *)&queue_data_out, sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#8 Nominal Pend - Queue Put failed"; @@ -434,7 +434,7 @@ void UT_os_queue_get_test() } else { - res = OS_QueueGet(queue_id, (void *)&queue_data_in, 4, &data_size, OS_PEND); + res = OS_QueueGet(queue_id, (void *)&queue_data_in, sizeof(uint32), &data_size, OS_PEND); if (res == OS_SUCCESS) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -447,7 +447,7 @@ void UT_os_queue_get_test() testDesc = "#9 Nominal timeout"; /* Setup */ - res = OS_QueueCreate(&queue_id, "QueueGet", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "QueueGet", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#9 Nominal timeout - Queue Create failed"; @@ -456,7 +456,7 @@ void UT_os_queue_get_test() else { queue_data_out = 0x11223344; - res = OS_QueuePut(queue_id, (void *)&queue_data_out, 4, 0); + res = OS_QueuePut(queue_id, (void *)&queue_data_out, sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#9 Nominal timeout - Queue Put failed"; @@ -464,7 +464,7 @@ void UT_os_queue_get_test() } else { - res = OS_QueueGet(queue_id, (void *)&queue_data_in, 4, &data_size, 20); + res = OS_QueueGet(queue_id, (void *)&queue_data_in, sizeof(uint32), &data_size, 20); if (res == OS_SUCCESS) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -477,7 +477,7 @@ void UT_os_queue_get_test() testDesc = "#10 Nominal check"; /* Setup */ - res = OS_QueueCreate(&queue_id, "QueueGet", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "QueueGet", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#10 Nominal check - Queue Create failed"; @@ -486,7 +486,7 @@ void UT_os_queue_get_test() else { queue_data_out = 0x11223344; - res = OS_QueuePut(queue_id, (void *)&queue_data_out, 4, 0); + res = OS_QueuePut(queue_id, (void *)&queue_data_out, sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#10 Nominal check - Queue Put failed"; @@ -494,7 +494,7 @@ void UT_os_queue_get_test() } else { - res = OS_QueueGet(queue_id, (void *)&queue_data_in, 4, &data_size, OS_CHECK); + res = OS_QueueGet(queue_id, (void *)&queue_data_in, sizeof(uint32), &data_size, OS_CHECK); if (res == OS_SUCCESS) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -528,7 +528,7 @@ void UT_os_queue_put_test() /*-----------------------------------------------------*/ testDesc = "API not implemented"; - res = OS_QueuePut(OS_OBJECT_ID_UNDEFINED, (void *)&queue_data_out, 4, 0); + res = OS_QueuePut(OS_OBJECT_ID_UNDEFINED, (void *)&queue_data_out, sizeof(uint32), 0); if (res == OS_ERR_NOT_IMPLEMENTED) { UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_NA); @@ -538,7 +538,7 @@ void UT_os_queue_put_test() /*-----------------------------------------------------*/ testDesc = "#1 Invalid-ID-arg"; - res = OS_QueuePut(UT_OBJID_INCORRECT, (void *)&queue_data_out, 4, 0); + res = OS_QueuePut(UT_OBJID_INCORRECT, (void *)&queue_data_out, sizeof(uint32), 0); if (res == OS_ERR_INVALID_ID) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -548,7 +548,7 @@ void UT_os_queue_put_test() testDesc = "#2 Invalid-pointer-arg"; /* Setup */ - res = OS_QueueCreate(&queue_id, "QueuePut", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "QueuePut", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#2 Invalid-pointer-arg - Queue Create failed"; @@ -556,7 +556,7 @@ void UT_os_queue_put_test() } else { - res = OS_QueuePut(queue_id, NULL, 4, 0); + res = OS_QueuePut(queue_id, NULL, sizeof(uint32), 0); if (res == OS_INVALID_POINTER) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -573,7 +573,7 @@ void UT_os_queue_put_test() testDesc = "#4 Queue-full"; /* Setup */ - res = OS_QueueCreate(&queue_id, "QueuePut", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "QueuePut", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#4 Queue-full - Queue Create failed"; @@ -584,7 +584,7 @@ void UT_os_queue_put_test() queue_data_out = 0x11223344; for (i = 0; i < 100; i++) { - res = OS_QueuePut(queue_id, (void *)&queue_data_out, 4, 0); + res = OS_QueuePut(queue_id, (void *)&queue_data_out, sizeof(uint32), 0); if (res == OS_QUEUE_FULL) break; } @@ -601,7 +601,7 @@ void UT_os_queue_put_test() testDesc = "#5 Nominal"; /* Setup */ - res = OS_QueueCreate(&queue_id, "QueueGet", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "QueueGet", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#5 Nominal - Queue Create failed"; @@ -610,7 +610,7 @@ void UT_os_queue_put_test() else { queue_data_out = 0x11223344; - res = OS_QueuePut(queue_id, (void *)&queue_data_out, 4, 0); + res = OS_QueuePut(queue_id, (void *)&queue_data_out, sizeof(uint32), 0); if (res == OS_SUCCESS) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -690,7 +690,7 @@ void UT_os_queue_get_id_by_name_test() testDesc = "#5 Nominal"; /* Setup */ - res = OS_QueueCreate(&queue_id, "GetIDByName", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "GetIDByName", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#5 Nominal - Queue Create failed"; @@ -749,7 +749,7 @@ void UT_os_queue_get_info_test() testDesc = "#2 Invalid-pointer-arg"; /* Setup */ - res = OS_QueueCreate(&queue_id, "GetInfo", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "GetInfo", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#2 Invalid-pointer-arg - Queue Create failed"; @@ -770,7 +770,7 @@ void UT_os_queue_get_info_test() testDesc = "#3 Nominal"; /* Setup */ - res = OS_QueueCreate(&queue_id, "GetInfo", 10, 4, 0); + res = OS_QueueCreate(&queue_id, "GetInfo", OSAL_BLOCKCOUNT_C(10), sizeof(uint32), 0); if (res != OS_SUCCESS) { testDesc = "#3 Nominal - Queue Create failed"; diff --git a/src/unit-tests/oscore-test/ut_oscore_select_test.c b/src/unit-tests/oscore-test/ut_oscore_select_test.c index 567fc9fbc..3ebba4844 100644 --- a/src/unit-tests/oscore-test/ut_oscore_select_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_select_test.c @@ -64,7 +64,7 @@ char * fsAddrPtr = NULL; static osal_id_t setup_file(void) { osal_id_t id; - UT_SETUP(OS_mkfs(fsAddrPtr, "/ramdev3", "RAM3", 512, 20)); + UT_SETUP(OS_mkfs(fsAddrPtr, "/ramdev3", "RAM3", OSAL_SIZE_C(512), OSAL_BLOCKCOUNT_C(20))); UT_SETUP(OS_mount("/ramdev3", "/drive3")); UT_SETUP(OS_OpenCreate(&id, "/drive3/select_test.txt", OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_READ_WRITE)); return id; diff --git a/src/unit-tests/oscore-test/ut_oscore_task_test.c b/src/unit-tests/oscore-test/ut_oscore_task_test.c index 7f0cd5ae3..bb3d5b9da 100644 --- a/src/unit-tests/oscore-test/ut_oscore_task_test.c +++ b/src/unit-tests/oscore-test/ut_oscore_task_test.c @@ -37,9 +37,6 @@ #define UT_TASK_STACK_SIZE 0x2000 #define UT_TASK_PRIORITY 111 -/* This is not global in the OSAL */ -#define MAX_PRIORITY 255 - /*--------------------------------------------------------------------------------* ** Data types **--------------------------------------------------------------------------------*/ @@ -58,7 +55,10 @@ extern char g_long_task_name[UT_OS_NAME_BUFF_SIZE]; uint32 g_task_result = 0; osal_id_t g_task_sync_sem; osal_id_t g_task_ids[UT_OS_TASK_LIST_LEN]; -uint32 g_task_stacks[UT_OS_TASK_LIST_LEN][UT_TASK_STACK_SIZE]; +struct +{ + uint32 words[UT_TASK_STACK_SIZE]; +} g_task_stacks[UT_OS_TASK_LIST_LEN]; /*--------------------------------------------------------------------------------* ** External function prototypes @@ -113,8 +113,8 @@ void UT_os_task_create_test() /*-----------------------------------------------------*/ testDesc = "API not implemented"; - res = OS_TaskCreate(&g_task_ids[0], g_task_names[0], generic_test_task, g_task_stacks[0], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[0], g_task_names[0], generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[0]), + sizeof(g_task_stacks[0]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res == OS_ERR_NOT_IMPLEMENTED) { UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_NA); @@ -130,8 +130,8 @@ void UT_os_task_create_test() /*-----------------------------------------------------*/ testDesc = "#1 Null-pointer-arg-1"; - res = OS_TaskCreate(NULL, g_task_names[1], generic_test_task, g_task_stacks[1], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(NULL, g_task_names[1], generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[1]), + sizeof(g_task_stacks[1]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res == OS_INVALID_POINTER) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -140,8 +140,8 @@ void UT_os_task_create_test() /*-----------------------------------------------------*/ testDesc = "#2 Null-pointer-arg-2"; - res = OS_TaskCreate(&g_task_ids[2], NULL, generic_test_task, g_task_stacks[2], UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, - 0); + res = OS_TaskCreate(&g_task_ids[2], NULL, generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[2]), + sizeof(g_task_stacks[2]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res == OS_INVALID_POINTER) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -150,8 +150,8 @@ void UT_os_task_create_test() /*-----------------------------------------------------*/ testDesc = "#3 Null-pointer-arg-3"; - res = - OS_TaskCreate(&g_task_ids[3], g_task_names[3], NULL, g_task_stacks[3], UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[3], g_task_names[3], NULL, OSAL_STACKPTR_C(&g_task_stacks[3]), + sizeof(g_task_stacks[3]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res == OS_INVALID_POINTER) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -160,23 +160,13 @@ void UT_os_task_create_test() /*-----------------------------------------------------*/ testDesc = "#4 Name-too-long"; - res = OS_TaskCreate(&g_task_ids[4], g_long_task_name, generic_test_task, g_task_stacks[4], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[4], g_long_task_name, generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[4]), + sizeof(g_task_stacks[4]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res == OS_ERR_NAME_TOO_LONG) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_FAILURE); - /*-----------------------------------------------------*/ - testDesc = "#5 Invalid-priority"; - - res = OS_TaskCreate(&g_task_ids[5], g_task_names[5], generic_test_task, g_task_stacks[5], UT_TASK_STACK_SIZE, - MAX_PRIORITY + 1, 0); - if (res == OS_ERR_INVALID_PRIORITY) - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); - else - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_FAILURE); - /*-----------------------------------------------------*/ testDesc = "#6 No-free-IDs"; @@ -185,8 +175,8 @@ void UT_os_task_create_test() { memset(task_name, '\0', sizeof(task_name)); UT_os_sprintf(task_name, "CREATE_TASK%d", (int)i); - res = OS_TaskCreate(&g_task_ids[i], task_name, generic_test_task, g_task_stacks[i], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[i], task_name, generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[i]), + sizeof(g_task_stacks[i]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { break; @@ -211,8 +201,8 @@ void UT_os_task_create_test() testDesc = "#7 Duplicate-name"; /* Setup */ - res = OS_TaskCreate(&g_task_ids[7], g_task_names[7], generic_test_task, g_task_stacks[7], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[7], g_task_names[7], generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[7]), + sizeof(g_task_stacks[7]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { testDesc = "#7 Duplicate-name - Task-Create failed"; @@ -220,8 +210,8 @@ void UT_os_task_create_test() } else { - res = OS_TaskCreate(&g_task_ids[8], g_task_names[7], generic_test_task, g_task_stacks[8], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[8], g_task_names[7], generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[8]), + sizeof(g_task_stacks[8]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res == OS_ERR_NAME_TAKEN) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -242,8 +232,8 @@ void UT_os_task_create_test() /*-----------------------------------------------------*/ testDesc = "#9 Nominal"; - res = OS_TaskCreate(&g_task_ids[9], g_task_names[9], generic_test_task, g_task_stacks[9], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[9], g_task_names[9], generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[9]), + sizeof(g_task_stacks[9]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res == OS_SUCCESS) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -300,8 +290,8 @@ void UT_os_task_delete_test() testDesc = "#3 Nominal"; /* Setup */ - res = OS_TaskCreate(&g_task_ids[3], g_task_names[3], generic_test_task, g_task_stacks[3], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[3], g_task_names[3], generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[3]), + sizeof(g_task_stacks[3]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { testDesc = "#3 Nominal - Task-Create failed"; @@ -407,8 +397,9 @@ void UT_os_task_install_delete_handler_test(void) { OS_BinSemTake(g_task_sync_sem); - res = OS_TaskCreate(&g_task_ids[2], g_task_names[2], delete_handler_test_task, g_task_stacks[2], - UT_TASK_STACK_SIZE, UT_TASK_PRIORITY, 0); + res = + OS_TaskCreate(&g_task_ids[2], g_task_names[2], delete_handler_test_task, OSAL_STACKPTR_C(&g_task_stacks[2]), + sizeof(g_task_stacks[2]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { testDesc = "#2 Nominal - Task-Create-failed"; @@ -489,8 +480,8 @@ void UT_os_task_exit_test(void) { OS_BinSemTake(g_task_sync_sem); - res = OS_TaskCreate(&g_task_ids[1], g_task_names[1], exit_test_task, g_task_stacks[1], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[1], g_task_names[1], exit_test_task, OSAL_STACKPTR_C(&g_task_stacks[1]), + sizeof(g_task_stacks[1]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { testDesc = "#1 Nominal - Task-Create failed"; @@ -579,8 +570,8 @@ void UT_os_task_set_priority_test() /*-----------------------------------------------------*/ testDesc = "API not implemented"; - res = OS_TaskCreate(&g_task_ids[0], g_task_names[0], generic_test_task, g_task_stacks[0], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[0], g_task_names[0], generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[0]), + sizeof(g_task_stacks[0]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { testDesc = "#0 API not implemented - Task-Create failed"; @@ -589,7 +580,7 @@ void UT_os_task_set_priority_test() } else { - res = OS_TaskSetPriority(g_task_ids[0], UT_TASK_PRIORITY); + res = OS_TaskSetPriority(g_task_ids[0], OSAL_PRIORITY_C(UT_TASK_PRIORITY)); if (res == OS_ERR_NOT_IMPLEMENTED) { UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_NA); @@ -606,7 +597,7 @@ void UT_os_task_set_priority_test() /*-----------------------------------------------------*/ testDesc = "#1 Invalid-ID-arg"; - res = OS_TaskSetPriority(UT_OBJID_INCORRECT, 100); + res = OS_TaskSetPriority(UT_OBJID_INCORRECT, OSAL_PRIORITY_C(100)); if (res == OS_ERR_INVALID_ID) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -615,8 +606,8 @@ void UT_os_task_set_priority_test() /*-----------------------------------------------------*/ testDesc = "#2 Invalid-priority"; - res = OS_TaskCreate(&g_task_ids[2], g_task_names[2], generic_test_task, g_task_stacks[2], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[2], g_task_names[2], generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[2]), + sizeof(g_task_stacks[2]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { testDesc = "#2 Invalid-priority - Task-Create failed"; @@ -624,12 +615,6 @@ void UT_os_task_set_priority_test() } else { - res = OS_TaskSetPriority(g_task_ids[2], MAX_PRIORITY + 1); - if (res == OS_ERR_INVALID_PRIORITY) - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); - else - UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_FAILURE); - /* Delay to let child task run */ OS_TaskDelay(500); @@ -645,8 +630,8 @@ void UT_os_task_set_priority_test() /*-----------------------------------------------------*/ testDesc = "#4 Nominal"; - res = OS_TaskCreate(&g_task_ids[4], g_task_names[4], generic_test_task, g_task_stacks[4], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[4], g_task_names[4], generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[4]), + sizeof(g_task_stacks[4]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { testDesc = "#4 Nominal - Task-Create failed"; @@ -654,7 +639,7 @@ void UT_os_task_set_priority_test() } else { - res = OS_TaskSetPriority(g_task_ids[4], UT_TASK_PRIORITY - 10); + res = OS_TaskSetPriority(g_task_ids[4], OSAL_PRIORITY_C(UT_TASK_PRIORITY - 10)); if (res == OS_SUCCESS) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else @@ -664,7 +649,7 @@ void UT_os_task_set_priority_test() OS_TaskDelay(500); /* Reset test environment */ - OS_TaskSetPriority(g_task_ids[4], UT_TASK_PRIORITY); + OS_TaskSetPriority(g_task_ids[4], OSAL_PRIORITY_C(UT_TASK_PRIORITY)); OS_TaskDelete(g_task_ids[4]); } @@ -750,8 +735,8 @@ void UT_os_task_register_test(void) { OS_BinSemTake(g_task_sync_sem); - res = OS_TaskCreate(&g_task_ids[3], g_task_names[3], register_test_task, g_task_stacks[3], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[3], g_task_names[3], register_test_task, OSAL_STACKPTR_C(&g_task_stacks[3]), + sizeof(g_task_stacks[3]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { testDesc = "#3 Nominal - Task-Create failed"; @@ -818,8 +803,8 @@ void UT_os_task_get_id_test() testDesc = "#1 Nominal"; /* Setup */ - res = OS_TaskCreate(&g_task_ids[1], g_task_names[1], getid_test_task, g_task_stacks[1], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[1], g_task_names[1], getid_test_task, OSAL_STACKPTR_C(&g_task_stacks[1]), + sizeof(g_task_stacks[1]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { testDesc = "#1 Nominal - Task-Create failed"; @@ -902,8 +887,8 @@ void UT_os_task_get_id_by_name_test() testDesc = "#5 Nominal"; /* Setup */ - res = OS_TaskCreate(&g_task_ids[5], g_task_names[5], generic_test_task, g_task_stacks[5], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[5], g_task_names[5], generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[5]), + sizeof(g_task_stacks[5]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { testDesc = "#5 Nominal - Task-Create failed"; @@ -962,8 +947,8 @@ void UT_os_task_get_info_test() testDesc = "#2 Invalid-pointer-arg"; /* Setup */ - res = OS_TaskCreate(&g_task_ids[2], g_task_names[2], generic_test_task, g_task_stacks[2], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[2], g_task_names[2], generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[2]), + sizeof(g_task_stacks[2]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { testDesc = "#2 Invalid-pointer-arg - Task-Create failed"; @@ -988,8 +973,8 @@ void UT_os_task_get_info_test() testDesc = "#3 Nominal"; /* Setup */ - res = OS_TaskCreate(&g_task_ids[3], g_task_names[3], generic_test_task, g_task_stacks[3], UT_TASK_STACK_SIZE, - UT_TASK_PRIORITY, 0); + res = OS_TaskCreate(&g_task_ids[3], g_task_names[3], generic_test_task, OSAL_STACKPTR_C(&g_task_stacks[3]), + sizeof(g_task_stacks[3]), OSAL_PRIORITY_C(UT_TASK_PRIORITY), 0); if (res != OS_SUCCESS) { testDesc = "#3 Nominal - Task-Create failed"; diff --git a/src/unit-tests/osfile-test/ut_osfile_fileio_test.c b/src/unit-tests/osfile-test/ut_osfile_fileio_test.c index 6ab152a27..dbb8479a2 100644 --- a/src/unit-tests/osfile-test/ut_osfile_fileio_test.c +++ b/src/unit-tests/osfile-test/ut_osfile_fileio_test.c @@ -1037,7 +1037,8 @@ void UT_os_writefile_test() void UT_os_lseekfile_test() { const char *testDesc; - int32 buffLen = 0, pos1 = 0, pos2 = 0, pos3 = 0; + size_t buffLen; + int32 pos1 = 0, pos2 = 0, pos3 = 0; /*-----------------------------------------------------*/ testDesc = "API not implemented"; @@ -1101,7 +1102,7 @@ void UT_os_lseekfile_test() memset(g_writeBuff, '\0', sizeof(g_writeBuff)); strcpy(g_writeBuff, "THE BROWN FOX JUMPS OVER THE LAZY DOG."); - buffLen = (int32)strlen(g_writeBuff); + buffLen = strlen(g_writeBuff); if (OS_write(g_fDescs[0], g_writeBuff, buffLen) != buffLen) { diff --git a/src/unit-tests/osfile-test/ut_osfile_test.c b/src/unit-tests/osfile-test/ut_osfile_test.c index a2c84d821..fc6d6cea3 100644 --- a/src/unit-tests/osfile-test/ut_osfile_test.c +++ b/src/unit-tests/osfile-test/ut_osfile_test.c @@ -76,7 +76,7 @@ int32 UT_os_setup_fs() { int32 res; - res = OS_mkfs(g_fsAddrPtr, g_devName, "RAM3", 512, 64); + res = OS_mkfs(g_fsAddrPtr, g_devName, "RAM3", OSAL_SIZE_C(512), OSAL_BLOCKCOUNT_C(64)); if (res != OS_SUCCESS) { UT_OS_LOG("OS_mkfs() returns %d\n", (int)res); diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c index 1002252fd..ebbc668b8 100644 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c +++ b/src/unit-tests/osfilesys-test/ut_osfilesys_diskio_test.c @@ -44,8 +44,8 @@ extern char *g_fsAddrPtr; -extern int32 g_blkSize; -extern int32 g_blkCnt; +extern size_t g_blkSize; +extern osal_blockcount_t g_blkCnt; extern char g_fsLongName[UT_OS_PATH_BUFF_SIZE]; extern char g_physDriveName[UT_OS_PHYS_NAME_BUFF_SIZE]; @@ -141,8 +141,8 @@ void UT_os_initfs_test() /*-----------------------------------------------------*/ testDesc = "#1 Null-pointer-arg"; - if ((OS_initfs(g_fsAddrPtr, NULL, g_volNames[1], 0, 0) == OS_INVALID_POINTER) && - (OS_initfs(g_fsAddrPtr, g_devNames[1], NULL, 0, 0) == OS_INVALID_POINTER)) + if ((OS_initfs(g_fsAddrPtr, NULL, g_volNames[1], OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)) == OS_INVALID_POINTER) && + (OS_initfs(g_fsAddrPtr, g_devNames[1], NULL, OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)) == OS_INVALID_POINTER)) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_FAILURE); @@ -274,8 +274,8 @@ void UT_os_makefs_test() /*-----------------------------------------------------*/ testDesc = "#1 Null-pointer-arg"; - if ((OS_mkfs(g_fsAddrPtr, NULL, g_volNames[1], 0, 0) == OS_INVALID_POINTER) && - (OS_mkfs(g_fsAddrPtr, g_devNames[1], NULL, 0, 0) == OS_INVALID_POINTER)) + if ((OS_mkfs(g_fsAddrPtr, NULL, g_volNames[1], OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)) == OS_INVALID_POINTER) && + (OS_mkfs(g_fsAddrPtr, g_devNames[1], NULL, OSAL_SIZE_C(0), OSAL_BLOCKCOUNT_C(0)) == OS_INVALID_POINTER)) UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_PASS); else UT_OS_TEST_RESULT(testDesc, UTASSERT_CASETYPE_FAILURE); diff --git a/src/unit-tests/osfilesys-test/ut_osfilesys_test.c b/src/unit-tests/osfilesys-test/ut_osfilesys_test.c index 719da6629..16a147d97 100644 --- a/src/unit-tests/osfilesys-test/ut_osfilesys_test.c +++ b/src/unit-tests/osfilesys-test/ut_osfilesys_test.c @@ -51,8 +51,8 @@ char *g_fsAddrPtr = NULL; -int32 g_blkSize = UT_OS_FS_BLOCK_SIZE; -int32 g_blkCnt = UT_OS_FS_MAX_BLOCKS; +size_t g_blkSize = {UT_OS_FS_BLOCK_SIZE}; +osal_blockcount_t g_blkCnt = {UT_OS_FS_MAX_BLOCKS}; char g_fsLongName[UT_OS_PATH_BUFF_SIZE]; char g_physDriveName[UT_OS_PHYS_NAME_BUFF_SIZE]; diff --git a/src/ut-stubs/osapi-utstub-dir.c b/src/ut-stubs/osapi-utstub-dir.c index a918974d1..7d4bc977f 100644 --- a/src/ut-stubs/osapi-utstub-dir.c +++ b/src/ut-stubs/osapi-utstub-dir.c @@ -143,7 +143,7 @@ int32 OS_DirectoryRead(osal_id_t dir_id, os_dirent_t *dirent) UT_Stub_RegisterContext(UT_KEY(OS_DirectoryRead), dirent); int32 Status; - uint32 CopySize; + size_t CopySize; Status = UT_DEFAULT_IMPL(OS_DirectoryRead); diff --git a/src/ut-stubs/osapi-utstub-file.c b/src/ut-stubs/osapi-utstub-file.c index 710accaed..196d9a74e 100644 --- a/src/ut-stubs/osapi-utstub-file.c +++ b/src/ut-stubs/osapi-utstub-file.c @@ -41,10 +41,10 @@ UT_DEFAULT_STUB(OS_FileAPI_Init, (void)) * Local Stub helper function for reading * *****************************************************************************/ -static int32 UT_GenericReadStub(const char *fname, UT_EntryKey_t fkey, void *buffer, uint32 bsize) +static int32 UT_GenericReadStub(const char *fname, UT_EntryKey_t fkey, void *buffer, size_t bsize) { int32 status; - uint32 CopySize; + size_t CopySize; status = UT_DefaultStubImpl(fname, fkey, 0x7FFFFFFF); @@ -79,10 +79,10 @@ static int32 UT_GenericReadStub(const char *fname, UT_EntryKey_t fkey, void *buf * Local Stub helper function for writing * *****************************************************************************/ -static int32 UT_GenericWriteStub(const char *fname, UT_EntryKey_t fkey, const void *buffer, uint32 bsize) +static int32 UT_GenericWriteStub(const char *fname, UT_EntryKey_t fkey, const void *buffer, size_t bsize) { int32 status; - uint32 CopySize; + size_t CopySize; status = UT_DefaultStubImpl(fname, fkey, 0x7FFFFFFF); @@ -209,7 +209,7 @@ int32 OS_close(osal_id_t filedes) * Stub function for OS_StreamRead() * *****************************************************************************/ -int32 OS_StreamRead(osal_id_t filedes, void *buffer, uint32 nbytes, int32 timeout) +int32 OS_StreamRead(osal_id_t filedes, void *buffer, size_t nbytes, int32 timeout) { return UT_GenericReadStub(__func__, UT_KEY(OS_StreamRead), buffer, nbytes); } @@ -219,7 +219,7 @@ int32 OS_StreamRead(osal_id_t filedes, void *buffer, uint32 nbytes, int32 timeou * Stub function for OS_StreamWrite() * *****************************************************************************/ -int32 OS_StreamWrite(osal_id_t filedes, const void *buffer, uint32 nbytes, int32 timeout) +int32 OS_StreamWrite(osal_id_t filedes, const void *buffer, size_t nbytes, int32 timeout) { return UT_GenericWriteStub(__func__, UT_KEY(OS_StreamWrite), buffer, nbytes); } @@ -229,7 +229,7 @@ int32 OS_StreamWrite(osal_id_t filedes, const void *buffer, uint32 nbytes, int32 * Stub function for OS_read() * *****************************************************************************/ -int32 OS_read(osal_id_t filedes, void *buffer, uint32 nbytes) +int32 OS_read(osal_id_t filedes, void *buffer, size_t nbytes) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_read), filedes); UT_Stub_RegisterContext(UT_KEY(OS_read), buffer); @@ -243,7 +243,7 @@ int32 OS_read(osal_id_t filedes, void *buffer, uint32 nbytes) * Stub function for OS_write() * *****************************************************************************/ -int32 OS_write(osal_id_t filedes, const void *buffer, uint32 nbytes) +int32 OS_write(osal_id_t filedes, const void *buffer, size_t nbytes) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_write), filedes); UT_Stub_RegisterContext(UT_KEY(OS_write), buffer); @@ -257,7 +257,7 @@ int32 OS_write(osal_id_t filedes, const void *buffer, uint32 nbytes) * Stub function for OS_TimedRead() * *****************************************************************************/ -int32 OS_TimedRead(osal_id_t filedes, void *buffer, uint32 nbytes, int32 timeout) +int32 OS_TimedRead(osal_id_t filedes, void *buffer, size_t nbytes, int32 timeout) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimedRead), filedes); UT_Stub_RegisterContext(UT_KEY(OS_TimedRead), buffer); @@ -272,7 +272,7 @@ int32 OS_TimedRead(osal_id_t filedes, void *buffer, uint32 nbytes, int32 timeout * Stub function for OS_TimedWrite() * *****************************************************************************/ -int32 OS_TimedWrite(osal_id_t filedes, const void *buffer, uint32 nbytes, int32 timeout) +int32 OS_TimedWrite(osal_id_t filedes, const void *buffer, size_t nbytes, int32 timeout) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TimedWrite), filedes); UT_Stub_RegisterContext(UT_KEY(OS_TimedWrite), buffer); @@ -416,7 +416,7 @@ int32 OS_FDGetInfo(osal_id_t filedes, OS_file_prop_t *fd_prop) UT_Stub_RegisterContext(UT_KEY(OS_FDGetInfo), fd_prop); int32 status; - uint32 CopySize; + size_t CopySize; status = UT_DEFAULT_IMPL(OS_FDGetInfo); diff --git a/src/ut-stubs/osapi-utstub-filesys.c b/src/ut-stubs/osapi-utstub-filesys.c index 12437d88c..de1d2a5b9 100644 --- a/src/ut-stubs/osapi-utstub-filesys.c +++ b/src/ut-stubs/osapi-utstub-filesys.c @@ -68,7 +68,7 @@ int32 OS_FileSysAddFixedMap(osal_id_t *filesys_id, const char *phys_path, const * Stub function for OS_mkfs() * *****************************************************************************/ -int32 OS_mkfs(char *address, const char *devname, const char *volname, uint32 blocksize, uint32 numblocks) +int32 OS_mkfs(char *address, const char *devname, const char *volname, size_t blocksize, osal_blockcount_t numblocks) { UT_Stub_RegisterContext(UT_KEY(OS_mkfs), address); UT_Stub_RegisterContext(UT_KEY(OS_mkfs), devname); @@ -104,7 +104,7 @@ int32 OS_rmfs(const char *devname) * Stub function for OS_initfs() * *****************************************************************************/ -int32 OS_initfs(char *address, const char *devname, const char *volname, uint32 blocksize, uint32 numblocks) +int32 OS_initfs(char *address, const char *devname, const char *volname, size_t blocksize, osal_blockcount_t numblocks) { UT_Stub_RegisterContext(UT_KEY(OS_initfs), address); UT_Stub_RegisterContext(UT_KEY(OS_initfs), devname); diff --git a/src/ut-stubs/osapi-utstub-heap.c b/src/ut-stubs/osapi-utstub-heap.c index 3fdf50c6d..b2229da86 100644 --- a/src/ut-stubs/osapi-utstub-heap.c +++ b/src/ut-stubs/osapi-utstub-heap.c @@ -51,9 +51,9 @@ int32 OS_HeapGetInfo(OS_heap_prop_t *heap_prop) UT_Stub_CopyToLocal(UT_KEY(OS_HeapGetInfo), heap_prop, sizeof(*heap_prop)) < sizeof(*heap_prop)) { /* Return some random data */ - heap_prop->free_bytes = (uint32)12345; - heap_prop->free_blocks = (uint32)6789; - heap_prop->largest_free_block = (uint32)100; + heap_prop->free_bytes = OSAL_SIZE_C(12345); + heap_prop->free_blocks = OSAL_BLOCKCOUNT_C(6789); + heap_prop->largest_free_block = OSAL_SIZE_C(100); } return status; diff --git a/src/ut-stubs/osapi-utstub-idmap.c b/src/ut-stubs/osapi-utstub-idmap.c index a1dbfbfbc..594c4812f 100644 --- a/src/ut-stubs/osapi-utstub-idmap.c +++ b/src/ut-stubs/osapi-utstub-idmap.c @@ -42,11 +42,11 @@ UT_DEFAULT_STUB(OS_ObjectIdInit, (void)) /* Lock/Unlock for global tables */ -void OS_Lock_Global(uint32 idtype) +void OS_Lock_Global(osal_objtype_t idtype) { UT_DEFAULT_IMPL(OS_Lock_Global); } -void OS_Unlock_Global(uint32 idtype) +void OS_Unlock_Global(osal_objtype_t idtype) { UT_DEFAULT_IMPL(OS_Unlock_Global); } @@ -56,7 +56,7 @@ void OS_Unlock_Global(uint32 idtype) * Stub function for OS_GetMaxForObjectType() * *****************************************************************************/ -uint32 OS_GetMaxForObjectType(uint32 idtype) +uint32 OS_GetMaxForObjectType(osal_objtype_t idtype) { int32 max; @@ -77,7 +77,7 @@ uint32 OS_GetMaxForObjectType(uint32 idtype) * Stub function for OS_GetBaseForObjectType() * *****************************************************************************/ -uint32 OS_GetBaseForObjectType(uint32 idtype) +uint32 OS_GetBaseForObjectType(osal_objtype_t idtype) { int32 base; @@ -98,10 +98,11 @@ uint32 OS_GetBaseForObjectType(uint32 idtype) * Stub function for OS_ObjectIdToArrayIndex() * *****************************************************************************/ -int32 OS_ObjectIdToArrayIndex(uint32 idtype, osal_id_t id, uint32 *ArrayIndex) +int32 OS_ObjectIdToArrayIndex(osal_objtype_t idtype, osal_id_t id, osal_index_t *ArrayIndex) { int32 Status; UT_ObjType_t checktype; + uint32 tempserial; Status = UT_DEFAULT_IMPL(OS_ObjectIdToArrayIndex); @@ -109,7 +110,8 @@ int32 OS_ObjectIdToArrayIndex(uint32 idtype, osal_id_t id, uint32 *ArrayIndex) UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdToArrayIndex), ArrayIndex, sizeof(*ArrayIndex)) < sizeof(*ArrayIndex)) { /* this needs to output something valid or code will break */ - UT_ObjIdDecompose(id, ArrayIndex, &checktype); + UT_ObjIdDecompose(id, &tempserial, &checktype); + *ArrayIndex = OSAL_INDEX_C(tempserial); } return Status; @@ -155,7 +157,7 @@ int32 OS_ObjectIdFinalizeDelete(int32 operation_status, OS_common_record_t *reco * Stub function for OS_ObjectIdFindMatch() * *****************************************************************************/ -int32 OS_ObjectIdGetBySearch(OS_lock_mode_t lock_mode, uint32 idtype, OS_ObjectMatchFunc_t MatchFunc, void *arg, +int32 OS_ObjectIdGetBySearch(OS_lock_mode_t lock_mode, osal_objtype_t idtype, OS_ObjectMatchFunc_t MatchFunc, void *arg, OS_common_record_t **record) { int32 Status; @@ -184,7 +186,7 @@ int32 OS_ObjectIdGetBySearch(OS_lock_mode_t lock_mode, uint32 idtype, OS_ObjectM * Stub function for OS_ObjectIdFindByName(, &fake_record.active_id) * *****************************************************************************/ -int32 OS_ObjectIdFindByName(uint32 idtype, const char *name, osal_id_t *object_id) +int32 OS_ObjectIdFindByName(osal_objtype_t idtype, const char *name, osal_id_t *object_id) { int32 Status; @@ -209,7 +211,8 @@ int32 OS_ObjectIdFindByName(uint32 idtype, const char *name, osal_id_t *object_i * Stub function for OS_ObjectIdGetByName(,object_id) * *****************************************************************************/ -int32 OS_ObjectIdGetByName(OS_lock_mode_t lock_mode, uint32 idtype, const char *name, OS_common_record_t **record) +int32 OS_ObjectIdGetByName(OS_lock_mode_t lock_mode, osal_objtype_t idtype, const char *name, + OS_common_record_t **record) { int32 Status; OS_common_record_t * local_record; @@ -242,11 +245,12 @@ int32 OS_ObjectIdGetByName(OS_lock_mode_t lock_mode, uint32 idtype, const char * * Stub function for OS_ObjectIdGetById(, &fake_record.active_id) * *****************************************************************************/ -int32 OS_ObjectIdGetById(OS_lock_mode_t check_mode, uint32 idtype, osal_id_t id, uint32 *array_index, +int32 OS_ObjectIdGetById(OS_lock_mode_t check_mode, osal_objtype_t idtype, osal_id_t id, osal_index_t *array_index, OS_common_record_t **record) { int32 Status; - uint32 local_id; + uint32 tempserial; + osal_index_t local_id; UT_ObjType_t checktype; OS_common_record_t * local_record; static OS_common_record_t fake_record; @@ -257,7 +261,8 @@ int32 OS_ObjectIdGetById(OS_lock_mode_t check_mode, uint32 idtype, osal_id_t id, { if (UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdGetById), &local_id, sizeof(local_id)) < sizeof(local_id)) { - UT_ObjIdDecompose(id, &local_id, &checktype); + UT_ObjIdDecompose(id, &tempserial, &checktype); + local_id = OSAL_INDEX_C(tempserial); } if (UT_Stub_CopyToLocal(UT_KEY(OS_ObjectIdGetById), &local_record, sizeof(local_record)) < sizeof(local_record)) @@ -300,7 +305,7 @@ int32 OS_ObjectIdRefcountDecr(OS_common_record_t *record) * Stub function for OS_ObjectIdGetNext() * *****************************************************************************/ -int32 OS_ObjectIdGetNext(uint32 idtype, uint32 *curr_index, OS_common_record_t **record) +int32 OS_ObjectIdGetNext(osal_objtype_t idtype, uint32 *curr_index, OS_common_record_t **record) { int32 Status; uint32 local_id; @@ -350,10 +355,11 @@ int32 OS_ObjectIdGetNext(uint32 idtype, uint32 *curr_index, OS_common_record_t * * Stub function for OS_ObjectIdAllocateNew(, &fake_record.active_id) * *****************************************************************************/ -int32 OS_ObjectIdAllocateNew(uint32 idtype, const char *name, uint32 *array_index, OS_common_record_t **record) +int32 OS_ObjectIdAllocateNew(osal_objtype_t idtype, const char *name, osal_index_t *array_index, + OS_common_record_t **record) { int32 Status; - uint32 local_id; + osal_index_t local_id; OS_common_record_t * local_record; static OS_common_record_t fake_record; @@ -389,7 +395,7 @@ int32 OS_ObjectIdAllocateNew(uint32 idtype, const char *name, uint32 *array_inde returns: status ---------------------------------------------------------------------------------------*/ -int32 OS_GetResourceName(osal_id_t object_id, char *buffer, uint32 buffer_size) +int32 OS_GetResourceName(osal_id_t object_id, char *buffer, size_t buffer_size) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_GetResourceName), object_id); UT_Stub_RegisterContext(UT_KEY(OS_GetResourceName), buffer); @@ -421,22 +427,23 @@ int32 OS_GetResourceName(osal_id_t object_id, char *buffer, uint32 buffer_size) returns: status ---------------------------------------------------------------------------------------*/ -int32 OS_ConvertToArrayIndex(osal_id_t object_id, uint32 *ArrayIndex) +int32 OS_ConvertToArrayIndex(osal_id_t object_id, osal_index_t *ArrayIndex) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ConvertToArrayIndex), object_id); UT_Stub_RegisterContext(UT_KEY(OS_ConvertToArrayIndex), ArrayIndex); - int32 return_code; + int32 return_code; + uint32 tempserial; return_code = UT_DEFAULT_IMPL(OS_ConvertToArrayIndex); if (return_code == OS_SUCCESS) { UT_ObjType_t ObjType; - UT_ObjIdDecompose(object_id, ArrayIndex, &ObjType); + UT_ObjIdDecompose(object_id, &tempserial, &ObjType); if (ObjType != UT_OBJTYPE_NONE && ObjType < UT_OBJTYPE_MAX) { - *ArrayIndex %= UT_MAXOBJS[ObjType]; + tempserial %= UT_MAXOBJS[ObjType]; } } else @@ -445,9 +452,11 @@ int32 OS_ConvertToArrayIndex(osal_id_t object_id, uint32 *ArrayIndex) * If set to fail, then set the output to something bizarre - if the code * actually tries to use this, chances are it will segfault and be fixed */ - *ArrayIndex = 0xDEADBEEFU; + tempserial = 0xDEADBEEFU; } + *ArrayIndex = OSAL_INDEX_C(tempserial); + return return_code; } /* end OS_ConvertToArrayIndex */ @@ -458,7 +467,8 @@ int32 OS_ConvertToArrayIndex(osal_id_t object_id, uint32 *ArrayIndex) returns: None ---------------------------------------------------------------------------------------*/ -void OS_ForEachObjectOfType(uint32 objtype, osal_id_t creator_id, OS_ArgCallback_t callback_ptr, void *callback_arg) +void OS_ForEachObjectOfType(osal_objtype_t objtype, osal_id_t creator_id, OS_ArgCallback_t callback_ptr, + void *callback_arg) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ForEachObjectOfType), objtype); UT_Stub_RegisterContextGenericArg(UT_KEY(OS_ForEachObjectOfType), creator_id); @@ -466,7 +476,7 @@ void OS_ForEachObjectOfType(uint32 objtype, osal_id_t creator_id, OS_ArgCallback UT_Stub_RegisterContext(UT_KEY(OS_ForEachObjectOfType), callback_arg); osal_id_t NextId; - uint32 IdSize; + size_t IdSize; /* Although this is "void", Invoke the default impl to log it and invoke any hooks */ UT_DEFAULT_IMPL(OS_ForEachObjectOfType); @@ -497,7 +507,7 @@ void OS_ForEachObject(osal_id_t creator_id, OS_ArgCallback_t callback_ptr, void UT_Stub_RegisterContext(UT_KEY(OS_ForEachObject), callback_arg); osal_id_t NextId; - uint32 IdSize; + size_t IdSize; /* Although this is "void", Invoke the default impl to log it and invoke any hooks */ UT_DEFAULT_IMPL(OS_ForEachObject); @@ -520,7 +530,7 @@ void OS_ForEachObject(osal_id_t creator_id, OS_ArgCallback_t callback_ptr, void returns: The type of object that the ID represents ---------------------------------------------------------------------------------------*/ -uint32 OS_IdentifyObject(osal_id_t object_id) +osal_objtype_t OS_IdentifyObject(osal_id_t object_id) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_IdentifyObject), object_id); @@ -570,5 +580,7 @@ uint32 OS_IdentifyObject(osal_id_t object_id) break; } - return UT_DEFAULT_IMPL_RC(OS_IdentifyObject, DefaultType); + DefaultType = UT_DEFAULT_IMPL_RC(OS_IdentifyObject, DefaultType); + + return DefaultType; } diff --git a/src/ut-stubs/osapi-utstub-module.c b/src/ut-stubs/osapi-utstub-module.c index 1b2ddc30b..0d4839e91 100644 --- a/src/ut-stubs/osapi-utstub-module.c +++ b/src/ut-stubs/osapi-utstub-module.c @@ -262,7 +262,7 @@ int32 OS_ModuleSymbolLookup(osal_id_t module_id, cpuaddr *symbol_address, const * Stub function for OS_SymbolTableDump() * *****************************************************************************/ -int32 OS_SymbolTableDump(const char *filename, uint32 size_limit) +int32 OS_SymbolTableDump(const char *filename, size_t size_limit) { UT_Stub_RegisterContext(UT_KEY(OS_SymbolTableDump), filename); UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SymbolTableDump), size_limit); diff --git a/src/ut-stubs/osapi-utstub-network.c b/src/ut-stubs/osapi-utstub-network.c index de3c9a240..d7348d062 100644 --- a/src/ut-stubs/osapi-utstub-network.c +++ b/src/ut-stubs/osapi-utstub-network.c @@ -36,7 +36,7 @@ UT_DEFAULT_STUB(OS_NetworkAPI_Init, (void)) -int32 OS_NetworkGetHostName(char *host_name, uint32 name_len) +int32 OS_NetworkGetHostName(char *host_name, size_t name_len) { UT_Stub_RegisterContext(UT_KEY(OS_NetworkGetHostName), host_name); UT_Stub_RegisterContextGenericArg(UT_KEY(OS_NetworkGetHostName), name_len); diff --git a/src/ut-stubs/osapi-utstub-printf.c b/src/ut-stubs/osapi-utstub-printf.c index 2ed283e95..cdbed0bf6 100644 --- a/src/ut-stubs/osapi-utstub-printf.c +++ b/src/ut-stubs/osapi-utstub-printf.c @@ -60,7 +60,7 @@ void OS_printf(const char *string, ...) UT_Stub_RegisterContext(UT_KEY(OS_printf), string); int32 status; - int32 length = strlen(string); + size_t length = strlen(string); va_list va; va_start(va, string); diff --git a/src/ut-stubs/osapi-utstub-queue.c b/src/ut-stubs/osapi-utstub-queue.c index bcd09e65b..9a94a937b 100644 --- a/src/ut-stubs/osapi-utstub-queue.c +++ b/src/ut-stubs/osapi-utstub-queue.c @@ -61,7 +61,8 @@ UT_DEFAULT_STUB(OS_QueueAPI_Init, (void)) ** or OS_SUCCESS. ** ******************************************************************************/ -int32 OS_QueueCreate(osal_id_t *queue_id, const char *queue_name, uint32 queue_depth, uint32 data_size, uint32 flags) +int32 OS_QueueCreate(osal_id_t *queue_id, const char *queue_name, osal_blockcount_t queue_depth, size_t data_size, + uint32 flags) { UT_Stub_RegisterContext(UT_KEY(OS_QueueCreate), queue_id); UT_Stub_RegisterContext(UT_KEY(OS_QueueCreate), queue_name); @@ -149,7 +150,7 @@ int32 OS_QueueDelete(osal_id_t queue_id) ** or OS_SUCCESS. ** ******************************************************************************/ -int32 OS_QueueGet(osal_id_t queue_id, void *data, uint32 size, uint32 *size_copied, int32 timeout) +int32 OS_QueueGet(osal_id_t queue_id, void *data, size_t size, size_t *size_copied, int32 timeout) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueueGet), queue_id); UT_Stub_RegisterContext(UT_KEY(OS_QueueGet), data); @@ -196,7 +197,7 @@ int32 OS_QueueGet(osal_id_t queue_id, void *data, uint32 size, uint32 *size_copi ** OS_INVALID_POINTER, OS_QUEUE_FULL, or OS_SUCCESS. ** ******************************************************************************/ -int32 OS_QueuePut(osal_id_t queue_id, const void *data, uint32 size, uint32 flags) +int32 OS_QueuePut(osal_id_t queue_id, const void *data, size_t size, uint32 flags) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_QueuePut), queue_id); UT_Stub_RegisterContext(UT_KEY(OS_QueuePut), data); diff --git a/src/ut-stubs/osapi-utstub-sockets.c b/src/ut-stubs/osapi-utstub-sockets.c index 5563a0980..78e0264c7 100644 --- a/src/ut-stubs/osapi-utstub-sockets.c +++ b/src/ut-stubs/osapi-utstub-sockets.c @@ -115,7 +115,7 @@ int32 OS_SocketConnect(osal_id_t sock_id, const OS_SockAddr_t *Addr, int32 timeo * Stub function for OS_SocketRecvFrom() * *****************************************************************************/ -int32 OS_SocketRecvFrom(osal_id_t sock_id, void *buffer, uint32 buflen, OS_SockAddr_t *RemoteAddr, int32 timeout) +int32 OS_SocketRecvFrom(osal_id_t sock_id, void *buffer, size_t buflen, OS_SockAddr_t *RemoteAddr, int32 timeout) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketRecvFrom), sock_id); UT_Stub_RegisterContext(UT_KEY(OS_SocketRecvFrom), buffer); @@ -124,7 +124,7 @@ int32 OS_SocketRecvFrom(osal_id_t sock_id, void *buffer, uint32 buflen, OS_SockA UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketRecvFrom), timeout); int32 status; - uint32 CopySize; + size_t CopySize; status = UT_DEFAULT_IMPL(OS_SocketRecvFrom); @@ -159,7 +159,7 @@ int32 OS_SocketRecvFrom(osal_id_t sock_id, void *buffer, uint32 buflen, OS_SockA * Stub function for OS_SocketSendTo() * *****************************************************************************/ -int32 OS_SocketSendTo(osal_id_t sock_id, const void *buffer, uint32 buflen, const OS_SockAddr_t *RemoteAddr) +int32 OS_SocketSendTo(osal_id_t sock_id, const void *buffer, size_t buflen, const OS_SockAddr_t *RemoteAddr) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketSendTo), sock_id); UT_Stub_RegisterContext(UT_KEY(OS_SocketSendTo), buffer); @@ -167,7 +167,7 @@ int32 OS_SocketSendTo(osal_id_t sock_id, const void *buffer, uint32 buflen, cons UT_Stub_RegisterContext(UT_KEY(OS_SocketSendTo), RemoteAddr); int32 status; - uint32 CopySize; + size_t CopySize; status = UT_DEFAULT_IMPL_RC(OS_SocketSendTo, 0x7FFFFFFF); @@ -225,7 +225,7 @@ int32 OS_SocketGetInfo(osal_id_t sock_id, OS_socket_prop_t *sock_prop) UT_Stub_RegisterContext(UT_KEY(OS_SocketGetInfo), sock_prop); int32 status; - uint32 CopySize; + size_t CopySize; status = UT_DEFAULT_IMPL(OS_SocketGetInfo); @@ -260,7 +260,7 @@ int32 OS_SocketAddrInit(OS_SockAddr_t *Addr, OS_SocketDomain_t Domain) return status; } -int32 OS_SocketAddrToString(char *buffer, uint32 buflen, const OS_SockAddr_t *Addr) +int32 OS_SocketAddrToString(char *buffer, size_t buflen, const OS_SockAddr_t *Addr) { UT_Stub_RegisterContext(UT_KEY(OS_SocketAddrToString), buffer); UT_Stub_RegisterContextGenericArg(UT_KEY(OS_SocketAddrToString), buflen); diff --git a/src/ut-stubs/osapi-utstub-task.c b/src/ut-stubs/osapi-utstub-task.c index 097cf8083..ea980de68 100644 --- a/src/ut-stubs/osapi-utstub-task.c +++ b/src/ut-stubs/osapi-utstub-task.c @@ -52,13 +52,13 @@ UT_DEFAULT_STUB(OS_TaskAPI_Init, (void)) ** Returns either OS_SUCCESS or OS_ERROR. ** ******************************************************************************/ -int32 OS_TaskCreate(osal_id_t *task_id, const char *task_name, osal_task_entry function_pointer, uint32 *stack_pointer, - uint32 stack_size, uint32 priority, uint32 flags) +int32 OS_TaskCreate(osal_id_t *task_id, const char *task_name, osal_task_entry function_pointer, + osal_stackptr_t stack_pointer, size_t stack_size, osal_priority_t priority, uint32 flags) { UT_Stub_RegisterContext(UT_KEY(OS_TaskCreate), task_id); UT_Stub_RegisterContext(UT_KEY(OS_TaskCreate), task_name); UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskCreate), function_pointer); - UT_Stub_RegisterContext(UT_KEY(OS_TaskCreate), stack_pointer); + UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskCreate), stack_pointer); UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskCreate), stack_size); UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskCreate), priority); UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskCreate), flags); @@ -165,7 +165,7 @@ int32 OS_TaskDelay(uint32 millisecond) * Stub function for OS_TaskSetPriority() * *****************************************************************************/ -int32 OS_TaskSetPriority(osal_id_t task_id, uint32 new_priority) +int32 OS_TaskSetPriority(osal_id_t task_id, osal_priority_t new_priority) { UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskSetPriority), task_id); UT_Stub_RegisterContextGenericArg(UT_KEY(OS_TaskSetPriority), new_priority); @@ -281,8 +281,8 @@ int32 OS_TaskGetInfo(osal_id_t task_id, OS_task_prop_t *task_prop) UT_Stub_CopyToLocal(UT_KEY(OS_TaskGetInfo), task_prop, sizeof(*task_prop)) < sizeof(*task_prop)) { UT_ObjIdCompose(1, UT_OBJTYPE_TASK, &task_prop->creator); - task_prop->stack_size = 100; - task_prop->priority = 150; + task_prop->stack_size = OSAL_SIZE_C(100); + task_prop->priority = OSAL_PRIORITY_C(150); strncpy(task_prop->name, "UnitTest", OS_MAX_API_NAME - 1); task_prop->name[OS_MAX_API_NAME - 1] = '\0'; } diff --git a/ut_assert/inc/utstubs.h b/ut_assert/inc/utstubs.h index 429c7519b..ab8f3810f 100644 --- a/ut_assert/inc/utstubs.h +++ b/ut_assert/inc/utstubs.h @@ -161,7 +161,7 @@ void UT_SetDeferredRetcode(UT_EntryKey_t FuncKey, int32 Count, int32 Retcode); * is false then the DataBuffer pointer is used directly, and must remain valid for the duration * of the current test case. */ -void UT_SetDataBuffer(UT_EntryKey_t FuncKey, void *DataBuffer, uint32 BufferSize, bool AllocateCopy); +void UT_SetDataBuffer(UT_EntryKey_t FuncKey, void *DataBuffer, size_t BufferSize, bool AllocateCopy); /** * Gets the data buffer for a given stub function @@ -177,7 +177,7 @@ void UT_SetDataBuffer(UT_EntryKey_t FuncKey, void *DataBuffer, uint32 BufferSize * \param BufferSize Set to Maximum Size of data buffer (output) * \param Position Set to current position in data buffer (output) */ -void UT_GetDataBuffer(UT_EntryKey_t FuncKey, void **DataBuffer, uint32 *MaxSize, uint32 *Position); +void UT_GetDataBuffer(UT_EntryKey_t FuncKey, void **DataBuffer, size_t *MaxSize, size_t *Position); /** * Enable or disable the forced failure mode for the given stub function @@ -314,7 +314,7 @@ bool UT_Stub_CheckForceFail(UT_EntryKey_t FuncKey, int32 *Value); * \returns The actual size of data copied. If no data buffer is * supplied by the test harness this will return 0. */ -uint32 UT_Stub_CopyToLocal(UT_EntryKey_t FuncKey, void *LocalBuffer, uint32 MaxSize); +size_t UT_Stub_CopyToLocal(UT_EntryKey_t FuncKey, void *LocalBuffer, size_t MaxSize); /** * Copies data from a local buffer to the test-supplied buffer @@ -328,7 +328,7 @@ uint32 UT_Stub_CopyToLocal(UT_EntryKey_t FuncKey, void *LocalBuffer, uint32 MaxS * \returns The actual size of data copied. If no data buffer is * supplied by the test harness this will return 0. */ -uint32 UT_Stub_CopyFromLocal(UT_EntryKey_t FuncKey, const void *LocalBuffer, uint32 MaxSize); +size_t UT_Stub_CopyFromLocal(UT_EntryKey_t FuncKey, const void *LocalBuffer, size_t MaxSize); /** * Registers a single context element for the hook callback diff --git a/ut_assert/src/utstubs.c b/ut_assert/src/utstubs.c index 79693e2f6..9751fb287 100644 --- a/ut_assert/src/utstubs.c +++ b/ut_assert/src/utstubs.c @@ -69,8 +69,8 @@ typedef struct typedef struct { - uint32 Position; - uint32 TotalSize; + size_t Position; + size_t TotalSize; uint8 *BasePtr; } UT_BufferEntry_t; @@ -401,7 +401,7 @@ bool UT_Stub_CheckForceFail(UT_EntryKey_t FuncKey, int32 *Value) return (Result); } -void UT_SetDataBuffer(UT_EntryKey_t FuncKey, void *DataBuffer, uint32 BufferSize, bool AllocateCopy) +void UT_SetDataBuffer(UT_EntryKey_t FuncKey, void *DataBuffer, size_t BufferSize, bool AllocateCopy) { UT_StubTableEntry_t *StubPtr; @@ -441,12 +441,12 @@ void UT_SetDataBuffer(UT_EntryKey_t FuncKey, void *DataBuffer, uint32 BufferSize } } -void UT_GetDataBuffer(UT_EntryKey_t FuncKey, void **DataBuffer, uint32 *MaxSize, uint32 *Position) +void UT_GetDataBuffer(UT_EntryKey_t FuncKey, void **DataBuffer, size_t *MaxSize, size_t *Position) { UT_StubTableEntry_t *StubPtr; void * ResultDataBuffer; - uint32 ResultMaxSize; - uint32 ResultPosition; + size_t ResultMaxSize; + size_t ResultPosition; StubPtr = UT_GetStubEntry(FuncKey, UT_ENTRYTYPE_DATA_BUFFER); @@ -477,9 +477,9 @@ void UT_GetDataBuffer(UT_EntryKey_t FuncKey, void **DataBuffer, uint32 *MaxSize, } } -uint32 UT_Stub_CopyToLocal(UT_EntryKey_t FuncKey, void *LocalBuffer, uint32 MaxSize) +size_t UT_Stub_CopyToLocal(UT_EntryKey_t FuncKey, void *LocalBuffer, size_t MaxSize) { - uint32 ActualCopy; + size_t ActualCopy; UT_StubTableEntry_t *StubPtr; ActualCopy = 0; @@ -510,9 +510,9 @@ uint32 UT_Stub_CopyToLocal(UT_EntryKey_t FuncKey, void *LocalBuffer, uint32 MaxS return ActualCopy; } -uint32 UT_Stub_CopyFromLocal(UT_EntryKey_t FuncKey, const void *LocalBuffer, uint32 MaxSize) +size_t UT_Stub_CopyFromLocal(UT_EntryKey_t FuncKey, const void *LocalBuffer, size_t MaxSize) { - uint32 ActualCopy; + size_t ActualCopy; UT_StubTableEntry_t *StubPtr; ActualCopy = 0; From c98192bd1042e7769ee402a0753b0c7c3ff7b74d Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 17 Nov 2020 09:08:44 -0500 Subject: [PATCH 3/9] Fix #655, use 3 argument form of open --- src/os/portable/os-impl-posix-files.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/portable/os-impl-posix-files.c b/src/os/portable/os-impl-posix-files.c index 43628d5df..a6113f381 100644 --- a/src/os/portable/os-impl-posix-files.c +++ b/src/os/portable/os-impl-posix-files.c @@ -199,7 +199,7 @@ int32 OS_FileChmod_Impl(const char *local_path, uint32 access) int fd; /* Open file to avoid filename race potential */ - fd = open(local_path, O_RDONLY); + fd = open(local_path, O_RDONLY, 0); if (fd < 0) { return OS_ERROR; From 9c081dcf388cf84fcdf173115616001498c1c0a6 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 17 Nov 2020 12:12:17 -0500 Subject: [PATCH 4/9] Update #635, type corrections to avoid conversion Additional type corrections to avoid implicit sign and width conversions. --- src/os/inc/common_types.h | 8 ++-- src/os/portable/os-impl-bsd-select.c | 4 +- src/os/portable/os-impl-posix-io.c | 40 ++++++++++++------- src/os/posix/src/os-impl-timebase.c | 2 +- src/os/rtems/src/os-impl-timebase.c | 2 +- src/os/shared/inc/os-shared-common.h | 4 +- src/os/shared/inc/os-shared-timebase.h | 2 +- src/os/vxworks/src/os-impl-timebase.c | 2 +- .../inc/ut-adaptor-portable-posix-files.h | 5 ++- .../src/ut-adaptor-portable-posix-files.c | 4 +- .../portable/src/coveragetest-posix-files.c | 4 +- .../portable/src/coveragetest-posix-io.c | 2 +- .../ut-stubs/src/osapi-timer-impl-stubs.c | 2 +- 13 files changed, 47 insertions(+), 34 deletions(-) diff --git a/src/os/inc/common_types.h b/src/os/inc/common_types.h index 258f55a3b..d29c0b7e0 100644 --- a/src/os/inc/common_types.h +++ b/src/os/inc/common_types.h @@ -181,9 +181,9 @@ extern "C" * this makes it explicit in the code where a type conversion * is expected. */ -#define OSAL_SIZE_C(X) ((size_t) {X}) -#define OSAL_BLOCKCOUNT_C(X) ((osal_blockcount_t) {X}) -#define OSAL_INDEX_C(X) ((osal_index_t) {X}) -#define OSAL_OBJTYPE_C(X) ((osal_objtype_t) {X}) +#define OSAL_SIZE_C(X) ((size_t)(X)) +#define OSAL_BLOCKCOUNT_C(X) ((osal_blockcount_t)(X)) +#define OSAL_INDEX_C(X) ((osal_index_t)(X)) +#define OSAL_OBJTYPE_C(X) ((osal_objtype_t)(X)) #endif /* _common_types_ */ diff --git a/src/os/portable/os-impl-bsd-select.c b/src/os/portable/os-impl-bsd-select.c index 145d603fb..29c677f36 100644 --- a/src/os/portable/os-impl-bsd-select.c +++ b/src/os/portable/os-impl-bsd-select.c @@ -90,7 +90,7 @@ static int OS_FdSet_ConvertIn_Impl(fd_set *os_set, OS_FdSet *OSAL_set) { if (objids & 0x01) { - id = (offset * 8) + bit; + id = OSAL_INDEX_C((offset * 8) + bit); osfd = OS_impl_filehandle_table[id].fd; if (osfd >= 0 && OS_impl_filehandle_table[id].selectable) { @@ -136,7 +136,7 @@ static void OS_FdSet_ConvertOut_Impl(fd_set *output, OS_FdSet *Input) { if (objids & 0x01) { - id = (offset * 8) + bit; + id = OSAL_INDEX_C((offset * 8) + bit); osfd = OS_impl_filehandle_table[id].fd; if (osfd < 0 || !FD_ISSET(osfd, output)) { diff --git a/src/os/portable/os-impl-posix-io.c b/src/os/portable/os-impl-posix-io.c index 38e45918d..429e931b0 100644 --- a/src/os/portable/os-impl-posix-io.c +++ b/src/os/portable/os-impl-posix-io.c @@ -101,7 +101,8 @@ int32 OS_GenericClose_Impl(osal_index_t local_id) int32 OS_GenericSeek_Impl(osal_index_t local_id, int32 offset, uint32 whence) { int where; - int32 result; + off_t os_result; + int32 retval; switch (whence) { @@ -118,8 +119,8 @@ int32 OS_GenericSeek_Impl(osal_index_t local_id, int32 offset, uint32 whence) return OS_ERROR; } - result = lseek(OS_impl_filehandle_table[local_id].fd, (off_t)offset, where); - if (result < 0) + os_result = lseek(OS_impl_filehandle_table[local_id].fd, (off_t)offset, where); + if (os_result == (off_t)-1) { if (errno == ESPIPE) { @@ -130,7 +131,7 @@ int32 OS_GenericSeek_Impl(osal_index_t local_id, int32 offset, uint32 whence) * Use a different error code to differentiate from an * error involving a bad whence/offset */ - result = OS_ERR_NOT_IMPLEMENTED; + retval = OS_ERR_NOT_IMPLEMENTED; } else { @@ -138,11 +139,20 @@ int32 OS_GenericSeek_Impl(osal_index_t local_id, int32 offset, uint32 whence) * Most likely the "whence" and/or "offset" combo was not valid. */ OS_DEBUG("lseek: %s\n", strerror(errno)); - result = OS_ERROR; + retval = OS_ERROR; } } + else + { + /* + * convert value to int32 type for returning to caller. + * Note that this could potentially overflow an int32 + * for a large file seek. + */ + retval = (int32)os_result; + } - return result; + return retval; } /* end OS_GenericSeek_Impl */ /*---------------------------------------------------------------- @@ -155,9 +165,9 @@ int32 OS_GenericSeek_Impl(osal_index_t local_id, int32 offset, uint32 whence) *-----------------------------------------------------------------*/ int32 OS_GenericRead_Impl(osal_index_t local_id, void *buffer, size_t nbytes, int32 timeout) { - int32 return_code; - int os_result; - uint32 operation; + int32 return_code; + ssize_t os_result; + uint32 operation; return_code = OS_SUCCESS; @@ -188,7 +198,8 @@ int32 OS_GenericRead_Impl(osal_index_t local_id, void *buffer, size_t nbytes, in } else { - return_code = os_result; + /* type conversion from ssize_t to int32 for return */ + return_code = (int32)os_result; } } } @@ -206,9 +217,9 @@ int32 OS_GenericRead_Impl(osal_index_t local_id, void *buffer, size_t nbytes, in *-----------------------------------------------------------------*/ int32 OS_GenericWrite_Impl(osal_index_t local_id, const void *buffer, size_t nbytes, int32 timeout) { - int32 return_code; - int os_result; - uint32 operation; + int32 return_code; + ssize_t os_result; + uint32 operation; return_code = OS_SUCCESS; @@ -241,7 +252,8 @@ int32 OS_GenericWrite_Impl(osal_index_t local_id, const void *buffer, size_t nby } else { - return_code = os_result; + /* type conversion from ssize_t to int32 for return */ + return_code = (int32)os_result; } } } diff --git a/src/os/posix/src/os-impl-timebase.c b/src/os/posix/src/os-impl-timebase.c index a576332d9..a618435ac 100644 --- a/src/os/posix/src/os-impl-timebase.c +++ b/src/os/posix/src/os-impl-timebase.c @@ -480,7 +480,7 @@ int32 OS_TimeBaseCreate_Impl(osal_index_t timer_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseSet_Impl(osal_index_t timer_id, int32 start_time, int32 interval_time) +int32 OS_TimeBaseSet_Impl(osal_index_t timer_id, uint32 start_time, uint32 interval_time) { OS_impl_timebase_internal_record_t *local; struct itimerspec timeout; diff --git a/src/os/rtems/src/os-impl-timebase.c b/src/os/rtems/src/os-impl-timebase.c index 935386edc..c5c74370c 100644 --- a/src/os/rtems/src/os-impl-timebase.c +++ b/src/os/rtems/src/os-impl-timebase.c @@ -410,7 +410,7 @@ int32 OS_TimeBaseCreate_Impl(osal_index_t timer_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseSet_Impl(osal_index_t timer_id, int32 start_time, int32 interval_time) +int32 OS_TimeBaseSet_Impl(osal_index_t timer_id, uint32 start_time, uint32 interval_time) { OS_U32ValueWrapper_t user_data; OS_impl_timebase_internal_record_t *local; diff --git a/src/os/shared/inc/os-shared-common.h b/src/os/shared/inc/os-shared-common.h index e3654138e..7ad513e24 100644 --- a/src/os/shared/inc/os-shared-common.h +++ b/src/os/shared/inc/os-shared-common.h @@ -52,8 +52,8 @@ struct OS_shared_global_vars */ volatile bool PrintfEnabled; volatile uint32 ShutdownFlag; - int32 MicroSecPerTick; - int32 TicksPerSecond; + uint32 MicroSecPerTick; + uint32 TicksPerSecond; /* * The event handler is an application-defined callback diff --git a/src/os/shared/inc/os-shared-timebase.h b/src/os/shared/inc/os-shared-timebase.h index 109f05b10..9b8c9fe57 100644 --- a/src/os/shared/inc/os-shared-timebase.h +++ b/src/os/shared/inc/os-shared-timebase.h @@ -82,7 +82,7 @@ int32 OS_TimeBaseCreate_Impl(osal_index_t timebase_id); Returns: OS_SUCCESS on success, or relevant error code ------------------------------------------------------------------*/ -int32 OS_TimeBaseSet_Impl(osal_index_t timebase_id, int32 start_time, int32 interval_time); +int32 OS_TimeBaseSet_Impl(osal_index_t timebase_id, uint32 start_time, uint32 interval_time); /*---------------------------------------------------------------- Function: OS_TimeBaseDelete_Impl diff --git a/src/os/vxworks/src/os-impl-timebase.c b/src/os/vxworks/src/os-impl-timebase.c index e3d159317..8b75c100d 100644 --- a/src/os/vxworks/src/os-impl-timebase.c +++ b/src/os/vxworks/src/os-impl-timebase.c @@ -501,7 +501,7 @@ int32 OS_TimeBaseCreate_Impl(osal_index_t timer_id) * See prototype for argument/return detail * *-----------------------------------------------------------------*/ -int32 OS_TimeBaseSet_Impl(osal_index_t timer_id, int32 start_time, int32 interval_time) +int32 OS_TimeBaseSet_Impl(osal_index_t timer_id, uint32 start_time, uint32 interval_time) { OS_impl_timebase_internal_record_t *local; struct itimerspec timeout; diff --git a/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-files.h b/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-files.h index f5f62aceb..e048f5aa2 100644 --- a/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-files.h +++ b/src/unit-test-coverage/portable/adaptors/inc/ut-adaptor-portable-posix-files.h @@ -29,8 +29,9 @@ #define INCLUDE_UT_ADAPTOR_PORTABLE_POSIX_FILES_H_ #include +#include -unsigned int UT_PortablePosixFileTest_GetSelfEUID(void); -unsigned int UT_PortablePosixFileTest_GetSelfEGID(void); +OCS_uid_t UT_PortablePosixFileTest_GetSelfEUID(void); +OCS_gid_t UT_PortablePosixFileTest_GetSelfEGID(void); #endif /* INCLUDE_UT_ADAPTOR_PORTABLE_POSIX_FILES_H_ */ diff --git a/src/unit-test-coverage/portable/adaptors/src/ut-adaptor-portable-posix-files.c b/src/unit-test-coverage/portable/adaptors/src/ut-adaptor-portable-posix-files.c index 969dab756..e7a5bc79d 100644 --- a/src/unit-test-coverage/portable/adaptors/src/ut-adaptor-portable-posix-files.c +++ b/src/unit-test-coverage/portable/adaptors/src/ut-adaptor-portable-posix-files.c @@ -31,12 +31,12 @@ #include -unsigned int UT_PortablePosixFileTest_GetSelfEUID(void) +OCS_uid_t UT_PortablePosixFileTest_GetSelfEUID(void) { return OS_IMPL_SELF_EUID; } -unsigned int UT_PortablePosixFileTest_GetSelfEGID(void) +OCS_gid_t UT_PortablePosixFileTest_GetSelfEGID(void) { return OS_IMPL_SELF_EGID; } diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-files.c b/src/unit-test-coverage/portable/src/coveragetest-posix-files.c index d151748e5..9297ba9d9 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-files.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-files.c @@ -73,7 +73,7 @@ void Test_OS_FileStat_Impl(void) /* all permission bits with uid/gid match */ RefStat.st_uid = UT_PortablePosixFileTest_GetSelfEUID(); RefStat.st_gid = UT_PortablePosixFileTest_GetSelfEGID(); - RefStat.st_mode = ~0; + RefStat.st_mode = ~((OCS_mode_t)0); RefStat.st_size = 1234; RefStat.st_mtime = 5678; UT_SetDataBuffer(UT_KEY(OCS_stat), &RefStat, sizeof(RefStat), false); @@ -114,7 +114,7 @@ void Test_OS_FileChmod_Impl(void) /* all permission bits with uid/gid match */ RefStat.st_uid = UT_PortablePosixFileTest_GetSelfEUID(); RefStat.st_gid = UT_PortablePosixFileTest_GetSelfEGID(); - RefStat.st_mode = ~0; + RefStat.st_mode = ~((OCS_mode_t)0); RefStat.st_size = 1234; RefStat.st_mtime = 5678; UT_SetDataBuffer(UT_KEY(OCS_fstat), &RefStat, sizeof(RefStat), false); diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-io.c b/src/unit-test-coverage/portable/src/coveragetest-posix-io.c index a6d62de90..a91c4f849 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-io.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-io.c @@ -69,7 +69,7 @@ void Test_OS_GenericSeek_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, OS_SEEK_END), 333); /* bad whence */ - OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, -1234), OS_ERROR); + OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, 1234), OS_ERROR); /* generic failure of lseek() */ UT_SetForceFail(UT_KEY(OCS_lseek), -1); diff --git a/src/unit-test-coverage/ut-stubs/src/osapi-timer-impl-stubs.c b/src/unit-test-coverage/ut-stubs/src/osapi-timer-impl-stubs.c index 31a28c24c..29bb94214 100644 --- a/src/unit-test-coverage/ut-stubs/src/osapi-timer-impl-stubs.c +++ b/src/unit-test-coverage/ut-stubs/src/osapi-timer-impl-stubs.c @@ -38,7 +38,7 @@ ** OS Time/Tick related API */ UT_DEFAULT_STUB(OS_TimeBaseCreate_Impl, (osal_index_t timer_id)) -UT_DEFAULT_STUB(OS_TimeBaseSet_Impl, (osal_index_t timer_id, int32 start_time, int32 interval_time)) +UT_DEFAULT_STUB(OS_TimeBaseSet_Impl, (osal_index_t timer_id, uint32 start_time, uint32 interval_time)) UT_DEFAULT_STUB(OS_TimeBaseDelete_Impl, (osal_index_t timer_id)) void OS_TimeBaseLock_Impl(osal_index_t timebase_id) { From 66ad32e80e37fb2f790dfc70ec4c762701445d5d Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 17 Nov 2020 12:03:12 -0500 Subject: [PATCH 5/9] Fix #651, use unsigned types in VxWorks stack calculation This should avoid any inconsistencies in the event that the memory address translates to a negative numeric value. --- src/os/vxworks/inc/os-impl-tasks.h | 2 +- src/os/vxworks/src/os-impl-tasks.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/os/vxworks/inc/os-impl-tasks.h b/src/os/vxworks/inc/os-impl-tasks.h index 87cb15818..8ae32d36b 100644 --- a/src/os/vxworks/inc/os-impl-tasks.h +++ b/src/os/vxworks/inc/os-impl-tasks.h @@ -37,7 +37,7 @@ typedef struct WIND_TCB tcb; /* Must be first */ TASK_ID vxid; void * heap_block; /* set non-null if the stack was obtained with malloc() */ - long heap_block_size; + size_t heap_block_size; } OS_impl_task_internal_record_t; /* Tables where the OS object information is stored */ diff --git a/src/os/vxworks/src/os-impl-tasks.c b/src/os/vxworks/src/os-impl-tasks.c index fac9ae90e..5a20f266f 100644 --- a/src/os/vxworks/src/os-impl-tasks.c +++ b/src/os/vxworks/src/os-impl-tasks.c @@ -51,7 +51,7 @@ #if defined(_STACK_ALIGN_SIZE) #define VX_IMPL_STACK_ALIGN_SIZE _STACK_ALIGN_SIZE #else -#define VX_IMPL_STACK_ALIGN_SIZE 16 +#define VX_IMPL_STACK_ALIGN_SIZE ((size_t)16) #endif #if defined(STACK_ROUND_DOWN) @@ -122,9 +122,9 @@ int32 OS_TaskCreate_Impl(uint32 task_id, uint32 flags) STATUS status; int vxflags; int vxpri; - long actualsz; - long userstackbase; - long actualstackbase; + size_t actualsz; + unsigned long userstackbase; + unsigned long actualstackbase; OS_impl_task_internal_record_t *lrec; VxWorks_ID_Buffer_t id; @@ -147,7 +147,7 @@ int32 OS_TaskCreate_Impl(uint32 task_id, uint32 flags) */ vxpri = OS_task_table[task_id].priority; actualsz = OS_task_table[task_id].stack_size; - userstackbase = (long)OS_task_table[task_id].stack_pointer; + userstackbase = (unsigned long)OS_task_table[task_id].stack_pointer; /* * NOTE: Using taskInit() here rather than taskSpawn() allows us @@ -213,7 +213,7 @@ int32 OS_TaskCreate_Impl(uint32 task_id, uint32 flags) } } - userstackbase = (long)lrec->heap_block; + userstackbase = (unsigned long)lrec->heap_block; } if (userstackbase == 0) From 309b23728561837fcb6b075dd1842fe82ba7a34a Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Mon, 23 Nov 2020 13:48:13 -0500 Subject: [PATCH 6/9] Fix #559 cleaning up Rebasing --- .../portable/src/coveragetest-posix-files.c | 5 --- .../portable/src/coveragetest-posix-io.c | 33 ++----------------- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-files.c b/src/unit-test-coverage/portable/src/coveragetest-posix-files.c index e07a87905..372914b28 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-files.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-files.c @@ -47,13 +47,8 @@ void Test_OS_FileOpen_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (UT_INDEX_0, "local", 0, -1234), OS_ERROR); /* failure mode */ -<<<<<<< HEAD UT_SetDefaultReturnValue(UT_KEY(OCS_open), -1); - OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (0, "local", 0, OS_READ_ONLY), OS_ERROR); -======= - UT_SetForceFail(UT_KEY(OCS_open), -1); OSAPI_TEST_FUNCTION_RC(OS_FileOpen_Impl, (UT_INDEX_0, "local", 0, OS_READ_ONLY), OS_ERROR); ->>>>>>> refs/rewritten/onto } void Test_OS_FileStat_Impl(void) diff --git a/src/unit-test-coverage/portable/src/coveragetest-posix-io.c b/src/unit-test-coverage/portable/src/coveragetest-posix-io.c index af27b0cda..b272d9792 100644 --- a/src/unit-test-coverage/portable/src/coveragetest-posix-io.c +++ b/src/unit-test-coverage/portable/src/coveragetest-posix-io.c @@ -49,13 +49,8 @@ void Test_OS_GenericClose_Impl(void) * Test path where underlying close() fails. * Should still return success. */ -<<<<<<< HEAD UT_SetDefaultReturnValue(UT_KEY(OCS_close), -1); - OSAPI_TEST_FUNCTION_RC(OS_GenericClose_Impl, (0), OS_SUCCESS); -======= - UT_SetForceFail(UT_KEY(OCS_close), -1); OSAPI_TEST_FUNCTION_RC(OS_GenericClose_Impl, (UT_INDEX_0), OS_SUCCESS); ->>>>>>> refs/rewritten/onto } void Test_OS_GenericSeek_Impl(void) @@ -66,33 +61,19 @@ void Test_OS_GenericSeek_Impl(void) */ /* note on success this wrapper returns the result of lseek(), not OS_SUCCESS */ -<<<<<<< HEAD UT_SetDefaultReturnValue(UT_KEY(OCS_lseek), 111); - OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_CUR), 111); - UT_SetDefaultReturnValue(UT_KEY(OCS_lseek), 222); - OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_SET), 222); - UT_SetDefaultReturnValue(UT_KEY(OCS_lseek), 333); - OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_END), 333); -======= - UT_SetForceFail(UT_KEY(OCS_lseek), 111); OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, OS_SEEK_CUR), 111); - UT_SetForceFail(UT_KEY(OCS_lseek), 222); + UT_SetDefaultReturnValue(UT_KEY(OCS_lseek), 222); OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, OS_SEEK_SET), 222); - UT_SetForceFail(UT_KEY(OCS_lseek), 333); + UT_SetDefaultReturnValue(UT_KEY(OCS_lseek), 333); OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, OS_SEEK_END), 333); ->>>>>>> refs/rewritten/onto /* bad whence */ OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, 1234), OS_ERROR); /* generic failure of lseek() */ -<<<<<<< HEAD UT_SetDefaultReturnValue(UT_KEY(OCS_lseek), -1); - OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (0, 0, OS_SEEK_END), OS_ERROR); -======= - UT_SetForceFail(UT_KEY(OCS_lseek), -1); OSAPI_TEST_FUNCTION_RC(OS_GenericSeek_Impl, (UT_INDEX_0, 0, OS_SEEK_END), OS_ERROR); ->>>>>>> refs/rewritten/onto /* The seek implementation also checks for this specific pipe errno */ OCS_errno = OCS_ESPIPE; @@ -121,13 +102,8 @@ void Test_OS_GenericRead_Impl(void) UtAssert_True(UT_GetStubCount(UT_KEY(OS_SelectSingle_Impl)) == 1, "OS_SelectSingle() called"); /* read() failure */ -<<<<<<< HEAD UT_SetDefaultReturnValue(UT_KEY(OCS_read), -1); - OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (0, DestData, sizeof(DestData), 0), OS_ERROR); -======= - UT_SetForceFail(UT_KEY(OCS_read), -1); OSAPI_TEST_FUNCTION_RC(OS_GenericRead_Impl, (UT_INDEX_0, DestData, sizeof(DestData), 0), OS_ERROR); ->>>>>>> refs/rewritten/onto } void Test_OS_GenericWrite_Impl(void) @@ -152,13 +128,8 @@ void Test_OS_GenericWrite_Impl(void) UtAssert_True(UT_GetStubCount(UT_KEY(OS_SelectSingle_Impl)) == 1, "OS_SelectSingle() called"); /* write() failure */ -<<<<<<< HEAD UT_SetDefaultReturnValue(UT_KEY(OCS_write), -1); - OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (0, DestData, sizeof(DestData), 0), OS_ERROR); -======= - UT_SetForceFail(UT_KEY(OCS_write), -1); OSAPI_TEST_FUNCTION_RC(OS_GenericWrite_Impl, (UT_INDEX_0, DestData, sizeof(DestData), 0), OS_ERROR); ->>>>>>> refs/rewritten/onto } /* ------------------- End of test cases --------------------------------------*/ From 7af2c3f7b5187a6e21ba3f3e9931de864f2dde99 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Mon, 30 Nov 2020 23:17:58 -0500 Subject: [PATCH 7/9] HOTFIX #662, add missing UT_SetDefaultReturnValue --- src/unit-test-coverage/vxworks/src/coveragetest-symtab.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c b/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c index 2b2607a2a..c7fddf233 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-symtab.c @@ -56,8 +56,7 @@ void Test_OS_ModuleSymbolLookup_Impl(void) OSAPI_TEST_FUNCTION_RC(OS_ModuleSymbolLookup_Impl(UT_INDEX_0, &SymAddr, "symname"), OS_SUCCESS); OSAPI_TEST_FUNCTION_RC(OS_ModuleSymbolLookup_Impl(UT_INDEX_0, NULL, NULL), OS_INVALID_POINTER); - UT_SetForceFail(UT_KEY(OCS_symFind), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_ModuleSymbolLookup_Impl(UT_INDEX_0, &SymAddr, "symname"), OS_ERROR); + UT_SetDefaultReturnValue(UT_KEY(OCS_symFind), OCS_ERROR); OSAPI_TEST_FUNCTION_RC(OS_ModuleSymbolLookup_Impl(UT_INDEX_0, &SymAddr, "symname"), OS_ERROR); } void Test_OS_SymTableIterator_Impl(void) From 720c76779a57a06139c51b1e6d975c8dcd818949 Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Wed, 11 Nov 2020 09:46:12 -0500 Subject: [PATCH 8/9] fix #586 add functional test of one shot timer. --- src/tests/timer-test/timer-test.c | 55 ++++++++++++++++++------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/src/tests/timer-test/timer-test.c b/src/tests/timer-test/timer-test.c index 9d2e82fc3..4d86367d1 100644 --- a/src/tests/timer-test/timer-test.c +++ b/src/tests/timer-test/timer-test.c @@ -33,7 +33,7 @@ #include "uttest.h" #include "utbsp.h" -#define NUMBER_OF_TIMERS 4 +#define NUMBER_OF_TIMERS 5 #define TASK_1_ID 1 #define TASK_1_STACK_SIZE 4096 @@ -45,8 +45,8 @@ void TimerTestCheck(void); OS_time_t StartTime; OS_time_t EndTime; -uint32 TimerStart[NUMBER_OF_TIMERS] = {1000, 2000000, 3000000, 4000000}; -uint32 TimerInterval[NUMBER_OF_TIMERS] = {500000, 400000, 800000, 600000}; +uint32 TimerStart[NUMBER_OF_TIMERS] = {1000, 2000000, 3000000, 4000000, 1000000}; +uint32 TimerInterval[NUMBER_OF_TIMERS] = {500000, 400000, 800000, 600000, 0}; uint32 TimerTestTaskStack[TASK_1_STACK_SIZE]; int32 timer_counter[NUMBER_OF_TIMERS]; @@ -111,12 +111,12 @@ void TimerTestSetup(void) void TimerTestTask(void) { - int i = 0; - int32 TimerStatus[NUMBER_OF_TIMERS]; - osal_index_t TableId; - osal_id_t TimerID[NUMBER_OF_TIMERS]; - char TimerName[NUMBER_OF_TIMERS][20] = {"TIMER1", "TIMER2", "TIMER3", "TIMER4"}; - uint32 ClockAccuracy; + int i = 0; + int32 TimerStatus[NUMBER_OF_TIMERS]; + osal_index_t TableId; + osal_id_t TimerID[NUMBER_OF_TIMERS]; + char TimerName[NUMBER_OF_TIMERS][20] = {"TIMER1", "TIMER2", "TIMER3", "TIMER4", "TIMER5"}; + uint32 ClockAccuracy; for (i = 0; i < NUMBER_OF_TIMERS && i < OS_MAX_TIMERS; i++) { @@ -202,18 +202,29 @@ void TimerTestCheck(void) /* Make sure the ratio of the timers are OK */ for (i = 0; i < NUMBER_OF_TIMERS && i < OS_MAX_TIMERS; i++) { - /* - * Expect one tick after the start time (i.e. first tick) - * Plus one tick for every interval that occurred during the test - */ - expected = 1 + (microsecs - TimerStart[i]) / TimerInterval[i]; - UtAssert_True(expected > 0, "Expected ticks = %u", (unsigned int)expected); - - /* - * Since all these counts are affected by test system load, - * allow for some fudge factor before declaring failure - */ - UtAssert_True(timer_counter[i] >= (expected - 3), "Timer %d count >= %d", (int)i, (int)(expected - 3)); - UtAssert_True(timer_counter[i] <= (expected + 3), "Timer %d count <= %d", (int)i, (int)(expected + 3)); + if (TimerInterval[i] == 0) + { + /* + * When the Timer Interval is 0, it's a one shot so expect eaxctly 1 tick + */ + expected = 1; + UtAssert_True(timer_counter[i] == (expected), "Timer %d count = %d", (int)i, (int)(expected)); + } + else + { + /* + * Expect one tick after the start time (i.e. first tick) + * Plus one tick for every interval that occurred during the test + */ + expected = 1 + (microsecs - TimerStart[i]) / TimerInterval[i]; + UtAssert_True(expected > 0, "Expected ticks = %u", (unsigned int)expected); + + /* + * Since all these counts are affected by test system load, + * allow for some fudge factor before declaring failure + */ + UtAssert_True(timer_counter[i] >= (expected - 3), "Timer %d count >= %d", (int)i, (int)(expected - 3)); + UtAssert_True(timer_counter[i] <= (expected + 3), "Timer %d count <= %d", (int)i, (int)(expected + 3)); + } } } From 42d6de68900d2b24367f0e9df29d96efef94f277 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Wed, 2 Dec 2020 09:29:11 -0500 Subject: [PATCH 9/9] Bump to v5.1.0-rc1+dev91 and update README Integration Candidate 2020-11-24 --- README.md | 10 ++++++++++ src/os/inc/osapi-version.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b8741f519..8be71b9c4 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,16 @@ The autogenerated OSAL user's guide can be viewed at + + ### Development Build: 5.1.0-rc1+dev75 - Ensure that the handle is not NULL before invoking dlclose(). In particular the handle will be NULL for static modules. Shutdown after CTRL+C occurs normally (no segfault). diff --git a/src/os/inc/osapi-version.h b/src/os/inc/osapi-version.h index f8df9294b..66d55dab0 100644 --- a/src/os/inc/osapi-version.h +++ b/src/os/inc/osapi-version.h @@ -30,7 +30,7 @@ /* * Development Build Macro Definitions */ -#define OS_BUILD_NUMBER 75 +#define OS_BUILD_NUMBER 91 #define OS_BUILD_BASELINE "v5.1.0-rc1" /*