git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7475 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
5626d9925f
commit
476270c2ab
|
@ -60,16 +60,18 @@ CHIBIOS = ../../..
|
||||||
include $(CHIBIOS)/os/hal/boards/simulator/board.mk
|
include $(CHIBIOS)/os/hal/boards/simulator/board.mk
|
||||||
include ${CHIBIOS}/os/hal/hal.mk
|
include ${CHIBIOS}/os/hal/hal.mk
|
||||||
include ${CHIBIOS}/os/hal/ports/simulator/win32/platform.mk
|
include ${CHIBIOS}/os/hal/ports/simulator/win32/platform.mk
|
||||||
|
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
|
||||||
include ${CHIBIOS}/os/rt/ports/SIMIA32/compilers/GCC/port.mk
|
include ${CHIBIOS}/os/rt/ports/SIMIA32/compilers/GCC/port.mk
|
||||||
include ${CHIBIOS}/os/rt/rt.mk
|
include ${CHIBIOS}/os/rt/rt.mk
|
||||||
include ${CHIBIOS}/test/rt/test.mk
|
include ${CHIBIOS}/test/rt/test.mk
|
||||||
|
|
||||||
# List C source files here
|
# List C source files here
|
||||||
SRC = ${PORTSRC} \
|
SRC = $(PORTSRC) \
|
||||||
${KERNSRC} \
|
$(KERNSRC) \
|
||||||
${TESTSRC} \
|
$(TESTSRC) \
|
||||||
${HALSRC} \
|
$(HALSRC) \
|
||||||
${PLATFORMSRC} \
|
$(OSALSRC) \
|
||||||
|
$(PLATFORMSRC) \
|
||||||
$(BOARDSRC) \
|
$(BOARDSRC) \
|
||||||
${CHIBIOS}/os/various/shell.c \
|
${CHIBIOS}/os/various/shell.c \
|
||||||
${CHIBIOS}/os/various/memstreams.c \
|
${CHIBIOS}/os/various/memstreams.c \
|
||||||
|
@ -81,7 +83,7 @@ ASRC =
|
||||||
|
|
||||||
# List all user directories here
|
# List all user directories here
|
||||||
UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
|
UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
|
||||||
$(HALINC) $(PLATFORMINC) $(BOARDINC) \
|
$(HALINC) $(OSALINC) $(PLATFORMINC) $(BOARDINC) \
|
||||||
${CHIBIOS}/os/various
|
${CHIBIOS}/os/various
|
||||||
|
|
||||||
# List the user directory to look for the libraries here
|
# List the user directory to look for the libraries here
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
* The value one is not valid, timeouts are rounded up to
|
* The value one is not valid, timeouts are rounded up to
|
||||||
* this value.
|
* this value.
|
||||||
*/
|
*/
|
||||||
#define CH_CFG_ST_TIMEDELTA 1
|
#define CH_CFG_ST_TIMEDELTA 0
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@
|
||||||
* @note This debug option is not currently compatible with the
|
* @note This debug option is not currently compatible with the
|
||||||
* tickless mode.
|
* tickless mode.
|
||||||
*/
|
*/
|
||||||
#define CH_DBG_THREADS_PROFILING FALSE
|
#define CH_DBG_THREADS_PROFILING TRUE
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,15 @@
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
#include "chprintf.h"
|
#include "chprintf.h"
|
||||||
|
|
||||||
#define SHELL_WA_SIZE THD_WA_SIZE(4096)
|
#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(4096)
|
||||||
#define CONSOLE_WA_SIZE THD_WA_SIZE(4096)
|
#define CONSOLE_WA_SIZE THD_WORKING_AREA_SIZE(4096)
|
||||||
#define TEST_WA_SIZE THD_WA_SIZE(4096)
|
#define TEST_WA_SIZE THD_WORKING_AREA_SIZE(4096)
|
||||||
|
|
||||||
#define cputs(msg) chMsgSend(cdtp, (msg_t)msg)
|
#define cputs(msg) chMsgSend(cdtp, (msg_t)msg)
|
||||||
|
|
||||||
static Thread *cdtp;
|
static thread_t *cdtp;
|
||||||
static Thread *shelltp1;
|
static thread_t *shelltp1;
|
||||||
static Thread *shelltp2;
|
static thread_t *shelltp2;
|
||||||
|
|
||||||
static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) {
|
static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) {
|
||||||
size_t n, size;
|
size_t n, size;
|
||||||
|
@ -45,8 +45,8 @@ static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
|
static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
|
||||||
static const char *states[] = {THD_STATE_NAMES};
|
static const char *states[] = {CH_STATE_NAMES};
|
||||||
Thread *tp;
|
thread_t *tp;
|
||||||
|
|
||||||
(void)argv;
|
(void)argv;
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
|
@ -65,14 +65,14 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
|
static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
|
||||||
Thread *tp;
|
thread_t *tp;
|
||||||
|
|
||||||
(void)argv;
|
(void)argv;
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
chprintf(chp, "Usage: test\r\n");
|
chprintf(chp, "Usage: test\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(),
|
tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriorityX(),
|
||||||
TestThread, chp);
|
TestThread, chp);
|
||||||
if (tp == NULL) {
|
if (tp == NULL) {
|
||||||
chprintf(chp, "out of memory\r\n");
|
chprintf(chp, "out of memory\r\n");
|
||||||
|
@ -106,11 +106,11 @@ static const ShellConfig shell_cfg2 = {
|
||||||
static msg_t console_thread(void *arg) {
|
static msg_t console_thread(void *arg) {
|
||||||
|
|
||||||
(void)arg;
|
(void)arg;
|
||||||
while (!chThdShouldTerminate()) {
|
while (!chThdShouldTerminateX()) {
|
||||||
Thread *tp = chMsgWait();
|
thread_t *tp = chMsgWait();
|
||||||
puts((char *)chMsgGet(tp));
|
puts((char *)chMsgGet(tp));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
chMsgRelease(tp, RDY_OK);
|
chMsgRelease(tp, MSG_OK);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ static msg_t console_thread(void *arg) {
|
||||||
static void termination_handler(eventid_t id) {
|
static void termination_handler(eventid_t id) {
|
||||||
|
|
||||||
(void)id;
|
(void)id;
|
||||||
if (shelltp1 && chThdTerminated(shelltp1)) {
|
if (shelltp1 && chThdTerminatedX(shelltp1)) {
|
||||||
chThdWait(shelltp1);
|
chThdWait(shelltp1);
|
||||||
shelltp1 = NULL;
|
shelltp1 = NULL;
|
||||||
chThdSleepMilliseconds(10);
|
chThdSleepMilliseconds(10);
|
||||||
|
@ -132,7 +132,7 @@ static void termination_handler(eventid_t id) {
|
||||||
chOQResetI(&SD1.oqueue);
|
chOQResetI(&SD1.oqueue);
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
}
|
}
|
||||||
if (shelltp2 && chThdTerminated(shelltp2)) {
|
if (shelltp2 && chThdTerminatedX(shelltp2)) {
|
||||||
chThdWait(shelltp2);
|
chThdWait(shelltp2);
|
||||||
shelltp2 = NULL;
|
shelltp2 = NULL;
|
||||||
chThdSleepMilliseconds(10);
|
chThdSleepMilliseconds(10);
|
||||||
|
@ -143,7 +143,7 @@ static void termination_handler(eventid_t id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static EventListener sd1fel, sd2fel;
|
static event_listener_t sd1fel, sd2fel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SD1 status change handler.
|
* @brief SD1 status change handler.
|
||||||
|
@ -151,7 +151,7 @@ static EventListener sd1fel, sd2fel;
|
||||||
* @param[in] id event id.
|
* @param[in] id event id.
|
||||||
*/
|
*/
|
||||||
static void sd1_handler(eventid_t id) {
|
static void sd1_handler(eventid_t id) {
|
||||||
flagsmask_t flags;
|
eventflags_t flags;
|
||||||
|
|
||||||
(void)id;
|
(void)id;
|
||||||
flags = chEvtGetAndClearFlags(&sd1fel);
|
flags = chEvtGetAndClearFlags(&sd1fel);
|
||||||
|
@ -173,7 +173,7 @@ static void sd1_handler(eventid_t id) {
|
||||||
* @param[in] id event id.
|
* @param[in] id event id.
|
||||||
*/
|
*/
|
||||||
static void sd2_handler(eventid_t id) {
|
static void sd2_handler(eventid_t id) {
|
||||||
flagsmask_t flags;
|
eventflags_t flags;
|
||||||
|
|
||||||
(void)id;
|
(void)id;
|
||||||
flags = chEvtGetAndClearFlags(&sd2fel);
|
flags = chEvtGetAndClearFlags(&sd2fel);
|
||||||
|
@ -199,7 +199,7 @@ static evhandler_t fhandlers[] = {
|
||||||
* Simulator main. *
|
* Simulator main. *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
int main(void) {
|
int main(void) {
|
||||||
EventListener tel;
|
event_listener_t tel;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* System initializations.
|
* System initializations.
|
||||||
|
@ -241,7 +241,7 @@ int main(void) {
|
||||||
/*
|
/*
|
||||||
* Events servicing loop.
|
* Events servicing loop.
|
||||||
*/
|
*/
|
||||||
while (!chThdShouldTerminate())
|
while (!chThdShouldTerminateX())
|
||||||
chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS));
|
chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -61,10 +61,17 @@
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
#include "sdc.h"
|
#include "sdc.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
#include "st.h"
|
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The ST driver is a special case, it is only included if the OSAL is
|
||||||
|
* configured to require it.
|
||||||
|
*/
|
||||||
|
#if OSAL_ST_MODE != OSAL_ST_MODE_NONE
|
||||||
|
#include "st.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Complex drivers.*/
|
/* Complex drivers.*/
|
||||||
#include "mmc_spi.h"
|
#include "mmc_spi.h"
|
||||||
#include "serial_usb.h"
|
#include "serial_usb.h"
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2014 Giovanni Di Sirio
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file st_lld.c
|
||||||
|
* @brief PLATFORM ST subsystem low level driver source.
|
||||||
|
*
|
||||||
|
* @addtogroup ST
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "hal.h"
|
||||||
|
|
||||||
|
#if (OSAL_ST_MODE != OSAL_ST_MODE_NONE) || defined(__DOXYGEN__)
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver local definitions. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver exported variables. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver local types. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver local variables and types. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver local functions. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver interrupt handlers. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver exported functions. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Low level ST driver initialization.
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
void st_lld_init(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* OSAL_ST_MODE != OSAL_ST_MODE_NONE */
|
||||||
|
|
||||||
|
/** @} */
|
|
@ -0,0 +1,141 @@
|
||||||
|
/*
|
||||||
|
ChibiOS/RT - Copyright (C) 2006-2014 Giovanni Di Sirio
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file st_lld.h
|
||||||
|
* @brief PLATFORM ST subsystem low level driver header.
|
||||||
|
* @details This header is designed to be include-able without having to
|
||||||
|
* include other files from the HAL.
|
||||||
|
*
|
||||||
|
* @addtogroup ST
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ST_LLD_H_
|
||||||
|
#define _ST_LLD_H_
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver constants. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver pre-compile time settings. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Derived constants and error checks. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver data structures and types. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver macros. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* External declarations. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
void st_lld_init(void);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver inline functions. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the time counter value.
|
||||||
|
*
|
||||||
|
* @return The counter value.
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static inline systime_t st_lld_get_counter(void) {
|
||||||
|
|
||||||
|
return (systime_t)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Starts the alarm.
|
||||||
|
* @note Makes sure that no spurious alarms are triggered after
|
||||||
|
* this call.
|
||||||
|
*
|
||||||
|
* @param[in] time the time to be set for the first alarm
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static inline void st_lld_start_alarm(systime_t time) {
|
||||||
|
|
||||||
|
(void)time;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Stops the alarm interrupt.
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static inline void st_lld_stop_alarm(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the alarm time.
|
||||||
|
*
|
||||||
|
* @param[in] time the time to be set for the next alarm
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static inline void st_lld_set_alarm(systime_t time) {
|
||||||
|
|
||||||
|
(void)time;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the current alarm time.
|
||||||
|
*
|
||||||
|
* @return The currently set alarm time.
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static inline systime_t st_lld_get_alarm(void) {
|
||||||
|
|
||||||
|
return (systime_t)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Determines if the alarm is active.
|
||||||
|
*
|
||||||
|
* @return The alarm status.
|
||||||
|
* @retval false if the alarm is not active.
|
||||||
|
* @retval true is the alarm is active
|
||||||
|
*
|
||||||
|
* @notapi
|
||||||
|
*/
|
||||||
|
static inline bool st_lld_is_alarm_active(void) {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _ST_LLD_H_ */
|
||||||
|
|
||||||
|
/** @} */
|
|
@ -64,7 +64,7 @@ void hal_lld_init(void) {
|
||||||
printf("QueryPerformanceFrequency() error");
|
printf("QueryPerformanceFrequency() error");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
slice.QuadPart /= CH_FREQUENCY;
|
slice.QuadPart /= CH_CFG_ST_FREQUENCY;
|
||||||
QueryPerformanceCounter(&nextcnt);
|
QueryPerformanceCounter(&nextcnt);
|
||||||
nextcnt.QuadPart += slice.QuadPart;
|
nextcnt.QuadPart += slice.QuadPart;
|
||||||
|
|
||||||
|
@ -79,10 +79,10 @@ void _sim_check_for_interrupts(void) {
|
||||||
|
|
||||||
#if HAL_USE_SERIAL
|
#if HAL_USE_SERIAL
|
||||||
if (sd_lld_interrupt_pending()) {
|
if (sd_lld_interrupt_pending()) {
|
||||||
dbg_check_lock();
|
_dbg_check_lock();
|
||||||
if (chSchIsPreemptionRequired())
|
if (chSchIsPreemptionRequired())
|
||||||
chSchDoReschedule();
|
chSchDoReschedule();
|
||||||
dbg_check_unlock();
|
_dbg_check_unlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,10 +100,10 @@ void _sim_check_for_interrupts(void) {
|
||||||
|
|
||||||
CH_IRQ_EPILOGUE();
|
CH_IRQ_EPILOGUE();
|
||||||
|
|
||||||
dbg_check_lock();
|
_dbg_check_lock();
|
||||||
if (chSchIsPreemptionRequired())
|
if (chSchIsPreemptionRequired())
|
||||||
chSchDoReschedule();
|
chSchDoReschedule();
|
||||||
dbg_check_unlock();
|
_dbg_check_unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# List of all the Win32 platform files.
|
# List of all the Win32 platform files.
|
||||||
PLATFORMSRC = ${CHIBIOS}/os/hal/ports/simulator/win32/hal_lld.c \
|
PLATFORMSRC = ${CHIBIOS}/os/hal/ports/simulator/win32/hal_lld.c \
|
||||||
${CHIBIOS}/os/hal/ports/simulator/win32/serial_lld.c \
|
${CHIBIOS}/os/hal/ports/simulator/win32/serial_lld.c \
|
||||||
${CHIBIOS}/os/hal/ports/simulator/pal_lld.c
|
${CHIBIOS}/os/hal/ports/simulator/pal_lld.c \
|
||||||
|
${CHIBIOS}/os/hal/ports/simulator/st_lld.c
|
||||||
|
|
||||||
# Required include directories
|
# Required include directories
|
||||||
PLATFORMINC = ${CHIBIOS}/os/hal/ports/simulator/win32 \
|
PLATFORMINC = ${CHIBIOS}/os/hal/ports/simulator/win32 \
|
||||||
|
|
|
@ -133,7 +133,7 @@ static bool inint(SerialDriver *sdp) {
|
||||||
/*
|
/*
|
||||||
* Input.
|
* Input.
|
||||||
*/
|
*/
|
||||||
int n = recv(sdp->com_data, data, sizeof(data), 0);
|
int n = recv(sdp->com_data, (char *)data, sizeof(data), 0);
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 0:
|
case 0:
|
||||||
closesocket(sdp->com_data);
|
closesocket(sdp->com_data);
|
||||||
|
@ -174,7 +174,7 @@ static bool outint(SerialDriver *sdp) {
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
data[0] = (uint8_t)n;
|
data[0] = (uint8_t)n;
|
||||||
n = send(sdp->com_data, data, sizeof(data), 0);
|
n = send(sdp->com_data, (char *)data, sizeof(data), 0);
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 0:
|
case 0:
|
||||||
closesocket(sdp->com_data);
|
closesocket(sdp->com_data);
|
||||||
|
|
|
@ -99,9 +99,9 @@ typedef struct {
|
||||||
/* Driver state.*/ \
|
/* Driver state.*/ \
|
||||||
sdstate_t state; \
|
sdstate_t state; \
|
||||||
/* Input queue.*/ \
|
/* Input queue.*/ \
|
||||||
InputQueue iqueue; \
|
input_queue_t iqueue; \
|
||||||
/* Output queue.*/ \
|
/* Output queue.*/ \
|
||||||
OutputQueue oqueue; \
|
output_queue_t oqueue; \
|
||||||
/* Input circular buffer.*/ \
|
/* Input circular buffer.*/ \
|
||||||
uint8_t ib[SERIAL_BUFFERS_SIZE]; \
|
uint8_t ib[SERIAL_BUFFERS_SIZE]; \
|
||||||
/* Output circular buffer.*/ \
|
/* Output circular buffer.*/ \
|
||||||
|
|
|
@ -122,8 +122,11 @@ void halInit(void) {
|
||||||
/* Board specific initialization.*/
|
/* Board specific initialization.*/
|
||||||
boardInit();
|
boardInit();
|
||||||
|
|
||||||
#if (OSAL_ST_MODE != OSAL_ST_MODE_NONE) || defined(__DOXYGEN__)
|
/*
|
||||||
/* System tick service if the underlying OS requires it.*/
|
* The ST driver is a special case, it is only initialized if the OSAL is
|
||||||
|
* configured to require it.
|
||||||
|
*/
|
||||||
|
#if OSAL_ST_MODE != OSAL_ST_MODE_NONE
|
||||||
stInit();
|
stInit();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
* @param ntp the thread to be switched in
|
* @param ntp the thread to be switched in
|
||||||
*/
|
*/
|
||||||
__attribute__((used))
|
__attribute__((used))
|
||||||
static void __dummy(Thread *ntp, Thread *otp) {
|
static void __dummy(thread_t *ntp, thread_t *otp) {
|
||||||
(void)ntp; (void)otp;
|
(void)ntp; (void)otp;
|
||||||
|
|
||||||
asm volatile (
|
asm volatile (
|
||||||
|
|
|
@ -148,7 +148,7 @@ struct port_intctx {
|
||||||
* at context switch time.
|
* at context switch time.
|
||||||
*/
|
*/
|
||||||
struct context {
|
struct context {
|
||||||
struct intctx volatile *esp;
|
struct port_intctx *esp;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -177,11 +177,11 @@ struct context {
|
||||||
APUSH(esp, pf); \
|
APUSH(esp, pf); \
|
||||||
APUSH(esp, 0); \
|
APUSH(esp, 0); \
|
||||||
esp -= sizeof(struct port_intctx); \
|
esp -= sizeof(struct port_intctx); \
|
||||||
((struct port_intctx *)esp)->eip = _port_thread_start; \
|
((struct port_intctx *)esp)->eip = (void *)_port_thread_start; \
|
||||||
((struct port_intctx *)esp)->ebx = 0; \
|
((struct port_intctx *)esp)->ebx = 0; \
|
||||||
((struct port_intctx *)esp)->edi = 0; \
|
((struct port_intctx *)esp)->edi = 0; \
|
||||||
((struct port_intctx *)esp)->esi = 0; \
|
((struct port_intctx *)esp)->esi = 0; \
|
||||||
((struct port_intctx *)esp)->ebp = savebp; \
|
((struct port_intctx *)esp)->ebp = (void *)savebp; \
|
||||||
(tp)->p_ctx.esp = (struct port_intctx *)esp; \
|
(tp)->p_ctx.esp = (struct port_intctx *)esp; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ void test_cpu_pulse(unsigned duration) {
|
||||||
do {
|
do {
|
||||||
now = chThdGetTicksX(chThdGetSelfX());
|
now = chThdGetTicksX(chThdGetSelfX());
|
||||||
#if defined(SIMULATOR)
|
#if defined(SIMULATOR)
|
||||||
ChkIntSources();
|
_sim_check_for_interrupts();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
while (end > start ? (now >= start) && (now < end) :
|
while (end > start ? (now >= start) && (now < end) :
|
||||||
|
|
|
@ -86,7 +86,7 @@ static unsigned int msg_loop_test(thread_t *tp) {
|
||||||
(void)chMsgSend(tp, 1);
|
(void)chMsgSend(tp, 1);
|
||||||
n++;
|
n++;
|
||||||
#if defined(SIMULATOR)
|
#if defined(SIMULATOR)
|
||||||
ChkIntSources();
|
_sim_check_for_interrupts();
|
||||||
#endif
|
#endif
|
||||||
} while (!test_timer_done);
|
} while (!test_timer_done);
|
||||||
(void)chMsgSend(tp, 0);
|
(void)chMsgSend(tp, 0);
|
||||||
|
@ -232,7 +232,7 @@ static void bmk4_execute(void) {
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
n += 4;
|
n += 4;
|
||||||
#if defined(SIMULATOR)
|
#if defined(SIMULATOR)
|
||||||
ChkIntSources();
|
_sim_check_for_interrupts();
|
||||||
#endif
|
#endif
|
||||||
} while (!test_timer_done);
|
} while (!test_timer_done);
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
@ -274,7 +274,7 @@ static void bmk5_execute(void) {
|
||||||
chThdWait(chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL));
|
chThdWait(chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL));
|
||||||
n++;
|
n++;
|
||||||
#if defined(SIMULATOR)
|
#if defined(SIMULATOR)
|
||||||
ChkIntSources();
|
_sim_check_for_interrupts();
|
||||||
#endif
|
#endif
|
||||||
} while (!test_timer_done);
|
} while (!test_timer_done);
|
||||||
test_print("--- Score : ");
|
test_print("--- Score : ");
|
||||||
|
@ -313,7 +313,7 @@ static void bmk6_execute(void) {
|
||||||
chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL);
|
chThdCreateStatic(wap, WA_SIZE, prio, thread2, NULL);
|
||||||
n++;
|
n++;
|
||||||
#if defined(SIMULATOR)
|
#if defined(SIMULATOR)
|
||||||
ChkIntSources();
|
_sim_check_for_interrupts();
|
||||||
#endif
|
#endif
|
||||||
} while (!test_timer_done);
|
} while (!test_timer_done);
|
||||||
test_print("--- Score : ");
|
test_print("--- Score : ");
|
||||||
|
@ -368,7 +368,7 @@ static void bmk7_execute(void) {
|
||||||
chSemReset(&sem1, 0);
|
chSemReset(&sem1, 0);
|
||||||
n++;
|
n++;
|
||||||
#if defined(SIMULATOR)
|
#if defined(SIMULATOR)
|
||||||
ChkIntSources();
|
_sim_check_for_interrupts();
|
||||||
#endif
|
#endif
|
||||||
} while (!test_timer_done);
|
} while (!test_timer_done);
|
||||||
test_terminate_threads();
|
test_terminate_threads();
|
||||||
|
@ -408,7 +408,7 @@ static msg_t thread8(void *p) {
|
||||||
chThdYield();
|
chThdYield();
|
||||||
(*(uint32_t *)p) += 4;
|
(*(uint32_t *)p) += 4;
|
||||||
#if defined(SIMULATOR)
|
#if defined(SIMULATOR)
|
||||||
ChkIntSources();
|
_sim_check_for_interrupts();
|
||||||
#endif
|
#endif
|
||||||
} while(!chThdShouldTerminateX());
|
} while(!chThdShouldTerminateX());
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -475,7 +475,7 @@ static void bmk9_execute(void) {
|
||||||
(void)chIQGet(&iq);
|
(void)chIQGet(&iq);
|
||||||
n++;
|
n++;
|
||||||
#if defined(SIMULATOR)
|
#if defined(SIMULATOR)
|
||||||
ChkIntSources();
|
_sim_check_for_interrupts();
|
||||||
#endif
|
#endif
|
||||||
} while (!test_timer_done);
|
} while (!test_timer_done);
|
||||||
test_print("--- Score : ");
|
test_print("--- Score : ");
|
||||||
|
@ -517,7 +517,7 @@ static void bmk10_execute(void) {
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
n++;
|
n++;
|
||||||
#if defined(SIMULATOR)
|
#if defined(SIMULATOR)
|
||||||
ChkIntSources();
|
_sim_check_for_interrupts();
|
||||||
#endif
|
#endif
|
||||||
} while (!test_timer_done);
|
} while (!test_timer_done);
|
||||||
test_print("--- Score : ");
|
test_print("--- Score : ");
|
||||||
|
@ -563,7 +563,7 @@ static void bmk11_execute(void) {
|
||||||
chSemSignal(&sem1);
|
chSemSignal(&sem1);
|
||||||
n++;
|
n++;
|
||||||
#if defined(SIMULATOR)
|
#if defined(SIMULATOR)
|
||||||
ChkIntSources();
|
_sim_check_for_interrupts();
|
||||||
#endif
|
#endif
|
||||||
} while (!test_timer_done);
|
} while (!test_timer_done);
|
||||||
test_print("--- Score : ");
|
test_print("--- Score : ");
|
||||||
|
@ -610,7 +610,7 @@ static void bmk12_execute(void) {
|
||||||
chMtxUnlock(&mtx1);
|
chMtxUnlock(&mtx1);
|
||||||
n++;
|
n++;
|
||||||
#if defined(SIMULATOR)
|
#if defined(SIMULATOR)
|
||||||
ChkIntSources();
|
_sim_check_for_interrupts();
|
||||||
#endif
|
#endif
|
||||||
} while (!test_timer_done);
|
} while (!test_timer_done);
|
||||||
test_print("--- Score : ");
|
test_print("--- Score : ");
|
||||||
|
|
Loading…
Reference in New Issue