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

Fix #625, Apply standard formatting #626

Merged
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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 @@ -76,7 +76,7 @@ void OS_BSP_ConsoleOutput_Impl(const char *Str, uint32 DataLen)
{
ssize_t WriteLen;

while(DataLen > 0)
while (DataLen > 0)
{
/* writes the raw data directly to STDOUT_FILENO (unbuffered) */
WriteLen = write(STDOUT_FILENO, Str, DataLen);
Expand Down
38 changes: 18 additions & 20 deletions src/bsp/generic-linux/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ OS_BSP_GenericLinuxGlobalData_t OS_BSP_GenericLinuxGlobal;
void OS_BSP_Initialize(void)
{
FILE *fp;
char buffer[32];
char buffer[32];

/*
* If not running as root, check /proc/sys/fs/mqueue/msg_max
Expand All @@ -64,10 +64,10 @@ void OS_BSP_Initialize(void)
*/
if (geteuid() != 0)
{
fp = fopen("/proc/sys/fs/mqueue/msg_max","r");
fp = fopen("/proc/sys/fs/mqueue/msg_max", "r");
if (fp)
{
if (fgets(buffer,sizeof(buffer),fp) != NULL)
if (fgets(buffer, sizeof(buffer), fp) != NULL)
{
OS_BSP_Global.MaxQueueDepth = strtoul(buffer, NULL, 10);
BSP_DEBUG("Maximum user msg queue depth = %u\n", (unsigned int)OS_BSP_Global.MaxQueueDepth);
Expand All @@ -89,22 +89,21 @@ int OS_BSP_GetReturnStatus(void)

switch (OS_BSP_Global.AppStatus)
{
case OS_SUCCESS:
/* translate OS_SUCCESS to the system EXIT_SUCCESS value (usually 0) */
retcode = EXIT_SUCCESS;
break;

case OS_ERROR:
/* translate OS_ERROR to the system EXIT_FAILURE value (usually 1) */
retcode = EXIT_FAILURE;
break;

default:
/* any other value will be passed through (implementation-defined) */
/* Range is limited to 0-127, however */
retcode = OS_BSP_Global.AppStatus & 0x7F;
break;

case OS_SUCCESS:
/* translate OS_SUCCESS to the system EXIT_SUCCESS value (usually 0) */
retcode = EXIT_SUCCESS;
break;

case OS_ERROR:
/* translate OS_ERROR to the system EXIT_FAILURE value (usually 1) */
retcode = EXIT_FAILURE;
break;

default:
/* any other value will be passed through (implementation-defined) */
/* Range is limited to 0-127, however */
retcode = OS_BSP_Global.AppStatus & 0x7F;
break;
}

return retcode;
Expand All @@ -120,7 +119,6 @@ void OS_BSP_Shutdown_Impl(void)
abort();
}


/******************************************************************************
** Function: main()
**
Expand Down
2 changes: 1 addition & 1 deletion src/bsp/generic-linux/src/generic_linux_bsp_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
typedef struct
{
bool EnableTermControl; /**< Will be set "true" when invoked from a TTY device, false otherwise */
bool EnableTermControl; /**< Will be set "true" when invoked from a TTY device, false otherwise */
} OS_BSP_GenericLinuxGlobalData_t;

/*
Expand Down
2 changes: 0 additions & 2 deletions src/bsp/generic-vxworks/src/bsp_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,3 @@ void OS_BSP_ConsoleSetMode_Impl(uint32 ModeBits)
{
/* ignored; not implemented */
}


1 change: 0 additions & 1 deletion src/bsp/generic-vxworks/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ void OS_BSP_Shutdown_Impl(void)
abort();
}


/******************************************************************************
** Function: OS_BSPMain()
**
Expand Down
2 changes: 0 additions & 2 deletions src/bsp/pc-rtems/src/bsp_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,3 @@ void OS_BSP_ConsoleSetMode_Impl(uint32 ModeBits)
{
/* no-op on RTEMS */
}


93 changes: 38 additions & 55 deletions src/bsp/pc-rtems/src/bsp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,17 @@
** External Declarations
*/
extern rtems_status_code rtems_ide_part_table_initialize(const char *);
extern int rtems_rtl_shell_command (int argc, char* argv[]);
extern int rtems_rtl_shell_command(int argc, char *argv[]);

/*
* Additional shell commands for the RTL functionality
*/
rtems_shell_cmd_t rtems_shell_RTL_Command = {
.name = "rtl",
.usage = "rtl COMMAND...",
.topic = "misc",
.command = rtems_rtl_shell_command
};
.name = "rtl", .usage = "rtl COMMAND...", .topic = "misc", .command = rtems_rtl_shell_command};
rtems_shell_cmd_t rtems_shell_dlopen_Command = {
.name = "dlopen",
.usage = "dlopen COMMAND...",
.topic = "misc",
.command = shell_dlopen
};
.name = "dlopen", .usage = "dlopen COMMAND...", .topic = "misc", .command = shell_dlopen};
rtems_shell_cmd_t rtems_shell_dlsym_Command = {
.name = "dlsym",
.usage = "dlsym COMMAND...",
.topic = "misc",
.command = shell_dlsym
};

