Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vxworks7 #592

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/bsp/5020-vxworks7/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
######################################################################
#
# CMAKE build recipe for MCP750 Board Support Package (BSP)
#
######################################################################

add_library(osal_5020-vxworks7_impl OBJECT
src/bsp_start.c
src/bsp_console.c
)

target_include_directories(osal_5020-vxworks7_impl PUBLIC
$ENV{WIND_BASE}/target/h
#$ENV{WIND_BASE}/target/h/wrn/coreip
#$ENV{WIND_BASE}/target/config/mcp750
)

# NOTE: the __PPC__ and MCP750 macros are referenced in some system headers.
# therefore all code compiled for this platform should always define these symbols.
target_compile_definitions(osal_5020-vxworks7_impl PUBLIC
"__PPC__"
#"MCP750"
)

# This BSP only works with "vxworks" OS layer.
# Confirming this reduces risk of accidental misconfiguration
set(OSAL_EXPECTED_OSTYPE "vxworks7" PARENT_SCOPE)
11 changes: 11 additions & 0 deletions src/bsp/5020-vxworks7/build_options.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
##########################################################################
#
# Build options for "mcp750-vxworks" BSP
#
##########################################################################

# This indicates where to stage target binaries created during the build
set(OSAL_BSP_STAGING_INSTALL_DIR "CF:0")

# The "-u" switch is required to ensure that "ldppc" pulls in the OS_BSPMain entry point
target_link_libraries(osal_bsp -uOS_BSPMain)
21 changes: 21 additions & 0 deletions src/bsp/5020-vxworks7/src/bsp.mak
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
###############################################################################
# File: bsp.mak
#
# Purpose:
# Compile Board Support Package routines
#
# History:
#
###############################################################################

# Subsystem produced by this makefile.
TARGET = bsp.o

#==============================================================================
# Object files required to build subsystem.
OBJS = bsp_start.o bsp_voltab.o

#==============================================================================
# Source files required to build subsystem; used to generate dependencies.
SOURCES = bsp_start.c bsp_voltab.c

52 changes: 52 additions & 0 deletions src/bsp/5020-vxworks7/src/bsp_console.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/******************************************************************************
** File: bsp_console.c
**
**
** This is governed by the NASA Open Source Agreement and may be used,
** distributed and modified only pursuant to the terms of that agreement.
**
** Copyright (c) 2004-2006, United States government as represented by the
** administrator of the National Aeronautics Space Administration.
** All rights reserved.
**
**
** Purpose:
** OSAL BSP debug console abstraction
**
******************************************************************************/

#include <string.h>
#include <unistd.h>
#include <stdio.h>

#include "mcp750_bsp_internal.h"
#include "bsp-impl.h"

/****************************************************************************************
BSP CONSOLE IMPLEMENTATION FUNCTIONS
****************************************************************************************/

/*----------------------------------------------------------------
OS_BSP_ConsoleOutput_Impl
See full description in header
------------------------------------------------------------------*/
void OS_BSP_ConsoleOutput_Impl(const char *Str, uint32 DataLen)
{
while (DataLen > 0)
{
putchar(*Str);
++Str;
--DataLen;
}
}

/*----------------------------------------------------------------
OS_BSP_ConsoleSetMode_Impl() definition
See full description in header
------------------------------------------------------------------*/
void OS_BSP_ConsoleSetMode_Impl(uint32 ModeBits)
{
/* ignored; not implemented */
}


65 changes: 65 additions & 0 deletions src/bsp/5020-vxworks7/src/bsp_start.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/******************************************************************************
** File: bsp_start.c
**
** This is governed by the NASA Open Source Agreement and may be used,
** distributed and modified only pursuant to the terms of that agreement.
**
** Copyright (c) 2004-2006, United States government as represented by the
** administrator of the National Aeronautics Space Administration.
** All rights reserved.
**
** Purpose:
**
** OSAL main entry point.
**
** History:
**
******************************************************************************/

/*
** Include Files
*/
#include <stdlib.h>
#include <string.h>

#include "mcp750_bsp_internal.h"

/******************************************************************************
** Function: OS_BSPMain()
**
** Purpose:
** vxWorks/BSP Application entry point.
**
** Arguments:
** (none)
**
** Return:
** integer return code, with zero indicating normal exit, nonzero
** indicating an off-nominal condition
*/