.name = "dlsym", .usage = "dlsym COMMAND...", .topic = "misc", .command = shell_dlsym};

/*
** Global variables
Expand All @@ -87,11 +74,11 @@ OS_BSP_PcRtemsGlobalData_t OS_BSP_PcRtemsGlobal;

void OS_BSP_Setup(void)
{
int status;
struct stat statbuf;
const char * cmdlinestr;
const char * cmdp;
char * cmdi, *cmdo;
int status;
struct stat statbuf;
const char *cmdlinestr;
const char *cmdp;
char * cmdi, *cmdo;

cmdlinestr = bsp_cmdline();

Expand Down Expand Up @@ -218,8 +205,8 @@ void OS_BSP_Setup(void)
}
else
{
status = mount("/dev/hda1", RTEMS_USER_FS_MOUNTPOINT, RTEMS_FILESYSTEM_TYPE_DOSFS,
RTEMS_FILESYSTEM_READ_WRITE, NULL);
status = mount("/dev/hda1", RTEMS_USER_FS_MOUNTPOINT, RTEMS_FILESYSTEM_TYPE_DOSFS, RTEMS_FILESYSTEM_READ_WRITE,
NULL);
if (status < 0)
{
BSP_DEBUG("mount failed: %s\n", strerror(errno));
Expand All @@ -234,7 +221,6 @@ void OS_BSP_Setup(void)
*/
chdir(RTEMS_USER_FS_MOUNTPOINT);


/*
* Start the shell now, before any application starts.
* This way, if there is an issue with the application startup,
Expand Down Expand Up @@ -275,18 +261,18 @@ rtems_status_code OS_BSP_GetReturnStatus(void)

switch (OS_BSP_Global.AppStatus)
{
case OS_SUCCESS:
/* translate OS_SUCCESS to the system RTEMS_SUCCESSFUL value */
StatusStr = "SUCCESS";
retcode = RTEMS_SUCCESSFUL;
break;

default:
/* translate anything else to a generic non-success code,
* this basically just means the main task exited */
StatusStr = "ERROR";
retcode = RTEMS_TASK_EXITTED;
break;
case OS_SUCCESS:
/* translate OS_SUCCESS to the system RTEMS_SUCCESSFUL value */
StatusStr = "SUCCESS";
retcode = RTEMS_SUCCESSFUL;
break;

default:
/* translate anything else to a generic non-success code,
* this basically just means the main task exited */
StatusStr = "ERROR";
retcode = RTEMS_TASK_EXITTED;
break;
}

printf("\nApplication exit status: %s (%d)\n\n", StatusStr, (int)OS_BSP_Global.AppStatus);
Expand Down Expand Up @@ -364,9 +350,10 @@ rtems_task Init(rtems_task_argument ignored)
*/
#define TASK_INTLEVEL 0
#define CONFIGURE_INIT
#define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_FLOATING_POINT | RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_ASR | RTEMS_INTERRUPT_LEVEL(TASK_INTLEVEL))
#define CONFIGURE_INIT_TASK_STACK_SIZE (20*1024)
#define CONFIGURE_INIT_TASK_PRIORITY 10
#define CONFIGURE_INIT_TASK_ATTRIBUTES \
(RTEMS_FLOATING_POINT | RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_ASR | RTEMS_INTERRUPT_LEVEL(TASK_INTLEVEL))
#define CONFIGURE_INIT_TASK_STACK_SIZE (20 * 1024)
#define CONFIGURE_INIT_TASK_PRIORITY 10

/*
* Note that these resources are shared with RTEMS itself (e.g. the init task, the shell)
Expand All @@ -383,13 +370,13 @@ rtems_task Init(rtems_task_argument ignored)
* 16 internal semaphores
*
*/
#define CONFIGURE_MAXIMUM_TASKS (OS_MAX_TASKS + 8)
#define CONFIGURE_MAXIMUM_TIMERS (OS_MAX_TIMERS + 2)
#define CONFIGURE_MAXIMUM_SEMAPHORES (OS_MAX_BIN_SEMAPHORES + OS_MAX_COUNT_SEMAPHORES + OS_MAX_MUTEXES + 16)
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES (OS_MAX_QUEUES + 4)
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS (OS_MAX_NUM_OPEN_FILES + 8)
#define CONFIGURE_MAXIMUM_DRIVERS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 4
#define CONFIGURE_MAXIMUM_TASKS (OS_MAX_TASKS + 8)
#define CONFIGURE_MAXIMUM_TIMERS (OS_MAX_TIMERS + 2)
#define CONFIGURE_MAXIMUM_SEMAPHORES (OS_MAX_BIN_SEMAPHORES + OS_MAX_COUNT_SEMAPHORES + OS_MAX_MUTEXES + 16)
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES (OS_MAX_QUEUES + 4)
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS (OS_MAX_NUM_OPEN_FILES + 8)
#define CONFIGURE_MAXIMUM_DRIVERS 10
#define CONFIGURE_MAXIMUM_POSIX_KEYS 4

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
Expand All @@ -403,20 +390,16 @@ rtems_task Init(rtems_task_argument ignored)
#define CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER

#define CONFIGURE_EXECUTIVE_RAM_SIZE (8*1024*1024)
#define CONFIGURE_MICROSECONDS_PER_TICK 10000
#define CONFIGURE_ATA_DRIVER_TASK_PRIORITY 9
#define CONFIGURE_EXECUTIVE_RAM_SIZE (8 * 1024 * 1024)
#define CONFIGURE_MICROSECONDS_PER_TICK 10000
#define CONFIGURE_ATA_DRIVER_TASK_PRIORITY 9

#include <rtems/confdefs.h>

#define CONFIGURE_SHELL_COMMANDS_INIT
#define CONFIGURE_SHELL_COMMANDS_ALL
#define CONFIGURE_SHELL_MOUNT_MSDOS

#define CONFIGURE_SHELL_USER_COMMANDS \
&rtems_shell_RTL_Command, \
&rtems_shell_dlopen_Command, \
&rtems_shell_dlsym_Command

#define CONFIGURE_SHELL_USER_COMMANDS &rtems_shell_RTL_Command, &rtems_shell_dlopen_Command, &rtems_shell_dlsym_Command

#include <rtems/shellconfig.h>
8 changes: 4 additions & 4 deletions src/bsp/pc-rtems/src/pcrtems_bsp_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@
/*
* BSP compile-time tuning
*/
#define RTEMS_MAX_USER_OPTIONS 4
#define RTEMS_MAX_CMDLINE 256
#define RTEMS_MAX_USER_OPTIONS 4
#define RTEMS_MAX_CMDLINE 256

/*
* The location which the general purpose file system will be mounted
*/
#define RTEMS_USER_FS_MOUNTPOINT "/mnt"
#define RTEMS_USER_FS_MOUNTPOINT "/mnt"

/*
* By default put the shell at the same priority
* as the utility task which handles OS_printf()
*/
#define RTEMS_SHELL_PRIORITY OS_UTILITYTASK_PRIORITY
#define RTEMS_SHELL_PRIORITY OS_UTILITYTASK_PRIORITY

/*
** BSP types
Expand Down
10 changes: 5 additions & 5 deletions src/bsp/shared/inc/bsp-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#define OS_BSP_CONSOLEMODE_BLUE 0x4 /**< Blue text, if terminal supports color */
#define OS_BSP_CONSOLEMODE_HIGHLIGHT 0x8 /**< Highlighted/Emphasis text, if terminal supports it */

#define OS_BSP_CONSOLEMODE_TO_ANSICOLOR(x) ((x) & 0x07)
#define OS_BSP_CONSOLEMODE_TO_ANSICOLOR(x) ((x)&0x07)

/*
* Macro for BSP debug messages, similar to OS_DEBUG in OSAL code.
Expand Down Expand Up @@ -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) */
uint32 MaxQueueDepth; /* Queue depth limit supported by BSP (0=no limit) */
} OS_BSP_GlobalData_t;

/*
Expand Down
9 changes: 2 additions & 7 deletions src/bsp/shared/src/bsp_default_symtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,5 @@
#include "osapi.h"
#include "bsp-impl.h"


OS_static_symbol_record_t OS_STATIC_SYMBOL_TABLE[] =
{
{ "OS_Application_Startup", OS_Application_Startup },
{ "OS_Application_Run", OS_Application_Run },
{ NULL, NULL }
};
OS_static_symbol_record_t OS_STATIC_SYMBOL_TABLE[] = {
{"OS_Application_Startup", OS_Application_Startup}, {"OS_Application_Run", OS_Application_Run}, {NULL, NULL}};
3 changes: 1 addition & 2 deletions src/bsp/shared/src/osapi-bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ uint32 OS_BSP_GetArgC(void)
OS_BSP_GetArgV
See full description in header
------------------------------------------------------------------*/
char * const * OS_BSP_GetArgV(void)
char *const *OS_BSP_GetArgV(void)
{
return OS_BSP_Global.ArgV;
}
Expand All @@ -76,4 +76,3 @@ void OS_BSP_SetExitCode(int32 code)
{
OS_BSP_Global.AppStatus = code;
}

Loading