int OS_BSPMain(void)
{
/*
* Initially clear the global object (this contains return code)
*/
memset(&OS_BSP_Global, 0, sizeof(OS_BSP_Global));

/*
* Call application specific entry point.
* This should set up all user tasks and resources, then return
*/
OS_Application_Startup();

/*
* OS_Application_Run() implements the background task.
* The user application may provide this, or a default implementation
* is used which just calls OS_IdleLoop().
*/
OS_Application_Run();

/*
* Return to shell with the current status code
*/
return OS_BSP_Global.AppStatus;
}
27 changes: 27 additions & 0 deletions src/bsp/5020-vxworks7/src/mcp750_bsp_internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/******************************************************************************
** File: mcp750_bsp_internal.h
**
**
** This is governed by the NASA Open Source Agreement and may be used,
** distributed and modified only pursuant to the terms of that agreement.
**
** Copyright (c) 2004-2006, United States government as represented by the
** administrator of the National Aeronautics Space Administration.
** All rights reserved.
**
**
** Purpose:
** Header file for internal data to the MCP750 BSP
**
******************************************************************************/

#ifndef _MCP750_BSP_INTERNAL_H_
#define _MCP750_BSP_INTERNAL_H_

/*
** OSAL includes
*/
#include "osapi.h"
#include "bsp-impl.h"

#endif /* _MCP750_BSP_INTERNAL_H_ */
2 changes: 1 addition & 1 deletion src/bsp/generic-linux/src/bsp_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void OS_BSP_ConsoleOutput_Impl(const char *Str, uint32 DataLen)
break;
}
Str += WriteLen;
DataLen -= WriteLen;
DataLen -= (uint32)WriteLen;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/bsp/generic-linux/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (uint32)strtoul(buffer, NULL, 10);
BSP_DEBUG("Maximum user msg queue depth = %u\n", (unsigned int)OS_BSP_Global.MaxQueueDepth);
}
fclose(fp);
Expand Down Expand Up @@ -154,7 +154,7 @@ int main(int argc, char *argv[])
* might still want to use library "getopt" and this expects the
* first parameter to be this way.
*/
OS_BSP_Global.ArgC = argc;
OS_BSP_Global.ArgC = (uint32)argc;
OS_BSP_Global.ArgV = argv;

/*
Expand Down
6 changes: 3 additions & 3 deletions src/os/portable/os-impl-bsd-select.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ static void OS_FdSet_ConvertOut_Impl(fd_set *output, OS_FdSet *Input)
osfd = OS_impl_filehandle_table[id].fd;
if (osfd < 0 || !FD_ISSET(osfd, output))
{
Input->object_ids[offset] &= ~(1 << bit);
Input->object_ids[offset] &= (uint8)~(1 << bit);
}
}
++bit;
Expand Down Expand Up @@ -285,11 +285,11 @@ int32 OS_SelectSingle_Impl(uint32 stream_id, uint32 *SelectFlags, int32 msecs)
{
if (!FD_ISSET(OS_impl_filehandle_table[stream_id].fd, &rd_set))
{
*SelectFlags &= ~OS_STREAM_STATE_READABLE;
*SelectFlags &= (uint32)~OS_STREAM_STATE_READABLE;
}
if (!FD_ISSET(OS_impl_filehandle_table[stream_id].fd, &wr_set))
{
*SelectFlags &= ~OS_STREAM_STATE_WRITABLE;
*SelectFlags &= (uint32)~OS_STREAM_STATE_WRITABLE;
}
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/os/portable/os-impl-bsd-sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ int32 OS_SocketRecvFrom_Impl(uint32 sock_id, void *buffer, uint32 buflen, OS_Soc
}
else
{
os_result = recvfrom(OS_impl_filehandle_table[sock_id].fd, buffer, buflen, waitflags, sa, &addrlen);
os_result = (int)recvfrom(OS_impl_filehandle_table[sock_id].fd, buffer, buflen, waitflags, sa, &addrlen);
if (os_result < 0)
{
if (errno == EAGAIN || errno == EWOULDBLOCK)
Expand Down Expand Up @@ -493,7 +493,7 @@ int32 OS_SocketSendTo_Impl(uint32 sock_id, const void *buffer, uint32 buflen, co
return OS_ERR_BAD_ADDRESS;
}

os_result = sendto(OS_impl_filehandle_table[sock_id].fd, buffer, buflen, MSG_DONTWAIT, sa, addrlen);
os_result = (int)sendto(OS_impl_filehandle_table[sock_id].fd, buffer, buflen, MSG_DONTWAIT, sa, addrlen);
if (os_result < 0)
{
OS_DEBUG("sendto: %s\n",strerror(errno));
Expand Down
4 changes: 2 additions & 2 deletions src/os/portable/os-impl-console-bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ void OS_ConsoleOutput_Impl(uint32 local_id)
}

OS_BSP_ConsoleOutput_Impl(&console->BufBase[StartPos],
WriteSize);
(uint32)WriteSize);

StartPos += WriteSize;
StartPos += (uint32)WriteSize;
if (StartPos >= console->BufSize)
{
/* handle wrap */
Expand Down
4 changes: 2 additions & 2 deletions src/os/portable/os-impl-posix-files.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ int32 OS_FileStat_Impl(const char *local_path, os_fstat_t *FileStats)
return OS_ERROR;
}

FileStats->FileSize = st.st_size;
FileStats->FileTime = st.st_mtime;
FileStats->FileSize = (uint32)st.st_size;
FileStats->FileTime = (int32)st.st_mtime;

/* note that the "fst_mode" member is already zeroed by the caller */
if (S_ISDIR(st.st_mode))
Expand Down
4 changes: 2 additions & 2 deletions src/os/portable/os-impl-posix-gettime.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ int32 OS_GetLocalTime_Impl(OS_time_t *time_struct)

if (Status == 0)
{
time_struct -> seconds = time.tv_sec;
time_struct -> microsecs = time.tv_nsec / 1000;
time_struct -> seconds = (uint32)time.tv_sec;
time_struct -> microsecs = (uint32)time.tv_nsec / 1000;
ReturnCode = OS_SUCCESS;
}
else
Expand Down
16 changes: 8 additions & 8 deletions src/os/portable/os-impl-posix-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ int32 OS_GenericClose_Impl(uint32 local_id)
int32 OS_GenericSeek_Impl (uint32 local_id, int32 offset, uint32 whence)
{
int where;
int32 result;
off_t result;

switch(whence)
{
Expand Down Expand Up @@ -144,7 +144,7 @@ int32 OS_GenericSeek_Impl (uint32 local_id, int32 offset, uint32 whence)
}
}

return result;
return (int32)result;
} /* end OS_GenericSeek_Impl */

/*----------------------------------------------------------------
Expand All @@ -158,7 +158,7 @@ int32 OS_GenericSeek_Impl (uint32 local_id, int32 offset, uint32 whence)
int32 OS_GenericRead_Impl (uint32 local_id, void *buffer, uint32 nbytes, int32 timeout)
{
int32 return_code;
int os_result;
ssize_t os_result;
uint32 operation;

return_code = OS_SUCCESS;
Expand Down Expand Up @@ -190,12 +190,12 @@ int32 OS_GenericRead_Impl (uint32 local_id, void *buffer, uint32 nbytes, int32 t
}
else
{
return_code = os_result;
return_code = (int32)os_result;
}
}
}

return (return_code);
return (int32)(return_code);
} /* end OS_GenericRead_Impl */

/*----------------------------------------------------------------
Expand All @@ -209,7 +209,7 @@ int32 OS_GenericRead_Impl (uint32 local_id, void *buffer, uint32 nbytes, int32 t
int32 OS_GenericWrite_Impl(uint32 local_id, const void *buffer, uint32 nbytes, int32 timeout)
{
int32 return_code;
int os_result;
ssize_t os_result;
uint32 operation;

return_code = OS_SUCCESS;
Expand Down Expand Up @@ -244,11 +244,11 @@ int32 OS_GenericWrite_Impl(uint32 local_id, const void *buffer, uint32 nbytes, i
}
else
{
return_code = os_result;
return_code = (int32)os_result;
}
}
}

return (return_code);
return (int32)(return_code);
} /* end OS_GenericWrite_Impl */

2 changes: 1 addition & 1 deletion src/os/portable/os-impl-posix-network.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int32 OS_NetworkGetHostName_Impl (char *host_name, uint32 name_len)
int32 OS_NetworkGetID_Impl (int32 *IdBuf)
{
/* gethostid() has no failure modes */
*IdBuf = gethostid();
*IdBuf = (int32)gethostid();
return OS_SUCCESS;
} /* end OS_NetworkGetID_Impl */

Expand Down
2 changes: 1 addition & 1 deletion src/os/posix/src/os-impl-binsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ int32 OS_BinSemCreate_Impl (uint32 sem_id, uint32 initial_value, uint32 options)
** fill out the proper OSAL table fields
*/

sem->current_value = initial_value;
sem->current_value = (sig_atomic_t)initial_value;

return_code = OS_SUCCESS;
}
Expand Down
Loading