From 549f84d1206d14b5778cf5a723ee6b0942132158 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 18 Sep 2007 12:36:20 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 158 +++++++++++++++++++++++ demos/Win32-MinGW/chcore.c | 105 +++++++++++++++ demos/Win32-MinGW/chcore.h | 74 +++++++++++ demos/Win32-MinGW/chcore2.s | 43 +++++++ demos/Win32-MinGW/chtypes.h | 52 ++++++++ demos/Win32-MinGW/demo.c | 305 ++++++++++++++++++++++++++++++++++++++++++++ demos/Win32-MinGW/makefile | 129 +++++++++++++++++++ 7 files changed, 866 insertions(+) create mode 100644 demos/Win32-MinGW/chconf.h create mode 100644 demos/Win32-MinGW/chcore.c create mode 100644 demos/Win32-MinGW/chcore.h create mode 100644 demos/Win32-MinGW/chcore2.s create mode 100644 demos/Win32-MinGW/chtypes.h create mode 100644 demos/Win32-MinGW/demo.c create mode 100644 demos/Win32-MinGW/makefile (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h new file mode 100644 index 000000000..13de9f457 --- /dev/null +++ b/demos/Win32-MinGW/chconf.h @@ -0,0 +1,158 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/* + * Configuration file for MingGW32 demo project. + */ + +/** + * @addtogroup Config + * @{ + */ + +#ifndef _CHCONF_H_ +#define _CHCONF_H_ + +/* + * NOTE: this is just documentation for doxigen, the real configuration file + * is the one into the project directories. + */ + +/** Configuration option: if specified then time efficient rather than space + * efficient code is used when two possible implementations exist, note + * that this is not related to the compiler optimization options.*/ +#define CH_OPTIMIZE_SPEED + +/** Configuration option: if specified then the Virtual Timers subsystem is + * included in the kernel.*/ +#define CH_USE_VIRTUAL_TIMERS + +/** Configuration option: if specified then the System Timer subsystem is + * included in the kernel.*/ +#define CH_USE_SYSTEMTIME + +/** Configuration option: if specified then the \p chThdSleep() function is + * included in the kernel. + * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ +#define CH_USE_SLEEP + +/** Configuration option: if specified then the \p chThdResume() + * function is included in the kernel.*/ +#define CH_USE_RESUME + +/** Configuration option: if specified then the \p chThdTerminate() + * and \p chThdShouldTerminate() functions are included in the kernel.*/ +#define CH_USE_TERMINATE + +/** Configuration option: if specified then the \p chThdWait() function + * is included in the kernel.*/ +#define CH_USE_WAITEXIT + +/** Configuration option: if specified then the Semaphores APIs are included + * in the kernel.*/ +#define CH_USE_SEMAPHORES + +/** Configuration option: if specified then the Semaphores with timeout APIs + * are included in the kernel. + * @note requires \p CH_USE_SEMAPHORES. + * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ +#define CH_USE_SEMAPHORES_TIMEOUT + +/** Configuration option: if specified then the Semaphores APIs with priority + * shift are included in the kernel. + * @note requires \p CH_USE_SEMAPHORES.*/ +#define CH_USE_RT_SEMAPHORES + +/** Configuration option: if specified then the Events APIs are included in + * the kernel.*/ +#define CH_USE_EVENTS + +/** Configuration option: if specified then the \p chEvtWaitTimeout() + * function is included in the kernel. + * @note requires \p CH_USE_EVENTS. + * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ +#define CH_USE_EVENTS_TIMEOUT + +/** Configuration option: if specified then the Synchronous Messages APIs are + * included in the kernel.*/ +#define CH_USE_MESSAGES + +/** Configuration option: if specified then the \p chMsgSendTimeout() + * function is included in the kernel. + * @note requires \p CH_USE_MESSAGES. + * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ +#define CH_USE_MESSAGES_TIMEOUT + +/** Configuration option: if specified then the \p chMsgSendWithEvent() + * function is included in the kernel. + * @note requires \p CH_USE_MESSAGES. + * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ +#define CH_USE_MESSAGES_EVENT + +/** Configuration option: if specified then the + * \p chThdGetExitEventSource() function is included in the kernel. + * @note requires \p CH_USE_MESSAGES. + * @note requires \p CH_USE_EVENTS.*/ +#define CH_USE_EXIT_EVENT + +/** Configuration option: if specified then the I/O queues APIs are included + * in the kernel.*/ +#define CH_USE_QUEUES + +/** Configuration option: if specified then the halfduplex queue APIs are + * included in the kernel.*/ +#define CH_USE_QUEUES_HALFDUPLEX + +/** Configuration option: if specified then the I/O queues with timeout + * APIs are included in the kernel. + * @note requires \p CH_USE_SEMAPHORES_TIMEOUT.*/ +#define CH_USE_QUEUES_TIMEOUT + +/** Configuration option: if specified then the full duplex serial driver APIs + * are included in the kernel.*/ +#define CH_USE_SERIAL_FULLDUPLEX + +/** Configuration option: if specified then the half duplex serial driver APIs + * are included in the kernel.*/ +#define CH_USE_SERIAL_HALFDUPLEX + +/** Configuration option: Frequency of the system timer that drives the system + * ticks. This also defines the system time unit.*/ +#define CH_FREQUENCY 100 + +/** Configuration option: This constant is the number of ticks allowed for the + * threads before preemption occurs.*/ +#define CH_TIME_QUANTUM 10 + +/** Configuration option: Defines a CPU register to be used as storage for the + * global \p currp variable. Caching this variable in a register can greatly + * improve both space and time efficiency of the generated code. Another side + * effect is that one less register has to be saved during the context switch + * resulting in lower RAM usage and faster code. + * @note This option is only useable with the GCC compiler and is only useful + * on processors with many registers like ARM cores. + * @note If this option is enabled then ALL the libraries linked to the + * ChibiOS/RT code must be recompiled with the GCC option \p + * -ffixed-\. + */ +//#define CH_CURRP_REGISTER_CACHE "reg" + +#endif /* _CHCONF_H_ */ + +/** @} */ diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c new file mode 100644 index 000000000..d48188b49 --- /dev/null +++ b/demos/Win32-MinGW/chcore.c @@ -0,0 +1,105 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/* + * Core file for MingGW32 demo project. + */ + +#include +#include + +#undef CDECL + +#include + +static LARGE_INTEGER nextcnt; +static LARGE_INTEGER slice; + +void InitSimCom1(void); +void InitSimCom2(void); +BOOL Com1ConnInterruptSimCom(void); +BOOL Com2ConnInterruptSimCom(void); +BOOL Com1InInterruptSimCom(void); +BOOL Com2InInterruptSimCom(void); +BOOL Com1OutInterruptSimCom(void); +BOOL Com2OutInterruptSimCom(void); + +/* + * Simulated HW initialization. + */ +void InitCore(void) { + WSADATA wsaData; + + // Initialization. + if (WSAStartup(2, &wsaData) != 0) { + printf("Unable to locate a winsock DLL\n"); + exit(1); + } + + printf("Win32 ChobiOS/RT simulator\n\n"); + printf("Thread structure %d bytes\n", sizeof(Thread)); + if (!QueryPerformanceFrequency(&slice)) { + printf("QueryPerformanceFrequency() error"); + exit(1); + } + printf("Core Frequency %d Hz\n", (int)slice.LowPart); + slice.QuadPart /= CH_FREQUENCY; + QueryPerformanceCounter(&nextcnt); + nextcnt.QuadPart += slice.QuadPart; + + InitSimCom1(); + InitSimCom2(); +} + +/* + * Interrupt simulation. + */ +static void ChkIntSources(void) { + LARGE_INTEGER n; + + if (Com1InInterruptSimCom() || Com2InInterruptSimCom() || + Com1OutInterruptSimCom() || Com2OutInterruptSimCom() || + Com1ConnInterruptSimCom() || Com2ConnInterruptSimCom()) { + chSchRescheduleI(); + return; + } + + // Interrupt Timer simulation (10ms interval). + QueryPerformanceCounter(&n); + if (n.QuadPart > nextcnt.QuadPart) { + nextcnt.QuadPart += slice.QuadPart; + chSchTimerHandlerI(); + if (chSchRescRequiredI()) + chSchDoRescheduleI(); + } +} + +__attribute__((fastcall)) void chSysPause(void) { + + while (TRUE) { + + ChkIntSources(); + Sleep(0); + } +} + +__attribute__((fastcall)) void chSysHalt(void) { + + exit(2); +} diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h new file mode 100644 index 000000000..b8872c819 --- /dev/null +++ b/demos/Win32-MinGW/chcore.h @@ -0,0 +1,74 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/* + * Core file for MingGW32 demo project. + */ + +#ifndef _CHCORE_H_ +#define _CHCORE_H_ + +typedef void *regx86; + +/* + * Stack saved context. + */ +struct stackregs { + regx86 ebx; + regx86 edi; + regx86 esi; + regx86 ebp; + regx86 eip; +}; + +typedef struct { + struct stackregs *esp; +} Context; + +#define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a) + +#define SETUP_CONTEXT(workspace, wsize, pf, arg) \ +{ \ + BYTE8 *esp = (BYTE8 *)workspace + wsize; \ + APUSH(esp, arg); \ + APUSH(esp, threadstart); \ + esp -= sizeof(struct stackregs); \ + ((struct stackregs *)esp)->eip = pf; \ + ((struct stackregs *)esp)->ebx = 0; \ + ((struct stackregs *)esp)->edi = 0; \ + ((struct stackregs *)esp)->esi = 0; \ + ((struct stackregs *)esp)->ebp = 0; \ + tp->p_ctx.esp = (struct stackregs *)esp; \ +} + +#define chSysLock() + +#define chSysUnlock() + +#define INT_REQUIRED_STACK 0x0 + +#define UserStackSize(n) (sizeof(Thread) + sizeof(PTR_EQ) + sizeof(PTR_EQ) + \ + sizeof(struct stackregs) + (n) + (INT_REQUIRED_STACK)) + +__attribute__((fastcall)) void chSysHalt(void); +__attribute__((fastcall)) void chSysPause(void); +__attribute__((fastcall)) void chSysSwitchI(Context *oldp, Context *newp); +__attribute__((fastcall)) void threadstart(void); + +#endif /* _CHCORE_H_ */ diff --git a/demos/Win32-MinGW/chcore2.s b/demos/Win32-MinGW/chcore2.s new file mode 100644 index 000000000..80985e3f7 --- /dev/null +++ b/demos/Win32-MinGW/chcore2.s @@ -0,0 +1,43 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +.text + +.p2align 4,,15 +.globl @chSysSwitchI@8 +@chSysSwitchI@8: + # Switch out + push %ebp + push %esi + push %edi + push %ebx + movl %esp,(%ecx) + # Switch in + movl (%edx),%esp + pop %ebx + pop %edi + pop %esi + pop %ebp + ret + +.p2align 4,,15 +.globl @threadstart@0 +@threadstart@0: + push %ecx + call _chThdExit diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h new file mode 100644 index 000000000..48bf7a7d9 --- /dev/null +++ b/demos/Win32-MinGW/chtypes.h @@ -0,0 +1,52 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _CHTYPES_H_ +#define _CHTYPES_H_ + +/* + * Generic types often dependant on the compiler. + */ +#define BOOL char +#define BYTE8 unsigned char +#define WORD16 short +#define UWORD16 unsigned short +#define LONG32 int +#define ULONG32 unsigned int +#define PTR_EQ int + +typedef BYTE8 t_tmode; +typedef BYTE8 t_tstate; +typedef WORD16 t_prio; +typedef PTR_EQ t_msg; +typedef LONG32 t_eventid; +typedef ULONG32 t_eventmask; +typedef ULONG32 t_time; +typedef LONG32 t_semcnt; +typedef ULONG32 t_size; + +#define MINPRIO 0x8000 +#define MAXPRIO 0x7fff + +#define MINDELTA 0 +#define MAXDELTA 0xffff + +#define INLINE inline + +#endif /* _CHTYPES_H_ */ diff --git a/demos/Win32-MinGW/demo.c b/demos/Win32-MinGW/demo.c new file mode 100644 index 000000000..166923d2c --- /dev/null +++ b/demos/Win32-MinGW/demo.c @@ -0,0 +1,305 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include + +#include + +static ULONG32 wdguard; +static BYTE8 wdarea[UserStackSize(2048)]; + +static ULONG32 iguard; +static BYTE8 iarea[UserStackSize(2048)]; + +static ULONG32 cdguard; +static BYTE8 cdarea[UserStackSize(2048)]; +static Thread *cdtp; + +static t_msg WatchdogThread(void *arg); +static t_msg ConsoleThread(void *arg); +static t_msg InitThread(void *arg); + +void InitCore(void); +extern FullDuplexDriver COM1, COM2; + +#define cprint(msg) chMsgSend(cdtp, (t_msg)msg) + +/*------------------------------------------------------------------------* + * Simulator main, start here your threads, examples inside. * + *------------------------------------------------------------------------*/ +int main(void) { + + InitCore(); + + // Startup ChibiOS/RT. + chSysInit(); + chThdCreate(NORMALPRIO + 2, 0, wdarea, sizeof(wdarea), WatchdogThread, NULL); + cdtp = chThdCreate(NORMALPRIO + 1, 0, cdarea, sizeof(cdarea), ConsoleThread, NULL); + chThdCreate(NORMALPRIO, 0, iarea, sizeof(iarea), InitThread, NULL); + chSysPause(); + return 0; +} + +/* + * Watchdog thread, it checks magic values located under the various stack + * areas. The system is halted if something is wrong. + */ +static t_msg WatchdogThread(void *arg) { + wdguard = 0xA51F2E3D; + iguard = 0xA51F2E3D; + cdguard = 0xA51F2E3D; + while (TRUE) { + + if ((wdguard != 0xA51F2E3D) || + (iguard != 0xA51F2E3D) || + (cdguard != 0xA51F2E3D)) { + printf("Halted by watchdog"); + chSysHalt(); + } + chThdSleep(5); + } + return 0; +} + +/* + * Console print server done using synchronous messages. This makes the access + * to the C printf() thread safe and the print operation atomic among threads. + * In this example the message is the zero termitated string itself. + */ +static t_msg ConsoleThread(void *arg) { + + while (!chThdShouldTerminate()) { + printf((char *)chMsgWait()); + chMsgRelease(RDY_OK); + } + return 0; +} + +static void PrintLineFDD(FullDuplexDriver *sd, char *msg) { + + while (*msg) + chFDDPut(sd, *msg++); +} + +static BOOL GetLineFDD(FullDuplexDriver *sd, char *line, int size) { + char *p = line; + + while (TRUE) { + short c = chIQGet(&sd->sd_iqueue); + if (c < 0) + return TRUE; + if (c == 4) { + PrintLineFDD(sd, "^D\r\n"); + return TRUE; + } + if (c == 8) { + if (p != line) { + chFDDPut(sd, (BYTE8)c); + chFDDPut(sd, 0x20); + chFDDPut(sd, (BYTE8)c); + p--; + } + continue; + } + if (c == '\r') { + PrintLineFDD(sd, "\r\n"); + *p = 0; + return FALSE; + } + if (c < 0x20) + continue; + if (p < line + size - 1) { + chFDDPut(sd, (BYTE8)c); + *p++ = (BYTE8)c; + } + } +} + +/* + * Example thread, not much to see here. It simulates the CTRL-C but there + * are no real signals involved. + */ +static t_msg HelloWorldThread(void *arg) { + int i; + short c; + FullDuplexDriver *sd = (FullDuplexDriver *)arg; + + for (i = 0; i < 100; i++) { + + PrintLineFDD(sd, "Hello World\r\n"); + c = chFDDGetTimeout(sd, 33); + switch (c) { + case -1: + continue; + case -2: + return 1; + case 3: + PrintLineFDD(sd, "^C\r\n"); + return 0; + default: + chThdSleep(33); + } + } + return 0; +} + +static BOOL checkend(FullDuplexDriver *sd) { + + char * lp = strtok(NULL, " \009"); /* It is not thread safe but this is a demo.*/ + if (lp) { + PrintLineFDD(sd, lp); + PrintLineFDD(sd, " ?\r\n"); + return TRUE; + } + return FALSE; +} + +/* + * Simple command shell thread, the argument is the serial line for the + * standard input and output. It recognizes few simple commands. + */ +static t_msg ShellThread(void *arg) { + FullDuplexDriver *sd = (FullDuplexDriver *)arg; + char *lp, line[64]; + Thread *tp; + BYTE8 tarea[UserStackSize(1024)]; + + chIQReset(&sd->sd_iqueue); + chOQReset(&sd->sd_oqueue); + PrintLineFDD(sd, "ChibiOS/RT Command Shell\r\n\n"); + while (TRUE) { + PrintLineFDD(sd, "ch> "); + if (GetLineFDD(sd, line, sizeof(line))) { + PrintLineFDD(sd, "\nlogout"); + break; + } + lp = strtok(line, " \009"); // Note: not thread safe but it is just a demo. + if (lp) { + if ((stricmp(lp, "help") == 0) || + (stricmp(lp, "h") == 0) || + (stricmp(lp, "?") == 0)) { + if (checkend(sd)) + continue; + PrintLineFDD(sd, "Commands:\r\n"); + PrintLineFDD(sd, " help,h,? - This help\r\n"); + PrintLineFDD(sd, " exit - Logout from ChibiOS/RT\r\n"); + PrintLineFDD(sd, " time - Prints the system timer value\r\n"); + PrintLineFDD(sd, " hello - Runs the Hello World demo thread\r\n"); + } + else if (stricmp(lp, "exit") == 0) { + if (checkend(sd)) + continue; + PrintLineFDD(sd, "\nlogout"); + break; + } + else if (stricmp(lp, "time") == 0) { + if (checkend(sd)) + continue; + sprintf(line, "Time: %d\r\n", chSysGetTime()); + PrintLineFDD(sd, line); + } + else if (stricmp(lp, "hello") == 0) { + if (checkend(sd)) + continue; + tp = chThdCreate(NORMALPRIO, 0, tarea, sizeof(tarea), + HelloWorldThread, sd); + if (chThdWait(tp)) + break; // Lost connection while executing the hello thread. + } + else { + PrintLineFDD(sd, lp); + PrintLineFDD(sd, " ?\r\n"); + } + } + } + return 0; +} + +static BYTE8 s1area[UserStackSize(4096)]; +static Thread *s1; +EventListener s1tel; + +static void COM1Handler(t_eventid id) { + t_dflags flags; + + if (s1 && chThdTerminated(s1)) { + s1 = NULL; + cprint("Init: disconnection on COM1\n"); + } + flags = chFDDGetAndClearFlags(&COM1); + if ((flags & SD_CONNECTED) && (s1 == NULL)) { + cprint("Init: connection on COM1\n"); + s1 = chThdCreate(NORMALPRIO, P_SUSPENDED, s1area, sizeof(s1area), + ShellThread, &COM1); + chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0); + chThdResume(s1); + } + if ((flags & SD_DISCONNECTED) && (s1 != NULL)) + chIQReset(&COM1.sd_iqueue); +} + +static BYTE8 s2area[UserStackSize(4096)]; +static Thread *s2; +EventListener s2tel; + +static void COM2Handler(t_eventid id) { + t_dflags flags; + + if (s2 && chThdTerminated(s2)) { + s2 = NULL; + cprint("Init: disconnection on COM2\n"); + } + flags = chFDDGetAndClearFlags(&COM2); + if ((flags & SD_CONNECTED) && (s2 == NULL)) { + cprint("Init: connection on COM2\n"); + s2 = chThdCreate(NORMALPRIO, P_SUSPENDED, s2area, sizeof(s1area), + ShellThread, &COM2); + chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1); + chThdResume(s2); + } + if ((flags & SD_DISCONNECTED) && (s2 != NULL)) + chIQReset(&COM2.sd_iqueue); +} + +static t_evhandler fhandlers[2] = { + COM1Handler, + COM2Handler +}; + +/* + * Init-like thread, it starts the shells and handles their termination. + * It is a good example of events usage. + */ +static t_msg InitThread(void *arg) { + EventListener c1fel, c2fel; + + cprint("Console service started on COM1, COM2\n"); + cprint(" - Listening for connections on COM1\n"); + chFDDGetAndClearFlags(&COM1); + chEvtRegister(&COM1.sd_sevent, &c1fel, 0); + cprint(" - Listening for connections on COM2\n"); + chFDDGetAndClearFlags(&COM2); + chEvtRegister(&COM2.sd_sevent, &c2fel, 1); + while (!chThdShouldTerminate()) + chEvtWait(ALL_EVENTS, fhandlers); + chEvtUnregister(&COM2.sd_sevent, &c2fel); // Never invoked but this is an example... + chEvtUnregister(&COM1.sd_sevent, &c1fel); // Never invoked but this is an example... + return 0; +} diff --git a/demos/Win32-MinGW/makefile b/demos/Win32-MinGW/makefile new file mode 100644 index 000000000..b7dc8b024 --- /dev/null +++ b/demos/Win32-MinGW/makefile @@ -0,0 +1,129 @@ +# +# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!! +# +############################################################################################## +# +# On command line: +# +# make all = Create project +# +# make clean = Clean project files. +# +# To rebuild project do "make clean" and "make all". +# + +############################################################################################## +# Start of default section +# + +TRGT = mingw32- +CC = $(TRGT)gcc +AS = $(TRGT)gcc -x assembler-with-cpp + +# List all default C defines here, like -D_DEBUG=1 +DDEFS = + +# List all default ASM defines here, like -D_DEBUG=1 +DADEFS = + +# List all default directories to look for include files here +DINCDIR = + +# List the default directory to look for the libraries here +DLIBDIR = + +# List all default libraries here +DLIBS = -lws2_32 + +# +# End of default section +############################################################################################## + +############################################################################################## +# Start of user section +# + +# Define project name here +PROJECT = ch + +# Define linker script file here +LDSCRIPT= + +# List all user C define here, like -D_DEBUG=1 +UDEFS = + +# Define ASM defines here +UADEFS = + +# List C source files here +SRC = chcore.c demo.c \ + ../../ports/win32/simcom.c \ + ../../src/chinit.c ../../src/chdelta.c ../../src/chschd.c ../../src/chthreads.c \ + ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c \ + ../../src/chqueues.c ../../src/chserial.c + +# List ASM source files here +ASRC = chcore2.s + +# List all user directories here +UINCDIR = ../../src/include + +# List the user directory to look for the libraries here +ULIBDIR = + +# List all user libraries here +ULIBS = + +# Define optimisation level here +OPT = -Os -fomit-frame-pointer -fno-strict-aliasing + +# +# End of user defines +############################################################################################## + + +INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR)) +LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) +DEFS = $(DDEFS) $(UDEFS) +ADEFS = $(DADEFS) $(UADEFS) +OBJS = $(ASRC:.s=.o) $(SRC:.c=.o) +LIBS = $(DLIBS) $(ULIBS) + +LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) +ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) +CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS) + +# Generate dependency information +CPFLAGS += -MD -MP -MF .dep/$(@F).d + +# +# makefile rules +# + +all: $(OBJS) $(PROJECT).exe + +%o : %c + $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@ + +%o : %s + $(AS) -c $(ASFLAGS) $< -o $@ + +%exe: $(OBJS) + $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ + +clean: + -rm -f $(OBJS) + -rm -f $(PROJECT).exe + -rm -f $(PROJECT).map + -rm -f $(SRC:.c=.c.bak) + -rm -f $(SRC:.c=.lst) + -rm -f $(ASRC:.s=.s.bak) + -rm -f $(ASRC:.s=.lst) + -rm -fR .dep + +# +# Include the dependency files, should be the last of the makefile +# +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + +# *** EOF *** -- cgit v1.2.3 From bd7b535e0633cf44ac25db3e9347b89e485545a8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 19 Sep 2007 17:03:40 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/readme.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 demos/Win32-MinGW/readme.txt (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/readme.txt b/demos/Win32-MinGW/readme.txt new file mode 100644 index 000000000..283ee42b2 --- /dev/null +++ b/demos/Win32-MinGW/readme.txt @@ -0,0 +1,22 @@ +***************************************************************************** +** ChibiOS/RT port for x86 into a Win32 process ** +***************************************************************************** + +** TARGET ** + +The demo runs under any Windows version as an application program. The serial +I/O is simulated over TCP/IP sockets. + +** The Demo ** + +The demo listens on the two serial ports, when a connection is detected a +thread is started that serves a small command shell. +The demo shows how create/terminate threads at runtime, how listen to events, +how ho work with serial ports, how use the messages. +You can develop your ChibiOS/RT application using this demo as a simulator +then you can recompile it for a different architecture. +See demo.c for details. + +** Build Procedure ** + +The demo was built using the MinGW toolchain. -- cgit v1.2.3 From f322242e43515d688fcb025eb8575f7b04558f45 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 21 Sep 2007 16:33:57 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/makefile | 129 -------------------------------------------- demos/Win32-MinGW/makefile_ | 129 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+), 129 deletions(-) delete mode 100644 demos/Win32-MinGW/makefile create mode 100644 demos/Win32-MinGW/makefile_ (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/makefile b/demos/Win32-MinGW/makefile deleted file mode 100644 index b7dc8b024..000000000 --- a/demos/Win32-MinGW/makefile +++ /dev/null @@ -1,129 +0,0 @@ -# -# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!! -# -############################################################################################## -# -# On command line: -# -# make all = Create project -# -# make clean = Clean project files. -# -# To rebuild project do "make clean" and "make all". -# - -############################################################################################## -# Start of default section -# - -TRGT = mingw32- -CC = $(TRGT)gcc -AS = $(TRGT)gcc -x assembler-with-cpp - -# List all default C defines here, like -D_DEBUG=1 -DDEFS = - -# List all default ASM defines here, like -D_DEBUG=1 -DADEFS = - -# List all default directories to look for include files here -DINCDIR = - -# List the default directory to look for the libraries here -DLIBDIR = - -# List all default libraries here -DLIBS = -lws2_32 - -# -# End of default section -############################################################################################## - -############################################################################################## -# Start of user section -# - -# Define project name here -PROJECT = ch - -# Define linker script file here -LDSCRIPT= - -# List all user C define here, like -D_DEBUG=1 -UDEFS = - -# Define ASM defines here -UADEFS = - -# List C source files here -SRC = chcore.c demo.c \ - ../../ports/win32/simcom.c \ - ../../src/chinit.c ../../src/chdelta.c ../../src/chschd.c ../../src/chthreads.c \ - ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c \ - ../../src/chqueues.c ../../src/chserial.c - -# List ASM source files here -ASRC = chcore2.s - -# List all user directories here -UINCDIR = ../../src/include - -# List the user directory to look for the libraries here -ULIBDIR = - -# List all user libraries here -ULIBS = - -# Define optimisation level here -OPT = -Os -fomit-frame-pointer -fno-strict-aliasing - -# -# End of user defines -############################################################################################## - - -INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR)) -LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) -DEFS = $(DDEFS) $(UDEFS) -ADEFS = $(DADEFS) $(UADEFS) -OBJS = $(ASRC:.s=.o) $(SRC:.c=.o) -LIBS = $(DLIBS) $(ULIBS) - -LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) -ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) -CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS) - -# Generate dependency information -CPFLAGS += -MD -MP -MF .dep/$(@F).d - -# -# makefile rules -# - -all: $(OBJS) $(PROJECT).exe - -%o : %c - $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@ - -%o : %s - $(AS) -c $(ASFLAGS) $< -o $@ - -%exe: $(OBJS) - $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ - -clean: - -rm -f $(OBJS) - -rm -f $(PROJECT).exe - -rm -f $(PROJECT).map - -rm -f $(SRC:.c=.c.bak) - -rm -f $(SRC:.c=.lst) - -rm -f $(ASRC:.s=.s.bak) - -rm -f $(ASRC:.s=.lst) - -rm -fR .dep - -# -# Include the dependency files, should be the last of the makefile -# --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - -# *** EOF *** diff --git a/demos/Win32-MinGW/makefile_ b/demos/Win32-MinGW/makefile_ new file mode 100644 index 000000000..b7dc8b024 --- /dev/null +++ b/demos/Win32-MinGW/makefile_ @@ -0,0 +1,129 @@ +# +# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!! +# +############################################################################################## +# +# On command line: +# +# make all = Create project +# +# make clean = Clean project files. +# +# To rebuild project do "make clean" and "make all". +# + +############################################################################################## +# Start of default section +# + +TRGT = mingw32- +CC = $(TRGT)gcc +AS = $(TRGT)gcc -x assembler-with-cpp + +# List all default C defines here, like -D_DEBUG=1 +DDEFS = + +# List all default ASM defines here, like -D_DEBUG=1 +DADEFS = + +# List all default directories to look for include files here +DINCDIR = + +# List the default directory to look for the libraries here +DLIBDIR = + +# List all default libraries here +DLIBS = -lws2_32 + +# +# End of default section +############################################################################################## + +############################################################################################## +# Start of user section +# + +# Define project name here +PROJECT = ch + +# Define linker script file here +LDSCRIPT= + +# List all user C define here, like -D_DEBUG=1 +UDEFS = + +# Define ASM defines here +UADEFS = + +# List C source files here +SRC = chcore.c demo.c \ + ../../ports/win32/simcom.c \ + ../../src/chinit.c ../../src/chdelta.c ../../src/chschd.c ../../src/chthreads.c \ + ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c \ + ../../src/chqueues.c ../../src/chserial.c + +# List ASM source files here +ASRC = chcore2.s + +# List all user directories here +UINCDIR = ../../src/include + +# List the user directory to look for the libraries here +ULIBDIR = + +# List all user libraries here +ULIBS = + +# Define optimisation level here +OPT = -Os -fomit-frame-pointer -fno-strict-aliasing + +# +# End of user defines +############################################################################################## + + +INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR)) +LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) +DEFS = $(DDEFS) $(UDEFS) +ADEFS = $(DADEFS) $(UADEFS) +OBJS = $(ASRC:.s=.o) $(SRC:.c=.o) +LIBS = $(DLIBS) $(ULIBS) + +LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) +ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) +CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS) + +# Generate dependency information +CPFLAGS += -MD -MP -MF .dep/$(@F).d + +# +# makefile rules +# + +all: $(OBJS) $(PROJECT).exe + +%o : %c + $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@ + +%o : %s + $(AS) -c $(ASFLAGS) $< -o $@ + +%exe: $(OBJS) + $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ + +clean: + -rm -f $(OBJS) + -rm -f $(PROJECT).exe + -rm -f $(PROJECT).map + -rm -f $(SRC:.c=.c.bak) + -rm -f $(SRC:.c=.lst) + -rm -f $(ASRC:.s=.s.bak) + -rm -f $(ASRC:.s=.lst) + -rm -fR .dep + +# +# Include the dependency files, should be the last of the makefile +# +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + +# *** EOF *** -- cgit v1.2.3 From 81c833b2db713bf998b4f60d480e41f19a3a486c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 21 Sep 2007 16:34:56 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 129 ++++++++++++++++++++++++++++++++++++++++++++ demos/Win32-MinGW/makefile_ | 129 -------------------------------------------- 2 files changed, 129 insertions(+), 129 deletions(-) create mode 100644 demos/Win32-MinGW/Makefile delete mode 100644 demos/Win32-MinGW/makefile_ (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile new file mode 100644 index 000000000..b7dc8b024 --- /dev/null +++ b/demos/Win32-MinGW/Makefile @@ -0,0 +1,129 @@ +# +# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!! +# +############################################################################################## +# +# On command line: +# +# make all = Create project +# +# make clean = Clean project files. +# +# To rebuild project do "make clean" and "make all". +# + +############################################################################################## +# Start of default section +# + +TRGT = mingw32- +CC = $(TRGT)gcc +AS = $(TRGT)gcc -x assembler-with-cpp + +# List all default C defines here, like -D_DEBUG=1 +DDEFS = + +# List all default ASM defines here, like -D_DEBUG=1 +DADEFS = + +# List all default directories to look for include files here +DINCDIR = + +# List the default directory to look for the libraries here +DLIBDIR = + +# List all default libraries here +DLIBS = -lws2_32 + +# +# End of default section +############################################################################################## + +############################################################################################## +# Start of user section +# + +# Define project name here +PROJECT = ch + +# Define linker script file here +LDSCRIPT= + +# List all user C define here, like -D_DEBUG=1 +UDEFS = + +# Define ASM defines here +UADEFS = + +# List C source files here +SRC = chcore.c demo.c \ + ../../ports/win32/simcom.c \ + ../../src/chinit.c ../../src/chdelta.c ../../src/chschd.c ../../src/chthreads.c \ + ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c \ + ../../src/chqueues.c ../../src/chserial.c + +# List ASM source files here +ASRC = chcore2.s + +# List all user directories here +UINCDIR = ../../src/include + +# List the user directory to look for the libraries here +ULIBDIR = + +# List all user libraries here +ULIBS = + +# Define optimisation level here +OPT = -Os -fomit-frame-pointer -fno-strict-aliasing + +# +# End of user defines +############################################################################################## + + +INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR)) +LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) +DEFS = $(DDEFS) $(UDEFS) +ADEFS = $(DADEFS) $(UADEFS) +OBJS = $(ASRC:.s=.o) $(SRC:.c=.o) +LIBS = $(DLIBS) $(ULIBS) + +LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) +ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) +CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS) + +# Generate dependency information +CPFLAGS += -MD -MP -MF .dep/$(@F).d + +# +# makefile rules +# + +all: $(OBJS) $(PROJECT).exe + +%o : %c + $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@ + +%o : %s + $(AS) -c $(ASFLAGS) $< -o $@ + +%exe: $(OBJS) + $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ + +clean: + -rm -f $(OBJS) + -rm -f $(PROJECT).exe + -rm -f $(PROJECT).map + -rm -f $(SRC:.c=.c.bak) + -rm -f $(SRC:.c=.lst) + -rm -f $(ASRC:.s=.s.bak) + -rm -f $(ASRC:.s=.lst) + -rm -fR .dep + +# +# Include the dependency files, should be the last of the makefile +# +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + +# *** EOF *** diff --git a/demos/Win32-MinGW/makefile_ b/demos/Win32-MinGW/makefile_ deleted file mode 100644 index b7dc8b024..000000000 --- a/demos/Win32-MinGW/makefile_ +++ /dev/null @@ -1,129 +0,0 @@ -# -# !!!! Do NOT edit this makefile with an editor which replace tabs by spaces !!!! -# -############################################################################################## -# -# On command line: -# -# make all = Create project -# -# make clean = Clean project files. -# -# To rebuild project do "make clean" and "make all". -# - -############################################################################################## -# Start of default section -# - -TRGT = mingw32- -CC = $(TRGT)gcc -AS = $(TRGT)gcc -x assembler-with-cpp - -# List all default C defines here, like -D_DEBUG=1 -DDEFS = - -# List all default ASM defines here, like -D_DEBUG=1 -DADEFS = - -# List all default directories to look for include files here -DINCDIR = - -# List the default directory to look for the libraries here -DLIBDIR = - -# List all default libraries here -DLIBS = -lws2_32 - -# -# End of default section -############################################################################################## - -############################################################################################## -# Start of user section -# - -# Define project name here -PROJECT = ch - -# Define linker script file here -LDSCRIPT= - -# List all user C define here, like -D_DEBUG=1 -UDEFS = - -# Define ASM defines here -UADEFS = - -# List C source files here -SRC = chcore.c demo.c \ - ../../ports/win32/simcom.c \ - ../../src/chinit.c ../../src/chdelta.c ../../src/chschd.c ../../src/chthreads.c \ - ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c \ - ../../src/chqueues.c ../../src/chserial.c - -# List ASM source files here -ASRC = chcore2.s - -# List all user directories here -UINCDIR = ../../src/include - -# List the user directory to look for the libraries here -ULIBDIR = - -# List all user libraries here -ULIBS = - -# Define optimisation level here -OPT = -Os -fomit-frame-pointer -fno-strict-aliasing - -# -# End of user defines -############################################################################################## - - -INCDIR = $(patsubst %,-I%,$(DINCDIR) $(UINCDIR)) -LIBDIR = $(patsubst %,-L%,$(DLIBDIR) $(ULIBDIR)) -DEFS = $(DDEFS) $(UDEFS) -ADEFS = $(DADEFS) $(UADEFS) -OBJS = $(ASRC:.s=.o) $(SRC:.c=.o) -LIBS = $(DLIBS) $(ULIBS) - -LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) -ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) -CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS) - -# Generate dependency information -CPFLAGS += -MD -MP -MF .dep/$(@F).d - -# -# makefile rules -# - -all: $(OBJS) $(PROJECT).exe - -%o : %c - $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@ - -%o : %s - $(AS) -c $(ASFLAGS) $< -o $@ - -%exe: $(OBJS) - $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ - -clean: - -rm -f $(OBJS) - -rm -f $(PROJECT).exe - -rm -f $(PROJECT).map - -rm -f $(SRC:.c=.c.bak) - -rm -f $(SRC:.c=.lst) - -rm -f $(ASRC:.s=.s.bak) - -rm -f $(ASRC:.s=.lst) - -rm -fR .dep - -# -# Include the dependency files, should be the last of the makefile -# --include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) - -# *** EOF *** -- cgit v1.2.3 From f6c9ebb65b9a1239638125b7c1f910f12c722b79 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 25 Sep 2007 17:39:47 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@20 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chtypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h index 48bf7a7d9..49c7c6c38 100644 --- a/demos/Win32-MinGW/chtypes.h +++ b/demos/Win32-MinGW/chtypes.h @@ -33,7 +33,7 @@ typedef BYTE8 t_tmode; typedef BYTE8 t_tstate; -typedef WORD16 t_prio; +typedef LONG32 t_prio; typedef PTR_EQ t_msg; typedef LONG32 t_eventid; typedef ULONG32 t_eventmask; -- cgit v1.2.3 From 619b739d93252f4fc78a98e1bd1c36e9edbbca28 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 25 Sep 2007 18:38:01 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@21 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chtypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h index 49c7c6c38..48bf7a7d9 100644 --- a/demos/Win32-MinGW/chtypes.h +++ b/demos/Win32-MinGW/chtypes.h @@ -33,7 +33,7 @@ typedef BYTE8 t_tmode; typedef BYTE8 t_tstate; -typedef LONG32 t_prio; +typedef WORD16 t_prio; typedef PTR_EQ t_msg; typedef LONG32 t_eventid; typedef ULONG32 t_eventmask; -- cgit v1.2.3 From 95b238fc867da32f28c74b98b793fbd40345b595 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 25 Sep 2007 18:41:39 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@23 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chtypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h index 48bf7a7d9..49c7c6c38 100644 --- a/demos/Win32-MinGW/chtypes.h +++ b/demos/Win32-MinGW/chtypes.h @@ -33,7 +33,7 @@ typedef BYTE8 t_tmode; typedef BYTE8 t_tstate; -typedef WORD16 t_prio; +typedef LONG32 t_prio; typedef PTR_EQ t_msg; typedef LONG32 t_eventid; typedef ULONG32 t_eventmask; -- cgit v1.2.3 From 3a90ab685aaae59f242ae31260e67e9125ae78cd Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 1 Oct 2007 17:42:47 +0000 Subject: Preparation for AVR core support. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@27 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 6 +++--- demos/Win32-MinGW/chcore.h | 2 +- demos/Win32-MinGW/chtypes.h | 14 ++++---------- 3 files changed, 8 insertions(+), 14 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index b7dc8b024..4ab603d8e 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -58,9 +58,9 @@ UADEFS = # List C source files here SRC = chcore.c demo.c \ ../../ports/win32/simcom.c \ - ../../src/chinit.c ../../src/chdelta.c ../../src/chschd.c ../../src/chthreads.c \ - ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c \ - ../../src/chqueues.c ../../src/chserial.c + ../../src/chinit.c ../../src/chlists.c ../../src/chdelta.c ../../src/chschd.c \ + ../../src/chthreads.c ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c \ + ../../src/chsleep.c ../../src/chqueues.c ../../src/chserial.c # List ASM source files here ASRC = chcore2.s diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index b8872c819..7f0021854 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -63,7 +63,7 @@ typedef struct { #define INT_REQUIRED_STACK 0x0 -#define UserStackSize(n) (sizeof(Thread) + sizeof(PTR_EQ) + sizeof(PTR_EQ) + \ +#define UserStackSize(n) (sizeof(Thread) + sizeof(void *) * 2 + \ sizeof(struct stackregs) + (n) + (INT_REQUIRED_STACK)) __attribute__((fastcall)) void chSysHalt(void); diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h index 49c7c6c38..803b5ead4 100644 --- a/demos/Win32-MinGW/chtypes.h +++ b/demos/Win32-MinGW/chtypes.h @@ -25,28 +25,22 @@ */ #define BOOL char #define BYTE8 unsigned char +#define SBYTE8 char #define WORD16 short #define UWORD16 unsigned short #define LONG32 int #define ULONG32 unsigned int -#define PTR_EQ int typedef BYTE8 t_tmode; typedef BYTE8 t_tstate; -typedef LONG32 t_prio; -typedef PTR_EQ t_msg; +typedef ULONG32 t_prio; +typedef LONG32 t_msg; typedef LONG32 t_eventid; typedef ULONG32 t_eventmask; typedef ULONG32 t_time; -typedef LONG32 t_semcnt; +typedef LONG32 t_cnt; typedef ULONG32 t_size; -#define MINPRIO 0x8000 -#define MAXPRIO 0x7fff - -#define MINDELTA 0 -#define MAXDELTA 0xffff - #define INLINE inline #endif /* _CHTYPES_H_ */ -- cgit v1.2.3 From 2310f80695b4051cb63ca14878dfc5e76acb94e6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 3 Oct 2007 17:14:03 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@30 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 2 +- demos/Win32-MinGW/chconf.h | 8 ++++++-- demos/Win32-MinGW/chcore.c | 2 +- demos/Win32-MinGW/chcore2.s | 2 +- demos/Win32-MinGW/demo.c | 17 ++++++++++++++--- 5 files changed, 23 insertions(+), 8 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index 4ab603d8e..9ee9dfb77 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -57,7 +57,7 @@ UADEFS = # List C source files here SRC = chcore.c demo.c \ - ../../ports/win32/simcom.c \ + ../../test/test.c ../../ports/win32/simcom.c \ ../../src/chinit.c ../../src/chlists.c ../../src/chdelta.c ../../src/chschd.c \ ../../src/chthreads.c ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c \ ../../src/chsleep.c ../../src/chqueues.c ../../src/chserial.c diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 13de9f457..5582ae80a 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -68,6 +68,10 @@ * in the kernel.*/ #define CH_USE_SEMAPHORES +/** Configuration option: if specified then the Semaphores atomic Signal+Wait + * APIs are included in the kernel.*/ +#define CH_USE_SEMSW + /** Configuration option: if specified then the Semaphores with timeout APIs * are included in the kernel. * @note requires \p CH_USE_SEMAPHORES. @@ -134,11 +138,11 @@ /** Configuration option: Frequency of the system timer that drives the system * ticks. This also defines the system time unit.*/ -#define CH_FREQUENCY 100 +#define CH_FREQUENCY 1000 /** Configuration option: This constant is the number of ticks allowed for the * threads before preemption occurs.*/ -#define CH_TIME_QUANTUM 10 +#define CH_TIME_QUANTUM 20 /** Configuration option: Defines a CPU register to be used as storage for the * global \p currp variable. Caching this variable in a register can greatly diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index d48188b49..77195c44c 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -52,7 +52,7 @@ void InitCore(void) { exit(1); } - printf("Win32 ChobiOS/RT simulator\n\n"); + printf("Win32 ChibiOS/RT simulator\n\n"); printf("Thread structure %d bytes\n", sizeof(Thread)); if (!QueryPerformanceFrequency(&slice)) { printf("QueryPerformanceFrequency() error"); diff --git a/demos/Win32-MinGW/chcore2.s b/demos/Win32-MinGW/chcore2.s index 80985e3f7..c8260e3e6 100644 --- a/demos/Win32-MinGW/chcore2.s +++ b/demos/Win32-MinGW/chcore2.s @@ -39,5 +39,5 @@ .p2align 4,,15 .globl @threadstart@0 @threadstart@0: - push %ecx + push %eax call _chThdExit diff --git a/demos/Win32-MinGW/demo.c b/demos/Win32-MinGW/demo.c index 166923d2c..077877f8e 100644 --- a/demos/Win32-MinGW/demo.c +++ b/demos/Win32-MinGW/demo.c @@ -36,6 +36,8 @@ static t_msg WatchdogThread(void *arg); static t_msg ConsoleThread(void *arg); static t_msg InitThread(void *arg); +t_msg TestThread(void *p); + void InitCore(void); extern FullDuplexDriver COM1, COM2; @@ -73,7 +75,7 @@ static t_msg WatchdogThread(void *arg) { printf("Halted by watchdog"); chSysHalt(); } - chThdSleep(5); + chThdSleep(50); } return 0; } @@ -144,7 +146,7 @@ static t_msg HelloWorldThread(void *arg) { for (i = 0; i < 100; i++) { PrintLineFDD(sd, "Hello World\r\n"); - c = chFDDGetTimeout(sd, 33); + c = chFDDGetTimeout(sd, 333); switch (c) { case -1: continue; @@ -154,7 +156,7 @@ static t_msg HelloWorldThread(void *arg) { PrintLineFDD(sd, "^C\r\n"); return 0; default: - chThdSleep(33); + chThdSleep(333); } } return 0; @@ -202,6 +204,7 @@ static t_msg ShellThread(void *arg) { PrintLineFDD(sd, " exit - Logout from ChibiOS/RT\r\n"); PrintLineFDD(sd, " time - Prints the system timer value\r\n"); PrintLineFDD(sd, " hello - Runs the Hello World demo thread\r\n"); + PrintLineFDD(sd, " test - Runs the System Test thread\r\n"); } else if (stricmp(lp, "exit") == 0) { if (checkend(sd)) @@ -223,6 +226,14 @@ static t_msg ShellThread(void *arg) { if (chThdWait(tp)) break; // Lost connection while executing the hello thread. } + else if (stricmp(lp, "test") == 0) { + if (checkend(sd)) + continue; + tp = chThdCreate(NORMALPRIO, 0, tarea, sizeof(tarea), + TestThread, arg); + if (chThdWait(tp)) + break; // Lost connection while executing the hello thread. + } else { PrintLineFDD(sd, lp); PrintLineFDD(sd, " ?\r\n"); -- cgit v1.2.3 From 00c6f5ea40f97385dce7ab7b9d20bc0cb909ad23 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 6 Oct 2007 09:53:07 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@40 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 77195c44c..4f677b929 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -58,7 +58,7 @@ void InitCore(void) { printf("QueryPerformanceFrequency() error"); exit(1); } - printf("Core Frequency %d Hz\n", (int)slice.LowPart); + printf("Core Frequency %u Hz\n", (int)slice.LowPart); slice.QuadPart /= CH_FREQUENCY; QueryPerformanceCounter(&nextcnt); nextcnt.QuadPart += slice.QuadPart; @@ -92,6 +92,8 @@ static void ChkIntSources(void) { __attribute__((fastcall)) void chSysPause(void) { + chThdSetPriority(IDLEPRIO); + while (TRUE) { ChkIntSources(); -- cgit v1.2.3 From 73642ca0cce31ed6982813a90b89e4de05da76cb Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 13 Oct 2007 06:59:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@48 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 4f677b929..ee04147e9 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -76,7 +76,8 @@ static void ChkIntSources(void) { if (Com1InInterruptSimCom() || Com2InInterruptSimCom() || Com1OutInterruptSimCom() || Com2OutInterruptSimCom() || Com1ConnInterruptSimCom() || Com2ConnInterruptSimCom()) { - chSchRescheduleI(); + if (chSchRescRequiredI()) + chSchDoRescheduleI(); return; } -- cgit v1.2.3 From 70c86d43ec79032c7172507fc12bf7d78d44a3de Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 15 Oct 2007 14:52:56 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@53 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 5582ae80a..b7a8acedd 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -56,6 +56,10 @@ * function is included in the kernel.*/ #define CH_USE_RESUME +/** Configuration option: if specified then the \p chThdSuspend() + * function is included in the kernel.*/ +#define CH_USE_SUSPEND + /** Configuration option: if specified then the \p chThdTerminate() * and \p chThdShouldTerminate() functions are included in the kernel.*/ #define CH_USE_TERMINATE -- cgit v1.2.3 From 890c5532da783e8d58cfbf28822bcedaa8a0c61d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 14 Nov 2007 16:32:41 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@90 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 6 ++++++ demos/Win32-MinGW/chcore.c | 2 +- demos/Win32-MinGW/chcore.h | 2 +- demos/Win32-MinGW/chtypes.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index b7a8acedd..8ce32defa 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -161,6 +161,12 @@ */ //#define CH_CURRP_REGISTER_CACHE "reg" +/** Configuration option: Includes basic debug support to the kernel. + * @note the debug support is port-dependent, it may be not present on some + * targets. In that case stub functions will be included. + */ +//#define CH_USE_DEBUG + #endif /* _CHCONF_H_ */ /** @} */ diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index ee04147e9..c96611f8b 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -70,7 +70,7 @@ void InitCore(void) { /* * Interrupt simulation. */ -static void ChkIntSources(void) { +void ChkIntSources(void) { LARGE_INTEGER n; if (Com1InInterruptSimCom() || Com2InInterruptSimCom() || diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 7f0021854..6d3055081 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -58,8 +58,8 @@ typedef struct { } #define chSysLock() - #define chSysUnlock() +#define chSysPuts(msg) {} #define INT_REQUIRED_STACK 0x0 diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h index 803b5ead4..2ac219148 100644 --- a/demos/Win32-MinGW/chtypes.h +++ b/demos/Win32-MinGW/chtypes.h @@ -33,6 +33,7 @@ typedef BYTE8 t_tmode; typedef BYTE8 t_tstate; +typedef UWORD16 t_tid; typedef ULONG32 t_prio; typedef LONG32 t_msg; typedef LONG32 t_eventid; -- cgit v1.2.3 From b3361bd0e8ca074dbf7f312a87bbcdbf0019ebc7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 19 Nov 2007 11:09:33 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@97 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.c | 4 +--- demos/Win32-MinGW/chcore.h | 5 +++-- demos/Win32-MinGW/demo.c | 39 ++++++++++++--------------------------- 3 files changed, 16 insertions(+), 32 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index c96611f8b..eab41ab27 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -91,9 +91,7 @@ void ChkIntSources(void) { } } -__attribute__((fastcall)) void chSysPause(void) { - - chThdSetPriority(IDLEPRIO); +t_msg _IdleThread(void *p) { while (TRUE) { diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 6d3055081..a28aa2833 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -62,12 +62,13 @@ typedef struct { #define chSysPuts(msg) {} #define INT_REQUIRED_STACK 0x0 - #define UserStackSize(n) (sizeof(Thread) + sizeof(void *) * 2 + \ sizeof(struct stackregs) + (n) + (INT_REQUIRED_STACK)) +#define IDLE_THREAD_STACK_SIZE 16384 +t_msg _IdleThread(void *p); + __attribute__((fastcall)) void chSysHalt(void); -__attribute__((fastcall)) void chSysPause(void); __attribute__((fastcall)) void chSysSwitchI(Context *oldp, Context *newp); __attribute__((fastcall)) void threadstart(void); diff --git a/demos/Win32-MinGW/demo.c b/demos/Win32-MinGW/demo.c index 077877f8e..1d4f4aa16 100644 --- a/demos/Win32-MinGW/demo.c +++ b/demos/Win32-MinGW/demo.c @@ -25,16 +25,12 @@ static ULONG32 wdguard; static BYTE8 wdarea[UserStackSize(2048)]; -static ULONG32 iguard; -static BYTE8 iarea[UserStackSize(2048)]; - static ULONG32 cdguard; static BYTE8 cdarea[UserStackSize(2048)]; static Thread *cdtp; static t_msg WatchdogThread(void *arg); static t_msg ConsoleThread(void *arg); -static t_msg InitThread(void *arg); t_msg TestThread(void *p); @@ -43,34 +39,16 @@ extern FullDuplexDriver COM1, COM2; #define cprint(msg) chMsgSend(cdtp, (t_msg)msg) -/*------------------------------------------------------------------------* - * Simulator main, start here your threads, examples inside. * - *------------------------------------------------------------------------*/ -int main(void) { - - InitCore(); - - // Startup ChibiOS/RT. - chSysInit(); - chThdCreate(NORMALPRIO + 2, 0, wdarea, sizeof(wdarea), WatchdogThread, NULL); - cdtp = chThdCreate(NORMALPRIO + 1, 0, cdarea, sizeof(cdarea), ConsoleThread, NULL); - chThdCreate(NORMALPRIO, 0, iarea, sizeof(iarea), InitThread, NULL); - chSysPause(); - return 0; -} - /* * Watchdog thread, it checks magic values located under the various stack * areas. The system is halted if something is wrong. */ static t_msg WatchdogThread(void *arg) { wdguard = 0xA51F2E3D; - iguard = 0xA51F2E3D; cdguard = 0xA51F2E3D; while (TRUE) { if ((wdguard != 0xA51F2E3D) || - (iguard != 0xA51F2E3D) || (cdguard != 0xA51F2E3D)) { printf("Halted by watchdog"); chSysHalt(); @@ -294,13 +272,20 @@ static t_evhandler fhandlers[2] = { COM2Handler }; -/* - * Init-like thread, it starts the shells and handles their termination. - * It is a good example of events usage. - */ -static t_msg InitThread(void *arg) { +/*------------------------------------------------------------------------* + * Simulator main, start here your threads, examples inside. * + *------------------------------------------------------------------------*/ +int main(void) { EventListener c1fel, c2fel; + InitCore(); + + // Startup ChibiOS/RT. + chSysInit(); + + chThdCreate(NORMALPRIO + 2, 0, wdarea, sizeof(wdarea), WatchdogThread, NULL); + cdtp = chThdCreate(NORMALPRIO + 1, 0, cdarea, sizeof(cdarea), ConsoleThread, NULL); + cprint("Console service started on COM1, COM2\n"); cprint(" - Listening for connections on COM1\n"); chFDDGetAndClearFlags(&COM1); -- cgit v1.2.3 From 97bf45204321755cf2e78a7cc7ff616edaec59c4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 22 Nov 2007 15:24:50 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@105 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.h | 2 ++ demos/Win32-MinGW/demo.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index a28aa2833..c79b9bf81 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -65,6 +65,8 @@ typedef struct { #define UserStackSize(n) (sizeof(Thread) + sizeof(void *) * 2 + \ sizeof(struct stackregs) + (n) + (INT_REQUIRED_STACK)) +#define WorkingArea(s, n) ULONG32 s[UserStackSize(n) >> 2]; + #define IDLE_THREAD_STACK_SIZE 16384 t_msg _IdleThread(void *p); diff --git a/demos/Win32-MinGW/demo.c b/demos/Win32-MinGW/demo.c index 1d4f4aa16..7f8bd6903 100644 --- a/demos/Win32-MinGW/demo.c +++ b/demos/Win32-MinGW/demo.c @@ -23,10 +23,10 @@ #include static ULONG32 wdguard; -static BYTE8 wdarea[UserStackSize(2048)]; +static WorkingArea(wdarea, 2048); static ULONG32 cdguard; -static BYTE8 cdarea[UserStackSize(2048)]; +static WorkingArea(cdarea, 2048); static Thread *cdtp; static t_msg WatchdogThread(void *arg); @@ -159,7 +159,7 @@ static t_msg ShellThread(void *arg) { FullDuplexDriver *sd = (FullDuplexDriver *)arg; char *lp, line[64]; Thread *tp; - BYTE8 tarea[UserStackSize(1024)]; + WorkingArea(tarea, 1024); chIQReset(&sd->sd_iqueue); chOQReset(&sd->sd_oqueue); @@ -221,7 +221,7 @@ static t_msg ShellThread(void *arg) { return 0; } -static BYTE8 s1area[UserStackSize(4096)]; +static WorkingArea(s1area, 2048); static Thread *s1; EventListener s1tel; @@ -244,7 +244,7 @@ static void COM1Handler(t_eventid id) { chIQReset(&COM1.sd_iqueue); } -static BYTE8 s2area[UserStackSize(4096)]; +static WorkingArea(s2area, 2048); static Thread *s2; EventListener s2tel; -- cgit v1.2.3 From a134cd919ea3e6fee591bc29d360f3da74f46a8b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 27 Nov 2007 11:43:28 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@115 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 8ce32defa..af19dd995 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -167,6 +167,10 @@ */ //#define CH_USE_DEBUG +/** Debug option: Includes the threads context switch tracing feature. + */ +//#define CH_USE_TRACE + #endif /* _CHCONF_H_ */ /** @} */ -- cgit v1.2.3 From 6f0569444dafdae8b367a54a07a4bfaf3675f545 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 27 Nov 2007 16:02:12 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@117 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.h | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index c79b9bf81..2b90dd470 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -29,7 +29,7 @@ typedef void *regx86; /* * Stack saved context. */ -struct stackregs { +struct intctx { regx86 ebx; regx86 edi; regx86 esi; @@ -38,33 +38,36 @@ struct stackregs { }; typedef struct { - struct stackregs *esp; + struct intctx *esp; } Context; #define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a) -#define SETUP_CONTEXT(workspace, wsize, pf, arg) \ -{ \ - BYTE8 *esp = (BYTE8 *)workspace + wsize; \ - APUSH(esp, arg); \ - APUSH(esp, threadstart); \ - esp -= sizeof(struct stackregs); \ - ((struct stackregs *)esp)->eip = pf; \ - ((struct stackregs *)esp)->ebx = 0; \ - ((struct stackregs *)esp)->edi = 0; \ - ((struct stackregs *)esp)->esi = 0; \ - ((struct stackregs *)esp)->ebp = 0; \ - tp->p_ctx.esp = (struct stackregs *)esp; \ +#define SETUP_CONTEXT(workspace, wsize, pf, arg) \ +{ \ + BYTE8 *esp = (BYTE8 *)workspace + wsize; \ + APUSH(esp, arg); \ + APUSH(esp, threadstart); \ + esp -= sizeof(struct intctx); \ + ((struct intctx *)esp)->eip = pf; \ + ((struct intctx *)esp)->ebx = 0; \ + ((struct intctx *)esp)->edi = 0; \ + ((struct intctx *)esp)->esi = 0; \ + ((struct intctx *)esp)->ebp = 0; \ + tp->p_ctx.esp = (struct intctx *)esp; \ } #define chSysLock() #define chSysUnlock() #define chSysPuts(msg) {} -#define INT_REQUIRED_STACK 0x0 -#define UserStackSize(n) (sizeof(Thread) + sizeof(void *) * 2 + \ - sizeof(struct stackregs) + (n) + (INT_REQUIRED_STACK)) - +#define INT_REQUIRED_STACK 0 +#define StackAlign(n) ((((n) - 1) | 3) + 1) +#define UserStackSize(n) StackAlign(sizeof(Thread) + \ + sizeof(void *) * 2 + \ + sizeof(struct intctx) + \ + (n) + \ + INT_REQUIRED_STACK) #define WorkingArea(s, n) ULONG32 s[UserStackSize(n) >> 2]; #define IDLE_THREAD_STACK_SIZE 16384 -- cgit v1.2.3 From bef9d20d8eb9186a4f03c397ae880be7cad7efe1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 4 Dec 2007 14:48:41 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@126 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index eab41ab27..866ac791e 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -85,7 +85,7 @@ void ChkIntSources(void) { QueryPerformanceCounter(&n); if (n.QuadPart > nextcnt.QuadPart) { nextcnt.QuadPart += slice.QuadPart; - chSchTimerHandlerI(); + chSysTimerHandlerI(); if (chSchRescRequiredI()) chSchDoRescheduleI(); } -- cgit v1.2.3 From 430010715e7a9af17185412273165674f3b58f20 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 16 Dec 2007 19:01:30 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@141 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index af19dd995..3e741bb8c 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -82,10 +82,9 @@ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ #define CH_USE_SEMAPHORES_TIMEOUT -/** Configuration option: if specified then the Semaphores APIs with priority - * shift are included in the kernel. - * @note requires \p CH_USE_SEMAPHORES.*/ -#define CH_USE_RT_SEMAPHORES +/** Configuration option: if specified then the Mutexes APIs are included in + * the kernel.*/ +#define CH_USE_MUTEXES /** Configuration option: if specified then the Events APIs are included in * the kernel.*/ -- cgit v1.2.3 From 0bb20d36f4f1c8457416167b399d976d26660611 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 17 Dec 2007 14:57:44 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@142 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 2b90dd470..43265326b 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -60,6 +60,8 @@ typedef struct { #define chSysLock() #define chSysUnlock() #define chSysPuts(msg) {} +#define chSysIRQEnterI() +#define chSysIRQExitI() #define INT_REQUIRED_STACK 0 #define StackAlign(n) ((((n) - 1) | 3) + 1) -- cgit v1.2.3 From 398c024927d7fb31d86c50e081a74a9c8fd45769 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 23 Dec 2007 09:40:50 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@159 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 7 ++++--- demos/Win32-MinGW/demo.c | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index 9ee9dfb77..8d4edec7e 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -58,9 +58,10 @@ UADEFS = # List C source files here SRC = chcore.c demo.c \ ../../test/test.c ../../ports/win32/simcom.c \ - ../../src/chinit.c ../../src/chlists.c ../../src/chdelta.c ../../src/chschd.c \ - ../../src/chthreads.c ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c \ - ../../src/chsleep.c ../../src/chqueues.c ../../src/chserial.c + ../../src/chinit.c ../../src/chdebug.c ../../src/chlists.c ../../src/chdelta.c \ + ../../src/chschd.c ../../src/chthreads.c ../../src/chsem.c ../../src/chmtx.c \ + ../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c ../../src/chqueues.c \ + ../../src/chserial.c \ # List ASM source files here ASRC = chcore2.s diff --git a/demos/Win32-MinGW/demo.c b/demos/Win32-MinGW/demo.c index 7f8bd6903..acf17e7fd 100644 --- a/demos/Win32-MinGW/demo.c +++ b/demos/Win32-MinGW/demo.c @@ -159,7 +159,7 @@ static t_msg ShellThread(void *arg) { FullDuplexDriver *sd = (FullDuplexDriver *)arg; char *lp, line[64]; Thread *tp; - WorkingArea(tarea, 1024); + WorkingArea(tarea, 2048); chIQReset(&sd->sd_iqueue); chOQReset(&sd->sd_oqueue); @@ -221,7 +221,7 @@ static t_msg ShellThread(void *arg) { return 0; } -static WorkingArea(s1area, 2048); +static WorkingArea(s1area, 4096); static Thread *s1; EventListener s1tel; @@ -244,7 +244,7 @@ static void COM1Handler(t_eventid id) { chIQReset(&COM1.sd_iqueue); } -static WorkingArea(s2area, 2048); +static WorkingArea(s2area, 4096); static Thread *s2; EventListener s2tel; -- cgit v1.2.3 From b1db8a9f7fe3bc2cd48c52e7c2c50e0e118f8889 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 7 Jan 2008 14:06:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@166 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 3e741bb8c..115db4325 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -112,6 +112,11 @@ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ #define CH_USE_MESSAGES_EVENT +/** Configuration option: If enabled then the threads have an option to serve + * messages by priority instead of FIFO order. + * @note requires \p CH_USE_MESSAGES.*/ +#define CH_USE_MESSAGES_PRIORITY + /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. * @note requires \p CH_USE_MESSAGES. -- cgit v1.2.3 From 29feb9855078f659c1ff9c9459c0a013a9be4daf Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 7 Jan 2008 14:16:06 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@168 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 115db4325..b913a6cc4 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -115,7 +115,7 @@ /** Configuration option: If enabled then the threads have an option to serve * messages by priority instead of FIFO order. * @note requires \p CH_USE_MESSAGES.*/ -#define CH_USE_MESSAGES_PRIORITY +//#define CH_USE_MESSAGES_PRIORITY /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. -- cgit v1.2.3 From 8fb01ac78308d1fdb0efad351a5ffd5f48981a2f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 17 Jan 2008 09:44:36 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@179 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.h | 2 +- demos/Win32-MinGW/chcore2.s | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 43265326b..6bb2664f5 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -76,7 +76,7 @@ typedef struct { t_msg _IdleThread(void *p); __attribute__((fastcall)) void chSysHalt(void); -__attribute__((fastcall)) void chSysSwitchI(Context *oldp, Context *newp); +__attribute__((fastcall)) void chSysSwitchI(Thread *otp, Thread *ntp); __attribute__((fastcall)) void threadstart(void); #endif /* _CHCORE_H_ */ diff --git a/demos/Win32-MinGW/chcore2.s b/demos/Win32-MinGW/chcore2.s index c8260e3e6..9334fbfdc 100644 --- a/demos/Win32-MinGW/chcore2.s +++ b/demos/Win32-MinGW/chcore2.s @@ -27,9 +27,9 @@ push %esi push %edi push %ebx - movl %esp,(%ecx) + movl %esp,16(%ecx) # Switch in - movl (%edx),%esp + movl 16(%edx),%esp pop %ebx pop %edi pop %esi -- cgit v1.2.3 From 68003a03c299850f0b66adfa4df6c9d6b6ba6ab2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 23 Jan 2008 14:50:42 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@182 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index b913a6cc4..15cf3d323 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -100,12 +100,6 @@ * included in the kernel.*/ #define CH_USE_MESSAGES -/** Configuration option: if specified then the \p chMsgSendTimeout() - * function is included in the kernel. - * @note requires \p CH_USE_MESSAGES. - * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ -#define CH_USE_MESSAGES_TIMEOUT - /** Configuration option: if specified then the \p chMsgSendWithEvent() * function is included in the kernel. * @note requires \p CH_USE_MESSAGES. -- cgit v1.2.3 From 99ac65be2ac3d59a4de3b5adaa4dd9adeb80c1e2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 4 Mar 2008 10:33:38 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@213 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.h | 4 ++-- demos/Win32-MinGW/chtypes.h | 36 +++++++++++++++--------------------- demos/Win32-MinGW/demo.c | 16 ++++++++-------- 3 files changed, 25 insertions(+), 31 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 6bb2664f5..fed88c171 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -45,7 +45,7 @@ typedef struct { #define SETUP_CONTEXT(workspace, wsize, pf, arg) \ { \ - BYTE8 *esp = (BYTE8 *)workspace + wsize; \ + uint8_t *esp = (uint8_t *)workspace + wsize; \ APUSH(esp, arg); \ APUSH(esp, threadstart); \ esp -= sizeof(struct intctx); \ @@ -70,7 +70,7 @@ typedef struct { sizeof(struct intctx) + \ (n) + \ INT_REQUIRED_STACK) -#define WorkingArea(s, n) ULONG32 s[UserStackSize(n) >> 2]; +#define WorkingArea(s, n) uint32_t s[UserStackSize(n) >> 2]; #define IDLE_THREAD_STACK_SIZE 16384 t_msg _IdleThread(void *p); diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h index 2ac219148..c8a1dc69c 100644 --- a/demos/Win32-MinGW/chtypes.h +++ b/demos/Win32-MinGW/chtypes.h @@ -20,27 +20,21 @@ #ifndef _CHTYPES_H_ #define _CHTYPES_H_ -/* - * Generic types often dependant on the compiler. - */ -#define BOOL char -#define BYTE8 unsigned char -#define SBYTE8 char -#define WORD16 short -#define UWORD16 unsigned short -#define LONG32 int -#define ULONG32 unsigned int - -typedef BYTE8 t_tmode; -typedef BYTE8 t_tstate; -typedef UWORD16 t_tid; -typedef ULONG32 t_prio; -typedef LONG32 t_msg; -typedef LONG32 t_eventid; -typedef ULONG32 t_eventmask; -typedef ULONG32 t_time; -typedef LONG32 t_cnt; -typedef ULONG32 t_size; +#if !defined(_STDINT_H) && !defined(__STDINT_H_) +#include +#endif + +typedef int8_t t_bool; +typedef uint8_t t_tmode; +typedef uint8_t t_tstate; +typedef uint16_t t_tid; +typedef uint32_t t_prio; +typedef int32_t t_msg; +typedef int32_t t_eventid; +typedef uint32_t t_eventmask; +typedef uint32_t t_time; +typedef int32_t t_cnt; +typedef uint32_t t_size; #define INLINE inline diff --git a/demos/Win32-MinGW/demo.c b/demos/Win32-MinGW/demo.c index acf17e7fd..0b646a50b 100644 --- a/demos/Win32-MinGW/demo.c +++ b/demos/Win32-MinGW/demo.c @@ -22,10 +22,10 @@ #include -static ULONG32 wdguard; +static uint32_t wdguard; static WorkingArea(wdarea, 2048); -static ULONG32 cdguard; +static uint32_t cdguard; static WorkingArea(cdarea, 2048); static Thread *cdtp; @@ -78,7 +78,7 @@ static void PrintLineFDD(FullDuplexDriver *sd, char *msg) { chFDDPut(sd, *msg++); } -static BOOL GetLineFDD(FullDuplexDriver *sd, char *line, int size) { +static t_bool GetLineFDD(FullDuplexDriver *sd, char *line, int size) { char *p = line; while (TRUE) { @@ -91,9 +91,9 @@ static BOOL GetLineFDD(FullDuplexDriver *sd, char *line, int size) { } if (c == 8) { if (p != line) { - chFDDPut(sd, (BYTE8)c); + chFDDPut(sd, (uint8_t)c); chFDDPut(sd, 0x20); - chFDDPut(sd, (BYTE8)c); + chFDDPut(sd, (uint8_t)c); p--; } continue; @@ -106,8 +106,8 @@ static BOOL GetLineFDD(FullDuplexDriver *sd, char *line, int size) { if (c < 0x20) continue; if (p < line + size - 1) { - chFDDPut(sd, (BYTE8)c); - *p++ = (BYTE8)c; + chFDDPut(sd, (uint8_t)c); + *p++ = (uint8_t)c; } } } @@ -140,7 +140,7 @@ static t_msg HelloWorldThread(void *arg) { return 0; } -static BOOL checkend(FullDuplexDriver *sd) { +static t_bool checkend(FullDuplexDriver *sd) { char * lp = strtok(NULL, " \009"); /* It is not thread safe but this is a demo.*/ if (lp) { -- cgit v1.2.3 From 5e64a9fec2e17d008b9488faa027d2beaa130a88 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 5 Mar 2008 10:59:11 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@215 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.c | 2 +- demos/Win32-MinGW/chcore.h | 2 +- demos/Win32-MinGW/chtypes.h | 25 ++++++++++++++----------- demos/Win32-MinGW/demo.c | 30 +++++++++++++++--------------- 4 files changed, 31 insertions(+), 28 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 866ac791e..047fe66da 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -91,7 +91,7 @@ void ChkIntSources(void) { } } -t_msg _IdleThread(void *p) { +msg_t _IdleThread(void *p) { while (TRUE) { diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index fed88c171..bc0ed3e42 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -73,7 +73,7 @@ typedef struct { #define WorkingArea(s, n) uint32_t s[UserStackSize(n) >> 2]; #define IDLE_THREAD_STACK_SIZE 16384 -t_msg _IdleThread(void *p); +msg_t _IdleThread(void *p); __attribute__((fastcall)) void chSysHalt(void); __attribute__((fastcall)) void chSysSwitchI(Thread *otp, Thread *ntp); diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h index c8a1dc69c..2fd609b1f 100644 --- a/demos/Win32-MinGW/chtypes.h +++ b/demos/Win32-MinGW/chtypes.h @@ -20,21 +20,24 @@ #ifndef _CHTYPES_H_ #define _CHTYPES_H_ +#define __need_NULL +#define __need_size_t +#include + #if !defined(_STDINT_H) && !defined(__STDINT_H_) #include #endif -typedef int8_t t_bool; -typedef uint8_t t_tmode; -typedef uint8_t t_tstate; -typedef uint16_t t_tid; -typedef uint32_t t_prio; -typedef int32_t t_msg; -typedef int32_t t_eventid; -typedef uint32_t t_eventmask; -typedef uint32_t t_time; -typedef int32_t t_cnt; -typedef uint32_t t_size; +typedef int8_t bool_t; +typedef uint8_t tmode_t; +typedef uint8_t tstate_t; +typedef uint16_t tid_t; +typedef uint32_t tprio_t; +typedef int32_t msg_t; +typedef int32_t eventid_t; +typedef uint32_t eventmask_t; +typedef uint32_t systime_t; +typedef int32_t cnt_t; #define INLINE inline diff --git a/demos/Win32-MinGW/demo.c b/demos/Win32-MinGW/demo.c index 0b646a50b..f3d276599 100644 --- a/demos/Win32-MinGW/demo.c +++ b/demos/Win32-MinGW/demo.c @@ -29,21 +29,21 @@ static uint32_t cdguard; static WorkingArea(cdarea, 2048); static Thread *cdtp; -static t_msg WatchdogThread(void *arg); -static t_msg ConsoleThread(void *arg); +static msg_t WatchdogThread(void *arg); +static msg_t ConsoleThread(void *arg); -t_msg TestThread(void *p); +msg_t TestThread(void *p); void InitCore(void); extern FullDuplexDriver COM1, COM2; -#define cprint(msg) chMsgSend(cdtp, (t_msg)msg) +#define cprint(msg) chMsgSend(cdtp, (msg_t)msg) /* * Watchdog thread, it checks magic values located under the various stack * areas. The system is halted if something is wrong. */ -static t_msg WatchdogThread(void *arg) { +static msg_t WatchdogThread(void *arg) { wdguard = 0xA51F2E3D; cdguard = 0xA51F2E3D; while (TRUE) { @@ -63,7 +63,7 @@ static t_msg WatchdogThread(void *arg) { * to the C printf() thread safe and the print operation atomic among threads. * In this example the message is the zero termitated string itself. */ -static t_msg ConsoleThread(void *arg) { +static msg_t ConsoleThread(void *arg) { while (!chThdShouldTerminate()) { printf((char *)chMsgWait()); @@ -78,7 +78,7 @@ static void PrintLineFDD(FullDuplexDriver *sd, char *msg) { chFDDPut(sd, *msg++); } -static t_bool GetLineFDD(FullDuplexDriver *sd, char *line, int size) { +static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) { char *p = line; while (TRUE) { @@ -116,7 +116,7 @@ static t_bool GetLineFDD(FullDuplexDriver *sd, char *line, int size) { * Example thread, not much to see here. It simulates the CTRL-C but there * are no real signals involved. */ -static t_msg HelloWorldThread(void *arg) { +static msg_t HelloWorldThread(void *arg) { int i; short c; FullDuplexDriver *sd = (FullDuplexDriver *)arg; @@ -140,7 +140,7 @@ static t_msg HelloWorldThread(void *arg) { return 0; } -static t_bool checkend(FullDuplexDriver *sd) { +static bool_t checkend(FullDuplexDriver *sd) { char * lp = strtok(NULL, " \009"); /* It is not thread safe but this is a demo.*/ if (lp) { @@ -155,7 +155,7 @@ static t_bool checkend(FullDuplexDriver *sd) { * Simple command shell thread, the argument is the serial line for the * standard input and output. It recognizes few simple commands. */ -static t_msg ShellThread(void *arg) { +static msg_t ShellThread(void *arg) { FullDuplexDriver *sd = (FullDuplexDriver *)arg; char *lp, line[64]; Thread *tp; @@ -225,8 +225,8 @@ static WorkingArea(s1area, 4096); static Thread *s1; EventListener s1tel; -static void COM1Handler(t_eventid id) { - t_dflags flags; +static void COM1Handler(eventid_t id) { + dflags_t flags; if (s1 && chThdTerminated(s1)) { s1 = NULL; @@ -248,8 +248,8 @@ static WorkingArea(s2area, 4096); static Thread *s2; EventListener s2tel; -static void COM2Handler(t_eventid id) { - t_dflags flags; +static void COM2Handler(eventid_t id) { + dflags_t flags; if (s2 && chThdTerminated(s2)) { s2 = NULL; @@ -267,7 +267,7 @@ static void COM2Handler(t_eventid id) { chIQReset(&COM2.sd_iqueue); } -static t_evhandler fhandlers[2] = { +static evhandler_t fhandlers[2] = { COM1Handler, COM2Handler }; -- cgit v1.2.3 From 777291ac8aaed233aa79bb4388ff3485e4c19de1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 12 Mar 2008 21:05:13 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@228 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index 8d4edec7e..ea206b0d0 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -76,7 +76,7 @@ ULIBDIR = ULIBS = # Define optimisation level here -OPT = -Os -fomit-frame-pointer -fno-strict-aliasing +OPT = -Os -fomit-frame-pointer # # End of user defines -- cgit v1.2.3 From 3d8180d95a02c876aa9de65a3364fd5de6657bc7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 19 Jun 2008 13:14:32 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@319 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chtypes.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h index 2fd609b1f..0b74459bc 100644 --- a/demos/Win32-MinGW/chtypes.h +++ b/demos/Win32-MinGW/chtypes.h @@ -40,5 +40,8 @@ typedef uint32_t systime_t; typedef int32_t cnt_t; #define INLINE inline +#define PACK_STRUCT_STRUCT __attribute__((packed)) +#define PACK_STRUCT_BEGIN +#define PACK_STRUCT_END #endif /* _CHTYPES_H_ */ -- cgit v1.2.3 From cc44376c6e07d5c47561db9f6179e51e0654391d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 26 Jun 2008 14:06:21 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@325 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index ea206b0d0..fe06db6e1 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -55,13 +55,14 @@ UDEFS = # Define ASM defines here UADEFS = +# Imported source files +include ../../src/kernel.mk +include ../../test/test.mk + # List C source files here -SRC = chcore.c demo.c \ - ../../test/test.c ../../ports/win32/simcom.c \ - ../../src/chinit.c ../../src/chdebug.c ../../src/chlists.c ../../src/chdelta.c \ - ../../src/chschd.c ../../src/chthreads.c ../../src/chsem.c ../../src/chmtx.c \ - ../../src/chevents.c ../../src/chmsg.c ../../src/chsleep.c ../../src/chqueues.c \ - ../../src/chserial.c \ +SRC = chcore.c demo.c ../../ports/win32/simcom.c \ + ${KERNSRC} \ + ${TESTSRC} # List ASM source files here ASRC = chcore2.s -- cgit v1.2.3 From eb9b4efd31018e4949e3cc09830a5ecfc1304664 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 25 Jul 2008 14:32:39 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@353 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 15cf3d323..b17295c65 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -43,6 +43,10 @@ * included in the kernel.*/ #define CH_USE_VIRTUAL_TIMERS +/** Configuration option: if specified then the kernel performs the round + * robin scheduling algorithm on threads of equal priority. */ +#define CH_USE_ROUNDROBIN + /** Configuration option: if specified then the System Timer subsystem is * included in the kernel.*/ #define CH_USE_SYSTEMTIME @@ -143,7 +147,8 @@ #define CH_FREQUENCY 1000 /** Configuration option: This constant is the number of ticks allowed for the - * threads before preemption occurs.*/ + * threads before preemption occurs. This option is only meaningful if the + * option \p CH_USE_ROUNDROBIN is also active.*/ #define CH_TIME_QUANTUM 20 /** Configuration option: Defines a CPU register to be used as storage for the -- cgit v1.2.3 From 6ae1a6c88223d875f0dbd81066d4d8f40713b0a0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 26 Jul 2008 09:46:43 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@360 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index b17295c65..e18ab2d0b 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -80,6 +80,10 @@ * APIs are included in the kernel.*/ #define CH_USE_SEMSW +/** Configuration option: if specified then the Conditional Variables APIs are + * included in the kernel.*/ +#define CH_USE_CONDVARS + /** Configuration option: if specified then the Semaphores with timeout APIs * are included in the kernel. * @note requires \p CH_USE_SEMAPHORES. -- cgit v1.2.3 From b27329f45b8e51d9ee2149e2ea102d13ce15f886 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 26 Jul 2008 17:39:01 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@366 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index e18ab2d0b..b17295c65 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -80,10 +80,6 @@ * APIs are included in the kernel.*/ #define CH_USE_SEMSW -/** Configuration option: if specified then the Conditional Variables APIs are - * included in the kernel.*/ -#define CH_USE_CONDVARS - /** Configuration option: if specified then the Semaphores with timeout APIs * are included in the kernel. * @note requires \p CH_USE_SEMAPHORES. -- cgit v1.2.3 From b689f00e31591e2f3b5b3607b15be428dfeb7e88 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 25 Aug 2008 13:00:11 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@401 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.h | 1 + 1 file changed, 1 insertion(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index bc0ed3e42..c3c3f3a0b 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -59,6 +59,7 @@ typedef struct { #define chSysLock() #define chSysUnlock() +#define chSysEnable() #define chSysPuts(msg) {} #define chSysIRQEnterI() #define chSysIRQExitI() -- cgit v1.2.3 From ac6b3caba1b75ca603e63946f8ca7f54c7ab598f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 26 Aug 2008 10:38:29 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@407 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 8 ++++++++ demos/Win32-MinGW/chtypes.h | 1 + 2 files changed, 9 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index b17295c65..674d747c1 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -142,6 +142,14 @@ * are included in the kernel.*/ #define CH_USE_SERIAL_HALFDUPLEX +/** Configuration option: if specified then the memory pools allocator APIs + * are included in the kernel.*/ +#define CH_USE_MEMPOOLS + +/** Configuration option: if specified then the memory pools allocator + provides an implementation of the sbrk() function.*/ +#define CH_MEMPOOLS_PROVIDE_SBRK + /** Configuration option: Frequency of the system timer that drives the system * ticks. This also defines the system time unit.*/ #define CH_FREQUENCY 1000 diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h index 0b74459bc..6f8662bd9 100644 --- a/demos/Win32-MinGW/chtypes.h +++ b/demos/Win32-MinGW/chtypes.h @@ -22,6 +22,7 @@ #define __need_NULL #define __need_size_t +#define __need_ptrdiff_t #include #if !defined(_STDINT_H) && !defined(__STDINT_H_) -- cgit v1.2.3 From 7768c51b7b1ef0becc4090705a9bd2f14aa28d00 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 28 Aug 2008 13:34:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@412 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 674d747c1..0912c3f6d 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -142,14 +142,26 @@ * are included in the kernel.*/ #define CH_USE_SERIAL_HALFDUPLEX +/** Configuration option: if specified then the memory heap allocator APIs + * are included in the kernel.*/ +#define CH_USE_HEAP + +/** Configuration option: Number of RAM bytes to use as system heap. If set to + * zero then the whole available RAM is used as system heap. + * @note In order to use the whole RAM as system heap the linker script must + * provide the \p __heap_base__ and \p __heap_end__ symbols. + * @note requires \p CH_USE_HEAP. + */ +#define CH_HEAP_SIZE 16384 + +/** Configuration option: enforces the use of the C-runtime \p malloc() and + * \p free() functions as backend for the system heap allocator.*/ +//#define CH_USE_MALLOC_HEAP + /** Configuration option: if specified then the memory pools allocator APIs * are included in the kernel.*/ #define CH_USE_MEMPOOLS -/** Configuration option: if specified then the memory pools allocator - provides an implementation of the sbrk() function.*/ -#define CH_MEMPOOLS_PROVIDE_SBRK - /** Configuration option: Frequency of the system timer that drives the system * ticks. This also defines the system time unit.*/ #define CH_FREQUENCY 1000 -- cgit v1.2.3 From 071e9457b0645f07a90485bd7a7c68fa5e34801b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 3 Sep 2008 12:18:39 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@421 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 0912c3f6d..f16918f72 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -51,23 +51,6 @@ * included in the kernel.*/ #define CH_USE_SYSTEMTIME -/** Configuration option: if specified then the \p chThdSleep() function is - * included in the kernel. - * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ -#define CH_USE_SLEEP - -/** Configuration option: if specified then the \p chThdResume() - * function is included in the kernel.*/ -#define CH_USE_RESUME - -/** Configuration option: if specified then the \p chThdSuspend() - * function is included in the kernel.*/ -#define CH_USE_SUSPEND - -/** Configuration option: if specified then the \p chThdTerminate() - * and \p chThdShouldTerminate() functions are included in the kernel.*/ -#define CH_USE_TERMINATE - /** Configuration option: if specified then the \p chThdWait() function * is included in the kernel.*/ #define CH_USE_WAITEXIT -- cgit v1.2.3 From 517440bad9d6d2f27689e4e3de72794d869d2c26 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 5 Sep 2008 13:04:28 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@425 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index f16918f72..71a2cf36e 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -29,16 +29,18 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ -/* - * NOTE: this is just documentation for doxigen, the real configuration file - * is the one into the project directories. - */ - /** Configuration option: if specified then time efficient rather than space * efficient code is used when two possible implementations exist, note * that this is not related to the compiler optimization options.*/ #define CH_OPTIMIZE_SPEED +/** Configuration option: it specified this option enables the \p Thread + * extension fields and initiazation code. + * @see THREAD_EXT_FIELDS + * @see THREAD_EXT_INIT + */ +//#define CH_USE_THREAD_EXT + /** Configuration option: if specified then the Virtual Timers subsystem is * included in the kernel.*/ #define CH_USE_VIRTUAL_TIMERS @@ -177,6 +179,23 @@ */ //#define CH_USE_TRACE +/** User fields added to the end of the \p Thread structure if the + * \p CH_USE_THREAD_EXT option is enabled. + * @see CH_USE_THREAD_EXT + */ +#define THREAD_EXT_FIELDS \ +struct { \ + /* Add fields here.*/ \ +}; + +/** User initialization code added to the \p chThdCreate() API if the + * \p CH_USE_THREAD_EXT option is enabled. + * @see CH_USE_THREAD_EXT + */ +#define THREAD_EXT_INIT(tp) { \ + /* Add initialization code here.*/ \ +} + #endif /* _CHCONF_H_ */ /** @} */ -- cgit v1.2.3 From 15ee17c8740a378cffcae681421b9e28fcde3d4c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 6 Sep 2008 08:56:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@426 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 1 + 1 file changed, 1 insertion(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 71a2cf36e..b52281cfa 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -102,6 +102,7 @@ /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. + * @deprecated * @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_EVENTS.*/ #define CH_USE_EXIT_EVENT -- cgit v1.2.3 From 9a1c91e6ee9baaee3529e16fc732cbd9c7e99844 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 22 Sep 2008 15:29:48 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@437 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index b52281cfa..c5bbf0410 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -148,6 +148,12 @@ * are included in the kernel.*/ #define CH_USE_MEMPOOLS +/** Configuration option: if specified then the dynamic objects creation APIs + * are included in the kernel. + * @note requires \p CH_USE_WAITEXIT. + */ +#define CH_USE_DYNAMIC + /** Configuration option: Frequency of the system timer that drives the system * ticks. This also defines the system time unit.*/ #define CH_FREQUENCY 1000 -- cgit v1.2.3 From 8feba91865981a1cb8b1ba12c4bce09997141f2f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 26 Sep 2008 10:46:10 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@444 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index c5bbf0410..46272d552 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -34,13 +34,6 @@ * that this is not related to the compiler optimization options.*/ #define CH_OPTIMIZE_SPEED -/** Configuration option: it specified this option enables the \p Thread - * extension fields and initiazation code. - * @see THREAD_EXT_FIELDS - * @see THREAD_EXT_INIT - */ -//#define CH_USE_THREAD_EXT - /** Configuration option: if specified then the Virtual Timers subsystem is * included in the kernel.*/ #define CH_USE_VIRTUAL_TIMERS @@ -102,9 +95,10 @@ /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. - * @deprecated - * @note requires \p CH_USE_MESSAGES. - * @note requires \p CH_USE_EVENTS.*/ + * @note requires \p CH_USE_EVENTS. + * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be + * removed in version 1.0.0. + */ #define CH_USE_EXIT_EVENT /** Configuration option: if specified then the I/O queues APIs are included @@ -186,21 +180,22 @@ */ //#define CH_USE_TRACE -/** User fields added to the end of the \p Thread structure if the - * \p CH_USE_THREAD_EXT option is enabled. - * @see CH_USE_THREAD_EXT - */ +/** User fields added to the end of the \p Thread structure. */ #define THREAD_EXT_FIELDS \ struct { \ - /* Add fields here.*/ \ + /* Add thread custom fields here.*/ \ }; -/** User initialization code added to the \p chThdCreate() API if the - * \p CH_USE_THREAD_EXT option is enabled. - * @see CH_USE_THREAD_EXT - */ +/** User initialization code added to the \p chThdCreate() API. + * @note It is invoked from within \p chThdInit(). */ #define THREAD_EXT_INIT(tp) { \ - /* Add initialization code here.*/ \ + /* Add thread initialization code here.*/ \ +} + +/** User finalization code added to the \p chThdExit() API. + * @note It is inserted into lock zone. */ +#define THREAD_EXT_EXIT(tp) { \ + /* Add thread finalization code here.*/ \ } #endif /* _CHCONF_H_ */ -- cgit v1.2.3 From 902470d1c542735b989a727355744a974af43de4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 25 Oct 2008 09:34:25 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@481 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 46272d552..f33f54930 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -17,10 +17,6 @@ along with this program. If not, see . */ -/* - * Configuration file for MingGW32 demo project. - */ - /** * @addtogroup Config * @{ @@ -34,18 +30,10 @@ * that this is not related to the compiler optimization options.*/ #define CH_OPTIMIZE_SPEED -/** Configuration option: if specified then the Virtual Timers subsystem is - * included in the kernel.*/ -#define CH_USE_VIRTUAL_TIMERS - /** Configuration option: if specified then the kernel performs the round * robin scheduling algorithm on threads of equal priority. */ #define CH_USE_ROUNDROBIN -/** Configuration option: if specified then the System Timer subsystem is - * included in the kernel.*/ -#define CH_USE_SYSTEMTIME - /** Configuration option: if specified then the \p chThdWait() function * is included in the kernel.*/ #define CH_USE_WAITEXIT @@ -60,8 +48,7 @@ /** Configuration option: if specified then the Semaphores with timeout APIs * are included in the kernel. - * @note requires \p CH_USE_SEMAPHORES. - * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ + * @note requires \p CH_USE_SEMAPHORES.*/ #define CH_USE_SEMAPHORES_TIMEOUT /** Configuration option: if specified then the Mutexes APIs are included in @@ -74,8 +61,7 @@ /** Configuration option: if specified then the \p chEvtWaitTimeout() * function is included in the kernel. - * @note requires \p CH_USE_EVENTS. - * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ + * @note requires \p CH_USE_EVENTS.*/ #define CH_USE_EVENTS_TIMEOUT /** Configuration option: if specified then the Synchronous Messages APIs are @@ -84,8 +70,7 @@ /** Configuration option: if specified then the \p chMsgSendWithEvent() * function is included in the kernel. - * @note requires \p CH_USE_MESSAGES. - * @note requires \p CH_USE_VIRTUAL_TIMERS.*/ + * @note requires \p CH_USE_MESSAGES.*/ #define CH_USE_MESSAGES_EVENT /** Configuration option: If enabled then the threads have an option to serve -- cgit v1.2.3 From 9336c1fc9fdae776126295737131d0a22b2f05b8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 8 Nov 2008 10:58:59 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@501 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index f33f54930..7c0420af6 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -59,11 +59,6 @@ * the kernel.*/ #define CH_USE_EVENTS -/** Configuration option: if specified then the \p chEvtWaitTimeout() - * function is included in the kernel. - * @note requires \p CH_USE_EVENTS.*/ -#define CH_USE_EVENTS_TIMEOUT - /** Configuration option: if specified then the Synchronous Messages APIs are * included in the kernel.*/ #define CH_USE_MESSAGES -- cgit v1.2.3 From cbc30670d8004caeb7b0a8a9567377ac99032805 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 8 Nov 2008 12:44:36 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@502 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 7c0420af6..7a444aa2d 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -59,6 +59,12 @@ * the kernel.*/ #define CH_USE_EVENTS +/** Configuration option: if specified then the \p chEvtWaitXXXTimeout() + * functions are included in the kernel. + * @note requires \p CH_USE_EVENTS. + */ +#define CH_USE_EVENTS_TIMEOUT + /** Configuration option: if specified then the Synchronous Messages APIs are * included in the kernel.*/ #define CH_USE_MESSAGES -- cgit v1.2.3 From aafa0564b8cdd61c68165217a4b7576bd35b2b4b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 9 Nov 2008 13:28:19 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@508 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 7a444aa2d..07ff4d0d5 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -55,6 +55,16 @@ * the kernel.*/ #define CH_USE_MUTEXES +/** Configuration option: if specified then the Conditional Variables APIs are + * included in the kernel. + * @note requires \p CH_USE_MUTEXES.*/ +#define CH_USE_CONDVARS + +/** Configuration option: if specified then the Conditional Variables APIs are + * included in the kernel. + * @note requires \p CH_USE_CONDVARS and \p CH_USE_MUTEXES.*/ +#define CH_USE_CONDVARS_TIMEOUT + /** Configuration option: if specified then the Events APIs are included in * the kernel.*/ #define CH_USE_EVENTS -- cgit v1.2.3 From 2b8c31c32f67d2e31ff19507ca3425f9bcecba76 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 13 Dec 2008 08:44:56 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@538 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.c | 2 +- demos/Win32-MinGW/chcore.h | 35 +++++++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 047fe66da..48842f186 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -91,7 +91,7 @@ void ChkIntSources(void) { } } -msg_t _IdleThread(void *p) { +msg_t _idle(void *p) { while (TRUE) { diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index c3c3f3a0b..2c916f536 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -24,6 +24,16 @@ #ifndef _CHCORE_H_ #define _CHCORE_H_ +/* + * Unique macro for the implemented architecture. + */ +#define CH_ARCHITECTURE_WIN32SIM + +/* + * Base type for stack alignment. + */ +typedef uint32_t stkalign_t; + typedef void *regx86; /* @@ -65,17 +75,26 @@ typedef struct { #define chSysIRQExitI() #define INT_REQUIRED_STACK 0 -#define StackAlign(n) ((((n) - 1) | 3) + 1) -#define UserStackSize(n) StackAlign(sizeof(Thread) + \ - sizeof(void *) * 2 + \ - sizeof(struct intctx) + \ - (n) + \ - INT_REQUIRED_STACK) -#define WorkingArea(s, n) uint32_t s[UserStackSize(n) >> 2]; +#define STACK_ALIGN(n) ((((n) - 1) | sizeof(stkalign_t)) + 1) +#define StackAlign(n) STACK_ALIGN(n) + +#define THD_WA_SIZE(n) StackAlign(sizeof(Thread) + \ + sizeof(void *) * 2 + \ + sizeof(struct intctx) + \ + (n) + \ + INT_REQUIRED_STACK) +#define UserStackSize(n) THD_WA_SIZE(n) + +#define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)]; +#define WorkingArea(s, n) WORKING_AREA(s, n) + +/* + * Stack size for the system idle thread. + */ #define IDLE_THREAD_STACK_SIZE 16384 -msg_t _IdleThread(void *p); +msg_t _idle(void *p); __attribute__((fastcall)) void chSysHalt(void); __attribute__((fastcall)) void chSysSwitchI(Thread *otp, Thread *ntp); __attribute__((fastcall)) void threadstart(void); -- cgit v1.2.3 From 436aa85ab1c30168d6cdd64de2a4eb1ca9fee534 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 13 Dec 2008 09:55:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@539 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 4 +- demos/Win32-MinGW/demo.c | 301 --------------------------------------------- demos/Win32-MinGW/main.c | 301 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 303 insertions(+), 303 deletions(-) delete mode 100644 demos/Win32-MinGW/demo.c create mode 100644 demos/Win32-MinGW/main.c (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index fe06db6e1..46cb9cad0 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -60,7 +60,7 @@ include ../../src/kernel.mk include ../../test/test.mk # List C source files here -SRC = chcore.c demo.c ../../ports/win32/simcom.c \ +SRC = chcore.c main.c ../../ports/win32/simcom.c \ ${KERNSRC} \ ${TESTSRC} @@ -77,7 +77,7 @@ ULIBDIR = ULIBS = # Define optimisation level here -OPT = -Os -fomit-frame-pointer +OPT = -ggdb -Os -fomit-frame-pointer # # End of user defines diff --git a/demos/Win32-MinGW/demo.c b/demos/Win32-MinGW/demo.c deleted file mode 100644 index f3d276599..000000000 --- a/demos/Win32-MinGW/demo.c +++ /dev/null @@ -1,301 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include -#include - -#include - -static uint32_t wdguard; -static WorkingArea(wdarea, 2048); - -static uint32_t cdguard; -static WorkingArea(cdarea, 2048); -static Thread *cdtp; - -static msg_t WatchdogThread(void *arg); -static msg_t ConsoleThread(void *arg); - -msg_t TestThread(void *p); - -void InitCore(void); -extern FullDuplexDriver COM1, COM2; - -#define cprint(msg) chMsgSend(cdtp, (msg_t)msg) - -/* - * Watchdog thread, it checks magic values located under the various stack - * areas. The system is halted if something is wrong. - */ -static msg_t WatchdogThread(void *arg) { - wdguard = 0xA51F2E3D; - cdguard = 0xA51F2E3D; - while (TRUE) { - - if ((wdguard != 0xA51F2E3D) || - (cdguard != 0xA51F2E3D)) { - printf("Halted by watchdog"); - chSysHalt(); - } - chThdSleep(50); - } - return 0; -} - -/* - * Console print server done using synchronous messages. This makes the access - * to the C printf() thread safe and the print operation atomic among threads. - * In this example the message is the zero termitated string itself. - */ -static msg_t ConsoleThread(void *arg) { - - while (!chThdShouldTerminate()) { - printf((char *)chMsgWait()); - chMsgRelease(RDY_OK); - } - return 0; -} - -static void PrintLineFDD(FullDuplexDriver *sd, char *msg) { - - while (*msg) - chFDDPut(sd, *msg++); -} - -static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) { - char *p = line; - - while (TRUE) { - short c = chIQGet(&sd->sd_iqueue); - if (c < 0) - return TRUE; - if (c == 4) { - PrintLineFDD(sd, "^D\r\n"); - return TRUE; - } - if (c == 8) { - if (p != line) { - chFDDPut(sd, (uint8_t)c); - chFDDPut(sd, 0x20); - chFDDPut(sd, (uint8_t)c); - p--; - } - continue; - } - if (c == '\r') { - PrintLineFDD(sd, "\r\n"); - *p = 0; - return FALSE; - } - if (c < 0x20) - continue; - if (p < line + size - 1) { - chFDDPut(sd, (uint8_t)c); - *p++ = (uint8_t)c; - } - } -} - -/* - * Example thread, not much to see here. It simulates the CTRL-C but there - * are no real signals involved. - */ -static msg_t HelloWorldThread(void *arg) { - int i; - short c; - FullDuplexDriver *sd = (FullDuplexDriver *)arg; - - for (i = 0; i < 100; i++) { - - PrintLineFDD(sd, "Hello World\r\n"); - c = chFDDGetTimeout(sd, 333); - switch (c) { - case -1: - continue; - case -2: - return 1; - case 3: - PrintLineFDD(sd, "^C\r\n"); - return 0; - default: - chThdSleep(333); - } - } - return 0; -} - -static bool_t checkend(FullDuplexDriver *sd) { - - char * lp = strtok(NULL, " \009"); /* It is not thread safe but this is a demo.*/ - if (lp) { - PrintLineFDD(sd, lp); - PrintLineFDD(sd, " ?\r\n"); - return TRUE; - } - return FALSE; -} - -/* - * Simple command shell thread, the argument is the serial line for the - * standard input and output. It recognizes few simple commands. - */ -static msg_t ShellThread(void *arg) { - FullDuplexDriver *sd = (FullDuplexDriver *)arg; - char *lp, line[64]; - Thread *tp; - WorkingArea(tarea, 2048); - - chIQReset(&sd->sd_iqueue); - chOQReset(&sd->sd_oqueue); - PrintLineFDD(sd, "ChibiOS/RT Command Shell\r\n\n"); - while (TRUE) { - PrintLineFDD(sd, "ch> "); - if (GetLineFDD(sd, line, sizeof(line))) { - PrintLineFDD(sd, "\nlogout"); - break; - } - lp = strtok(line, " \009"); // Note: not thread safe but it is just a demo. - if (lp) { - if ((stricmp(lp, "help") == 0) || - (stricmp(lp, "h") == 0) || - (stricmp(lp, "?") == 0)) { - if (checkend(sd)) - continue; - PrintLineFDD(sd, "Commands:\r\n"); - PrintLineFDD(sd, " help,h,? - This help\r\n"); - PrintLineFDD(sd, " exit - Logout from ChibiOS/RT\r\n"); - PrintLineFDD(sd, " time - Prints the system timer value\r\n"); - PrintLineFDD(sd, " hello - Runs the Hello World demo thread\r\n"); - PrintLineFDD(sd, " test - Runs the System Test thread\r\n"); - } - else if (stricmp(lp, "exit") == 0) { - if (checkend(sd)) - continue; - PrintLineFDD(sd, "\nlogout"); - break; - } - else if (stricmp(lp, "time") == 0) { - if (checkend(sd)) - continue; - sprintf(line, "Time: %d\r\n", chSysGetTime()); - PrintLineFDD(sd, line); - } - else if (stricmp(lp, "hello") == 0) { - if (checkend(sd)) - continue; - tp = chThdCreate(NORMALPRIO, 0, tarea, sizeof(tarea), - HelloWorldThread, sd); - if (chThdWait(tp)) - break; // Lost connection while executing the hello thread. - } - else if (stricmp(lp, "test") == 0) { - if (checkend(sd)) - continue; - tp = chThdCreate(NORMALPRIO, 0, tarea, sizeof(tarea), - TestThread, arg); - if (chThdWait(tp)) - break; // Lost connection while executing the hello thread. - } - else { - PrintLineFDD(sd, lp); - PrintLineFDD(sd, " ?\r\n"); - } - } - } - return 0; -} - -static WorkingArea(s1area, 4096); -static Thread *s1; -EventListener s1tel; - -static void COM1Handler(eventid_t id) { - dflags_t flags; - - if (s1 && chThdTerminated(s1)) { - s1 = NULL; - cprint("Init: disconnection on COM1\n"); - } - flags = chFDDGetAndClearFlags(&COM1); - if ((flags & SD_CONNECTED) && (s1 == NULL)) { - cprint("Init: connection on COM1\n"); - s1 = chThdCreate(NORMALPRIO, P_SUSPENDED, s1area, sizeof(s1area), - ShellThread, &COM1); - chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0); - chThdResume(s1); - } - if ((flags & SD_DISCONNECTED) && (s1 != NULL)) - chIQReset(&COM1.sd_iqueue); -} - -static WorkingArea(s2area, 4096); -static Thread *s2; -EventListener s2tel; - -static void COM2Handler(eventid_t id) { - dflags_t flags; - - if (s2 && chThdTerminated(s2)) { - s2 = NULL; - cprint("Init: disconnection on COM2\n"); - } - flags = chFDDGetAndClearFlags(&COM2); - if ((flags & SD_CONNECTED) && (s2 == NULL)) { - cprint("Init: connection on COM2\n"); - s2 = chThdCreate(NORMALPRIO, P_SUSPENDED, s2area, sizeof(s1area), - ShellThread, &COM2); - chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1); - chThdResume(s2); - } - if ((flags & SD_DISCONNECTED) && (s2 != NULL)) - chIQReset(&COM2.sd_iqueue); -} - -static evhandler_t fhandlers[2] = { - COM1Handler, - COM2Handler -}; - -/*------------------------------------------------------------------------* - * Simulator main, start here your threads, examples inside. * - *------------------------------------------------------------------------*/ -int main(void) { - EventListener c1fel, c2fel; - - InitCore(); - - // Startup ChibiOS/RT. - chSysInit(); - - chThdCreate(NORMALPRIO + 2, 0, wdarea, sizeof(wdarea), WatchdogThread, NULL); - cdtp = chThdCreate(NORMALPRIO + 1, 0, cdarea, sizeof(cdarea), ConsoleThread, NULL); - - cprint("Console service started on COM1, COM2\n"); - cprint(" - Listening for connections on COM1\n"); - chFDDGetAndClearFlags(&COM1); - chEvtRegister(&COM1.sd_sevent, &c1fel, 0); - cprint(" - Listening for connections on COM2\n"); - chFDDGetAndClearFlags(&COM2); - chEvtRegister(&COM2.sd_sevent, &c2fel, 1); - while (!chThdShouldTerminate()) - chEvtWait(ALL_EVENTS, fhandlers); - chEvtUnregister(&COM2.sd_sevent, &c2fel); // Never invoked but this is an example... - chEvtUnregister(&COM1.sd_sevent, &c1fel); // Never invoked but this is an example... - return 0; -} diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c new file mode 100644 index 000000000..f3d276599 --- /dev/null +++ b/demos/Win32-MinGW/main.c @@ -0,0 +1,301 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include + +#include + +static uint32_t wdguard; +static WorkingArea(wdarea, 2048); + +static uint32_t cdguard; +static WorkingArea(cdarea, 2048); +static Thread *cdtp; + +static msg_t WatchdogThread(void *arg); +static msg_t ConsoleThread(void *arg); + +msg_t TestThread(void *p); + +void InitCore(void); +extern FullDuplexDriver COM1, COM2; + +#define cprint(msg) chMsgSend(cdtp, (msg_t)msg) + +/* + * Watchdog thread, it checks magic values located under the various stack + * areas. The system is halted if something is wrong. + */ +static msg_t WatchdogThread(void *arg) { + wdguard = 0xA51F2E3D; + cdguard = 0xA51F2E3D; + while (TRUE) { + + if ((wdguard != 0xA51F2E3D) || + (cdguard != 0xA51F2E3D)) { + printf("Halted by watchdog"); + chSysHalt(); + } + chThdSleep(50); + } + return 0; +} + +/* + * Console print server done using synchronous messages. This makes the access + * to the C printf() thread safe and the print operation atomic among threads. + * In this example the message is the zero termitated string itself. + */ +static msg_t ConsoleThread(void *arg) { + + while (!chThdShouldTerminate()) { + printf((char *)chMsgWait()); + chMsgRelease(RDY_OK); + } + return 0; +} + +static void PrintLineFDD(FullDuplexDriver *sd, char *msg) { + + while (*msg) + chFDDPut(sd, *msg++); +} + +static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) { + char *p = line; + + while (TRUE) { + short c = chIQGet(&sd->sd_iqueue); + if (c < 0) + return TRUE; + if (c == 4) { + PrintLineFDD(sd, "^D\r\n"); + return TRUE; + } + if (c == 8) { + if (p != line) { + chFDDPut(sd, (uint8_t)c); + chFDDPut(sd, 0x20); + chFDDPut(sd, (uint8_t)c); + p--; + } + continue; + } + if (c == '\r') { + PrintLineFDD(sd, "\r\n"); + *p = 0; + return FALSE; + } + if (c < 0x20) + continue; + if (p < line + size - 1) { + chFDDPut(sd, (uint8_t)c); + *p++ = (uint8_t)c; + } + } +} + +/* + * Example thread, not much to see here. It simulates the CTRL-C but there + * are no real signals involved. + */ +static msg_t HelloWorldThread(void *arg) { + int i; + short c; + FullDuplexDriver *sd = (FullDuplexDriver *)arg; + + for (i = 0; i < 100; i++) { + + PrintLineFDD(sd, "Hello World\r\n"); + c = chFDDGetTimeout(sd, 333); + switch (c) { + case -1: + continue; + case -2: + return 1; + case 3: + PrintLineFDD(sd, "^C\r\n"); + return 0; + default: + chThdSleep(333); + } + } + return 0; +} + +static bool_t checkend(FullDuplexDriver *sd) { + + char * lp = strtok(NULL, " \009"); /* It is not thread safe but this is a demo.*/ + if (lp) { + PrintLineFDD(sd, lp); + PrintLineFDD(sd, " ?\r\n"); + return TRUE; + } + return FALSE; +} + +/* + * Simple command shell thread, the argument is the serial line for the + * standard input and output. It recognizes few simple commands. + */ +static msg_t ShellThread(void *arg) { + FullDuplexDriver *sd = (FullDuplexDriver *)arg; + char *lp, line[64]; + Thread *tp; + WorkingArea(tarea, 2048); + + chIQReset(&sd->sd_iqueue); + chOQReset(&sd->sd_oqueue); + PrintLineFDD(sd, "ChibiOS/RT Command Shell\r\n\n"); + while (TRUE) { + PrintLineFDD(sd, "ch> "); + if (GetLineFDD(sd, line, sizeof(line))) { + PrintLineFDD(sd, "\nlogout"); + break; + } + lp = strtok(line, " \009"); // Note: not thread safe but it is just a demo. + if (lp) { + if ((stricmp(lp, "help") == 0) || + (stricmp(lp, "h") == 0) || + (stricmp(lp, "?") == 0)) { + if (checkend(sd)) + continue; + PrintLineFDD(sd, "Commands:\r\n"); + PrintLineFDD(sd, " help,h,? - This help\r\n"); + PrintLineFDD(sd, " exit - Logout from ChibiOS/RT\r\n"); + PrintLineFDD(sd, " time - Prints the system timer value\r\n"); + PrintLineFDD(sd, " hello - Runs the Hello World demo thread\r\n"); + PrintLineFDD(sd, " test - Runs the System Test thread\r\n"); + } + else if (stricmp(lp, "exit") == 0) { + if (checkend(sd)) + continue; + PrintLineFDD(sd, "\nlogout"); + break; + } + else if (stricmp(lp, "time") == 0) { + if (checkend(sd)) + continue; + sprintf(line, "Time: %d\r\n", chSysGetTime()); + PrintLineFDD(sd, line); + } + else if (stricmp(lp, "hello") == 0) { + if (checkend(sd)) + continue; + tp = chThdCreate(NORMALPRIO, 0, tarea, sizeof(tarea), + HelloWorldThread, sd); + if (chThdWait(tp)) + break; // Lost connection while executing the hello thread. + } + else if (stricmp(lp, "test") == 0) { + if (checkend(sd)) + continue; + tp = chThdCreate(NORMALPRIO, 0, tarea, sizeof(tarea), + TestThread, arg); + if (chThdWait(tp)) + break; // Lost connection while executing the hello thread. + } + else { + PrintLineFDD(sd, lp); + PrintLineFDD(sd, " ?\r\n"); + } + } + } + return 0; +} + +static WorkingArea(s1area, 4096); +static Thread *s1; +EventListener s1tel; + +static void COM1Handler(eventid_t id) { + dflags_t flags; + + if (s1 && chThdTerminated(s1)) { + s1 = NULL; + cprint("Init: disconnection on COM1\n"); + } + flags = chFDDGetAndClearFlags(&COM1); + if ((flags & SD_CONNECTED) && (s1 == NULL)) { + cprint("Init: connection on COM1\n"); + s1 = chThdCreate(NORMALPRIO, P_SUSPENDED, s1area, sizeof(s1area), + ShellThread, &COM1); + chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0); + chThdResume(s1); + } + if ((flags & SD_DISCONNECTED) && (s1 != NULL)) + chIQReset(&COM1.sd_iqueue); +} + +static WorkingArea(s2area, 4096); +static Thread *s2; +EventListener s2tel; + +static void COM2Handler(eventid_t id) { + dflags_t flags; + + if (s2 && chThdTerminated(s2)) { + s2 = NULL; + cprint("Init: disconnection on COM2\n"); + } + flags = chFDDGetAndClearFlags(&COM2); + if ((flags & SD_CONNECTED) && (s2 == NULL)) { + cprint("Init: connection on COM2\n"); + s2 = chThdCreate(NORMALPRIO, P_SUSPENDED, s2area, sizeof(s1area), + ShellThread, &COM2); + chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1); + chThdResume(s2); + } + if ((flags & SD_DISCONNECTED) && (s2 != NULL)) + chIQReset(&COM2.sd_iqueue); +} + +static evhandler_t fhandlers[2] = { + COM1Handler, + COM2Handler +}; + +/*------------------------------------------------------------------------* + * Simulator main, start here your threads, examples inside. * + *------------------------------------------------------------------------*/ +int main(void) { + EventListener c1fel, c2fel; + + InitCore(); + + // Startup ChibiOS/RT. + chSysInit(); + + chThdCreate(NORMALPRIO + 2, 0, wdarea, sizeof(wdarea), WatchdogThread, NULL); + cdtp = chThdCreate(NORMALPRIO + 1, 0, cdarea, sizeof(cdarea), ConsoleThread, NULL); + + cprint("Console service started on COM1, COM2\n"); + cprint(" - Listening for connections on COM1\n"); + chFDDGetAndClearFlags(&COM1); + chEvtRegister(&COM1.sd_sevent, &c1fel, 0); + cprint(" - Listening for connections on COM2\n"); + chFDDGetAndClearFlags(&COM2); + chEvtRegister(&COM2.sd_sevent, &c2fel, 1); + while (!chThdShouldTerminate()) + chEvtWait(ALL_EVENTS, fhandlers); + chEvtUnregister(&COM2.sd_sevent, &c2fel); // Never invoked but this is an example... + chEvtUnregister(&COM1.sd_sevent, &c1fel); // Never invoked but this is an example... + return 0; +} -- cgit v1.2.3 From 7f7cdc881e70aa0356eaa647647ab5d4cd2b5d27 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 13 Dec 2008 10:34:39 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@540 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.c | 1 + demos/Win32-MinGW/main.c | 34 ++++++++++++++++++---------------- 2 files changed, 19 insertions(+), 16 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 48842f186..9e9aba3fd 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -65,6 +65,7 @@ void InitCore(void) { InitSimCom1(); InitSimCom2(); + fflush(stdout); } /* diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index f3d276599..5de6ee938 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -23,10 +23,10 @@ #include static uint32_t wdguard; -static WorkingArea(wdarea, 2048); +static WORKING_AREA(wdarea, 2048); static uint32_t cdguard; -static WorkingArea(cdarea, 2048); +static WORKING_AREA(cdarea, 2048); static Thread *cdtp; static msg_t WatchdogThread(void *arg); @@ -51,6 +51,7 @@ static msg_t WatchdogThread(void *arg) { if ((wdguard != 0xA51F2E3D) || (cdguard != 0xA51F2E3D)) { printf("Halted by watchdog"); + fflush(stdout); chSysHalt(); } chThdSleep(50); @@ -67,6 +68,7 @@ static msg_t ConsoleThread(void *arg) { while (!chThdShouldTerminate()) { printf((char *)chMsgWait()); + fflush(stdout); chMsgRelease(RDY_OK); } return 0; @@ -159,7 +161,7 @@ static msg_t ShellThread(void *arg) { FullDuplexDriver *sd = (FullDuplexDriver *)arg; char *lp, line[64]; Thread *tp; - WorkingArea(tarea, 2048); + WORKING_AREA(tarea, 2048); chIQReset(&sd->sd_iqueue); chOQReset(&sd->sd_oqueue); @@ -199,16 +201,16 @@ static msg_t ShellThread(void *arg) { else if (stricmp(lp, "hello") == 0) { if (checkend(sd)) continue; - tp = chThdCreate(NORMALPRIO, 0, tarea, sizeof(tarea), - HelloWorldThread, sd); + tp = chThdCreateStatic(tarea, sizeof(tarea), + NORMALPRIO, HelloWorldThread, sd); if (chThdWait(tp)) break; // Lost connection while executing the hello thread. } else if (stricmp(lp, "test") == 0) { if (checkend(sd)) continue; - tp = chThdCreate(NORMALPRIO, 0, tarea, sizeof(tarea), - TestThread, arg); + tp = chThdCreateStatic(tarea, sizeof(tarea), + NORMALPRIO, TestThread, arg); if (chThdWait(tp)) break; // Lost connection while executing the hello thread. } @@ -221,7 +223,7 @@ static msg_t ShellThread(void *arg) { return 0; } -static WorkingArea(s1area, 4096); +static WORKING_AREA(s1area, 4096); static Thread *s1; EventListener s1tel; @@ -235,8 +237,8 @@ static void COM1Handler(eventid_t id) { flags = chFDDGetAndClearFlags(&COM1); if ((flags & SD_CONNECTED) && (s1 == NULL)) { cprint("Init: connection on COM1\n"); - s1 = chThdCreate(NORMALPRIO, P_SUSPENDED, s1area, sizeof(s1area), - ShellThread, &COM1); + s1 = chThdInit(s1area, sizeof(s1area), + NORMALPRIO, ShellThread, &COM1); chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0); chThdResume(s1); } @@ -244,7 +246,7 @@ static void COM1Handler(eventid_t id) { chIQReset(&COM1.sd_iqueue); } -static WorkingArea(s2area, 4096); +static WORKING_AREA(s2area, 4096); static Thread *s2; EventListener s2tel; @@ -258,8 +260,8 @@ static void COM2Handler(eventid_t id) { flags = chFDDGetAndClearFlags(&COM2); if ((flags & SD_CONNECTED) && (s2 == NULL)) { cprint("Init: connection on COM2\n"); - s2 = chThdCreate(NORMALPRIO, P_SUSPENDED, s2area, sizeof(s1area), - ShellThread, &COM2); + s2 = chThdInit(s2area, sizeof(s1area), + NORMALPRIO, ShellThread, &COM2); chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1); chThdResume(s2); } @@ -283,8 +285,8 @@ int main(void) { // Startup ChibiOS/RT. chSysInit(); - chThdCreate(NORMALPRIO + 2, 0, wdarea, sizeof(wdarea), WatchdogThread, NULL); - cdtp = chThdCreate(NORMALPRIO + 1, 0, cdarea, sizeof(cdarea), ConsoleThread, NULL); + chThdCreateStatic(wdarea, sizeof(wdarea), NORMALPRIO + 2, WatchdogThread, NULL); + cdtp = chThdCreateStatic(cdarea, sizeof(cdarea), NORMALPRIO + 1, ConsoleThread, NULL); cprint("Console service started on COM1, COM2\n"); cprint(" - Listening for connections on COM1\n"); @@ -294,7 +296,7 @@ int main(void) { chFDDGetAndClearFlags(&COM2); chEvtRegister(&COM2.sd_sevent, &c2fel, 1); while (!chThdShouldTerminate()) - chEvtWait(ALL_EVENTS, fhandlers); + chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS)); chEvtUnregister(&COM2.sd_sevent, &c2fel); // Never invoked but this is an example... chEvtUnregister(&COM1.sd_sevent, &c1fel); // Never invoked but this is an example... return 0; -- cgit v1.2.3 From dd39b808aceeb2cc726c9b90fe9ca3116bf0ebd7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 27 Dec 2008 10:31:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@544 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/readme.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/readme.txt b/demos/Win32-MinGW/readme.txt index 283ee42b2..047425ffe 100644 --- a/demos/Win32-MinGW/readme.txt +++ b/demos/Win32-MinGW/readme.txt @@ -20,3 +20,14 @@ See demo.c for details. ** Build Procedure ** The demo was built using the MinGW toolchain. + +** Connect to the demo ** + +In order to connect to the demo a telnet client is required. A good choice +is PuTTY: + +http://www.putty.org/ + +Host Name: 127.0.0.1 +Port: 29001 and/or 29002 +Connection Type: Raw -- cgit v1.2.3 From 3e9765e2069a9faedff2721a1abf46607cf1189d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 28 Dec 2008 10:07:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@545 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 07ff4d0d5..3187998cc 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -84,19 +84,11 @@ * @note requires \p CH_USE_MESSAGES.*/ #define CH_USE_MESSAGES_EVENT -/** Configuration option: If enabled then the threads have an option to serve - * messages by priority instead of FIFO order. +/** Configuration option: If enabled then the threads serve messages by + * priority instead of FIFO order. * @note requires \p CH_USE_MESSAGES.*/ //#define CH_USE_MESSAGES_PRIORITY -/** Configuration option: if specified then the - * \p chThdGetExitEventSource() function is included in the kernel. - * @note requires \p CH_USE_EVENTS. - * @deprecated \p THREAD_EXT_EXIT should be used, this functionality will be - * removed in version 1.0.0. - */ -#define CH_USE_EXIT_EVENT - /** Configuration option: if specified then the I/O queues APIs are included * in the kernel.*/ #define CH_USE_QUEUES -- cgit v1.2.3 From ca4419762eaab74d52e07e02defbaac42570fea3 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 28 Dec 2008 11:17:09 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@546 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 2c916f536..9c7f9e8c1 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -77,17 +77,14 @@ typedef struct { #define INT_REQUIRED_STACK 0 #define STACK_ALIGN(n) ((((n) - 1) | sizeof(stkalign_t)) + 1) -#define StackAlign(n) STACK_ALIGN(n) #define THD_WA_SIZE(n) StackAlign(sizeof(Thread) + \ sizeof(void *) * 2 + \ sizeof(struct intctx) + \ (n) + \ INT_REQUIRED_STACK) -#define UserStackSize(n) THD_WA_SIZE(n) #define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)]; -#define WorkingArea(s, n) WORKING_AREA(s, n) /* * Stack size for the system idle thread. -- cgit v1.2.3 From 5300fced15f40774f8fcf75904373541ea351efa Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 29 Dec 2008 08:58:17 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@553 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 6 ++++++ demos/Win32-MinGW/chcore.h | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 3187998cc..5b487dbe7 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -172,20 +172,26 @@ #define THREAD_EXT_FIELDS \ struct { \ /* Add thread custom fields here.*/ \ + /* The thread termination \p EventSource.*/ \ + EventSource p_exitesource; \ }; /** User initialization code added to the \p chThdCreate() API. * @note It is invoked from within \p chThdInit(). */ #define THREAD_EXT_INIT(tp) { \ /* Add thread initialization code here.*/ \ + chEvtInit(&tp->p_exitesource); \ } /** User finalization code added to the \p chThdExit() API. * @note It is inserted into lock zone. */ #define THREAD_EXT_EXIT(tp) { \ /* Add thread finalization code here.*/ \ + chEvtBroadcastI(&currp->p_exitesource); \ } +#define chThdGetExitEventSource(tp) (&(tp)->p_exitesource) + #endif /* _CHCONF_H_ */ /** @} */ diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 9c7f9e8c1..d1f209a68 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -78,11 +78,11 @@ typedef struct { #define STACK_ALIGN(n) ((((n) - 1) | sizeof(stkalign_t)) + 1) -#define THD_WA_SIZE(n) StackAlign(sizeof(Thread) + \ - sizeof(void *) * 2 + \ - sizeof(struct intctx) + \ - (n) + \ - INT_REQUIRED_STACK) +#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \ + sizeof(void *) * 2 + \ + sizeof(struct intctx) + \ + (n) + \ + INT_REQUIRED_STACK) #define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)]; -- cgit v1.2.3 From b73680a97d5c312cb6175614be7d562a52a3812c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 9 Jan 2009 16:18:56 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@597 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.c | 125 ++++++++++++++++++---------------------- demos/Win32-MinGW/chcore.h | 141 ++++++++++++++++++++++++++++++++++++--------- 2 files changed, 168 insertions(+), 98 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 9e9aba3fd..1d1a134b7 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -17,91 +17,76 @@ along with this program. If not, see . */ -/* - * Core file for MingGW32 demo project. +/** + * @addtogroup WIN32SIM_CORE + * @{ */ -#include -#include - -#undef CDECL - #include -static LARGE_INTEGER nextcnt; -static LARGE_INTEGER slice; - -void InitSimCom1(void); -void InitSimCom2(void); -BOOL Com1ConnInterruptSimCom(void); -BOOL Com2ConnInterruptSimCom(void); -BOOL Com1InInterruptSimCom(void); -BOOL Com2InInterruptSimCom(void); -BOOL Com1OutInterruptSimCom(void); -BOOL Com2OutInterruptSimCom(void); - /* - * Simulated HW initialization. + * This file is a template of the system driver functions provided by a port. + * Some of the following functions may be implemented as macros in chcore.h if + * the implementer decides that there is an advantage in doing so, as example + * because performance concerns. */ -void InitCore(void) { - WSADATA wsaData; - - // Initialization. - if (WSAStartup(2, &wsaData) != 0) { - printf("Unable to locate a winsock DLL\n"); - exit(1); - } - printf("Win32 ChibiOS/RT simulator\n\n"); - printf("Thread structure %d bytes\n", sizeof(Thread)); - if (!QueryPerformanceFrequency(&slice)) { - printf("QueryPerformanceFrequency() error"); - exit(1); - } - printf("Core Frequency %u Hz\n", (int)slice.LowPart); - slice.QuadPart /= CH_FREQUENCY; - QueryPerformanceCounter(&nextcnt); - nextcnt.QuadPart += slice.QuadPart; - - InitSimCom1(); - InitSimCom2(); - fflush(stdout); +/** + * Prints a message on the system console. + * @param msg pointer to the message + * @note The function is declared as a weak symbol, it is possible to redefine + * it in your application code. + */ +__attribute__((weak)) +void sys_puts(char *msg) { } -/* - * Interrupt simulation. +/** + * Performs a context switch between two threads. + * @param otp the thread to be switched out + * @param ntp the thread to be switched in + * @note The function is declared as a weak symbol, it is possible to redefine + * it in your application code. */ -void ChkIntSources(void) { - LARGE_INTEGER n; +__attribute__((naked, weak)) +void sys_switch(Thread *otp, Thread *ntp) { + register struct intctx *esp asm("esp"); + + asm volatile ("push %ebp \n\t" \ + "push %esi \n\t" \ + "push %edi \n\t" \ + "push %ebx"); + otp->p_ctx.esp = esp; + esp = ntp->p_ctx.esp; + asm volatile ("pop %ebx \n\t" \ + "pop %edi \n\t" \ + "pop %esi \n\t" \ + "pop %ebp \n\t" \ + "ret" : : "r" (esp)); +} - if (Com1InInterruptSimCom() || Com2InInterruptSimCom() || - Com1OutInterruptSimCom() || Com2OutInterruptSimCom() || - Com1ConnInterruptSimCom() || Com2ConnInterruptSimCom()) { - if (chSchRescRequiredI()) - chSchDoRescheduleI(); - return; - } +/** + * Halts the system. In this implementation it just exits the simulation. + * @note The function is declared as a weak symbol, it is possible to redefine + * it in your application code. + */ +__attribute__((weak)) +void sys_halt(void) { - // Interrupt Timer simulation (10ms interval). - QueryPerformanceCounter(&n); - if (n.QuadPart > nextcnt.QuadPart) { - nextcnt.QuadPart += slice.QuadPart; - chSysTimerHandlerI(); - if (chSchRescRequiredI()) - chSchDoRescheduleI(); - } + exit(2); } -msg_t _idle(void *p) { - - while (TRUE) { +/** + * Threads return point, it just invokes @p chThdExit(). + * @note The function is declared as a weak symbol, it is possible to redefine + * it in your application code. + */ +__attribute__((naked, weak)) +void threadexit(void) { - ChkIntSources(); - Sleep(0); - } + asm volatile ("push %eax \n\t" \ + "call _chThdExit"); } -__attribute__((fastcall)) void chSysHalt(void) { - - exit(2); } +/** @} */ diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index d1f209a68..6c9bf1f7e 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -17,27 +17,40 @@ along with this program. If not, see . */ -/* - * Core file for MingGW32 demo project. +/** + * @addtogroup WIN32SIM_CORE + * @{ */ #ifndef _CHCORE_H_ #define _CHCORE_H_ -/* - * Unique macro for the implemented architecture. +/** + * Macro defining the a simulated architecture into Win32. */ #define CH_ARCHITECTURE_WIN32SIM -/* - * Base type for stack alignment. +/** + * 32 bit stack alignment. */ typedef uint32_t stkalign_t; +/** + * Generic x86 register. + */ typedef void *regx86; -/* - * Stack saved context. +/** + * Interrupt saved context. + * This structure represents the stack frame saved during a preemption-capable + * interrupt handler. + */ +struct extctx { +}; + +/** + * System saved context. + * @note In this demo the floating point registers are not saved. */ struct intctx { regx86 ebx; @@ -47,17 +60,26 @@ struct intctx { regx86 eip; }; +/** + * Platform dependent part of the @p Thread structure. + * This structure usually contains just the saved stack pointer defined as a + * pointer to a @p intctx structure. + */ typedef struct { struct intctx *esp; } Context; #define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a) -#define SETUP_CONTEXT(workspace, wsize, pf, arg) \ -{ \ +/** + * Platform dependent part of the @p chThdInit() API. + * This code usually setup the context switching frame represented by a + * @p intctx structure. + */ +#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \ uint8_t *esp = (uint8_t *)workspace + wsize; \ APUSH(esp, arg); \ - APUSH(esp, threadstart); \ + APUSH(esp, threadexit); \ esp -= sizeof(struct intctx); \ ((struct intctx *)esp)->eip = pf; \ ((struct intctx *)esp)->ebx = 0; \ @@ -67,33 +89,96 @@ typedef struct { tp->p_ctx.esp = (struct intctx *)esp; \ } -#define chSysLock() -#define chSysUnlock() -#define chSysEnable() -#define chSysPuts(msg) {} -#define chSysIRQEnterI() -#define chSysIRQExitI() - -#define INT_REQUIRED_STACK 0 +/** + * Stack size for the system idle thread. + */ +#ifndef IDLE_THREAD_STACK_SIZE +#define IDLE_THREAD_STACK_SIZE 256 +#endif + +/** + * Per-thread stack overhead for interrupts servicing, it is used in the + * calculation of the correct working area size. + * It requires stack space because the simulated "interrupt handlers" invoke + * Win32 APIs inside so it better have a lot of space. + */ +#ifndef INT_REQUIRED_STACK +#define INT_REQUIRED_STACK 16384 +#endif +/** + * Enforces a correct alignment for a stack area size value. + */ #define STACK_ALIGN(n) ((((n) - 1) | sizeof(stkalign_t)) + 1) + /** + * Computes the thread working area global size. + */ #define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \ sizeof(void *) * 2 + \ sizeof(struct intctx) + \ - (n) + \ - INT_REQUIRED_STACK) + sizeof(struct extctx) + \ + (n) + (INT_REQUIRED_STACK)) +/** + * Macro used to allocate a thread working area aligned as both position and + * size. + */ #define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)]; -/* - * Stack size for the system idle thread. +/** + * IRQ prologue code, inserted at the start of all IRQ handlers enabled to + * invoke system APIs. + */ +#define SYS_IRQ_PROLOGUE() + +/** + * IRQ epilogue code, inserted at the end of all IRQ handlers enabled to + * invoke system APIs. + */ +#define SYS_IRQ_EPILOGUE() + +/** + * Does nothing in this simulator. + */ +#define sys_disable() + +/** + * Does nothing in this simulator. + */ +#define sys_enable() + +/** + * Does nothing in this simulator. + */ +#define sys_disable_from_isr() + +/** + * Does nothing in this simulator. + */ +#define sys_enable_from_isr() + +/** + * Does nothing in this simulator. */ -#define IDLE_THREAD_STACK_SIZE 16384 +#define sys_wait_for_interrupt() -msg_t _idle(void *p); -__attribute__((fastcall)) void chSysHalt(void); -__attribute__((fastcall)) void chSysSwitchI(Thread *otp, Thread *ntp); -__attribute__((fastcall)) void threadstart(void); +/** + * IRQ handler function modifier. + */ +#define SYS_IRQ_HANDLER + +#ifdef __cplusplus +extern "C" { +#endif + __attribute__((fastcall)) void sys_puts(char *msg); + __attribute__((fastcall)) void sys_switch(Thread *otp, Thread *ntp); + __attribute__((fastcall)) void sys_halt(void); + void threadexit(void); +#ifdef __cplusplus +} +#endif #endif /* _CHCORE_H_ */ + +/** @} */ -- cgit v1.2.3 From 49fe48fd7a816f46eb50a52342d14173ffbd0c1e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Jan 2009 09:35:58 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@601 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 2 +- demos/Win32-MinGW/chcore.c | 91 +++++++++++++++++++++++++++++++++++---------- demos/Win32-MinGW/chcore.h | 2 +- demos/Win32-MinGW/chcore2.s | 43 --------------------- 4 files changed, 73 insertions(+), 65 deletions(-) delete mode 100644 demos/Win32-MinGW/chcore2.s (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index 46cb9cad0..bda1426cb 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -65,7 +65,7 @@ SRC = chcore.c main.c ../../ports/win32/simcom.c \ ${TESTSRC} # List ASM source files here -ASRC = chcore2.s +ASRC = # List all user directories here UINCDIR = ../../src/include diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 1d1a134b7..1dc05569c 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -17,6 +17,11 @@ along with this program. If not, see . */ +#include +#include + +#undef CDECL + /** * @addtogroup WIN32SIM_CORE * @{ @@ -24,20 +29,75 @@ #include +static LARGE_INTEGER nextcnt; +static LARGE_INTEGER slice; + +void InitSimCom1(void); +void InitSimCom2(void); +BOOL Com1ConnInterruptSimCom(void); +BOOL Com2ConnInterruptSimCom(void); +BOOL Com1InInterruptSimCom(void); +BOOL Com2InInterruptSimCom(void); +BOOL Com1OutInterruptSimCom(void); +BOOL Com2OutInterruptSimCom(void); + /* - * This file is a template of the system driver functions provided by a port. - * Some of the following functions may be implemented as macros in chcore.h if - * the implementer decides that there is an advantage in doing so, as example - * because performance concerns. + * Simulated HW initialization. */ +void InitCore(void) { + WSADATA wsaData; + + // Initialization. + if (WSAStartup(2, &wsaData) != 0) { + printf("Unable to locate a winsock DLL\n"); + exit(1); + } + + printf("Win32 ChibiOS/RT simulator\n\n"); + printf("Thread structure %d bytes\n", sizeof(Thread)); + if (!QueryPerformanceFrequency(&slice)) { + printf("QueryPerformanceFrequency() error"); + exit(1); + } + printf("Core Frequency %u Hz\n", (int)slice.LowPart); + slice.QuadPart /= CH_FREQUENCY; + QueryPerformanceCounter(&nextcnt); + nextcnt.QuadPart += slice.QuadPart; + + InitSimCom1(); + InitSimCom2(); + fflush(stdout); +} + +/* + * Interrupt simulation. + */ +void ChkIntSources(void) { + LARGE_INTEGER n; + + if (Com1InInterruptSimCom() || Com2InInterruptSimCom() || + Com1OutInterruptSimCom() || Com2OutInterruptSimCom() || + Com1ConnInterruptSimCom() || Com2ConnInterruptSimCom()) { + if (chSchRescRequiredI()) + chSchDoRescheduleI(); + return; + } + + // Interrupt Timer simulation (10ms interval). + QueryPerformanceCounter(&n); + if (n.QuadPart > nextcnt.QuadPart) { + nextcnt.QuadPart += slice.QuadPart; + chSysTimerHandlerI(); + if (chSchRescRequiredI()) + chSchDoRescheduleI(); + } +} /** * Prints a message on the system console. * @param msg pointer to the message - * @note The function is declared as a weak symbol, it is possible to redefine - * it in your application code. */ -__attribute__((weak)) +__attribute__((fastcall)) void sys_puts(char *msg) { } @@ -45,12 +105,10 @@ void sys_puts(char *msg) { * Performs a context switch between two threads. * @param otp the thread to be switched out * @param ntp the thread to be switched in - * @note The function is declared as a weak symbol, it is possible to redefine - * it in your application code. */ -__attribute__((naked, weak)) +__attribute__((fastcall)) void sys_switch(Thread *otp, Thread *ntp) { - register struct intctx *esp asm("esp"); + register struct intctx volatile *esp asm("esp"); asm volatile ("push %ebp \n\t" \ "push %esi \n\t" \ @@ -61,16 +119,13 @@ void sys_switch(Thread *otp, Thread *ntp) { asm volatile ("pop %ebx \n\t" \ "pop %edi \n\t" \ "pop %esi \n\t" \ - "pop %ebp \n\t" \ - "ret" : : "r" (esp)); + "pop %ebp"); } /** * Halts the system. In this implementation it just exits the simulation. - * @note The function is declared as a weak symbol, it is possible to redefine - * it in your application code. */ -__attribute__((weak)) +__attribute__((fastcall)) void sys_halt(void) { exit(2); @@ -78,15 +133,11 @@ void sys_halt(void) { /** * Threads return point, it just invokes @p chThdExit(). - * @note The function is declared as a weak symbol, it is possible to redefine - * it in your application code. */ -__attribute__((naked, weak)) void threadexit(void) { asm volatile ("push %eax \n\t" \ "call _chThdExit"); } -} /** @} */ diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 6c9bf1f7e..2a9fe7de8 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -66,7 +66,7 @@ struct intctx { * pointer to a @p intctx structure. */ typedef struct { - struct intctx *esp; + struct intctx volatile *esp; } Context; #define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a) diff --git a/demos/Win32-MinGW/chcore2.s b/demos/Win32-MinGW/chcore2.s deleted file mode 100644 index 9334fbfdc..000000000 --- a/demos/Win32-MinGW/chcore2.s +++ /dev/null @@ -1,43 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -.text - -.p2align 4,,15 -.globl @chSysSwitchI@8 -@chSysSwitchI@8: - # Switch out - push %ebp - push %esi - push %edi - push %ebx - movl %esp,16(%ecx) - # Switch in - movl 16(%edx),%esp - pop %ebx - pop %edi - pop %esi - pop %ebp - ret - -.p2align 4,,15 -.globl @threadstart@0 -@threadstart@0: - push %eax - call _chThdExit -- cgit v1.2.3 From 791d101af5ce38335694b882149449c83f650fda Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Jan 2009 09:42:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@602 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 2 +- demos/Win32-MinGW/chcore.h | 7 +++++-- demos/Win32-MinGW/main.c | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 5b487dbe7..c00b4873f 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -120,7 +120,7 @@ * provide the \p __heap_base__ and \p __heap_end__ symbols. * @note requires \p CH_USE_HEAP. */ -#define CH_HEAP_SIZE 16384 +#define CH_HEAP_SIZE 0x20000 /** Configuration option: enforces the use of the C-runtime \p malloc() and * \p free() functions as backend for the system heap allocator.*/ diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 2a9fe7de8..5f9f35716 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -159,9 +159,10 @@ typedef struct { #define sys_enable_from_isr() /** - * Does nothing in this simulator. + * In the simulator this does a polling pass on the simulated interrupt + * sources. */ -#define sys_wait_for_interrupt() +#define sys_wait_for_interrupt() ChkIntSources() /** * IRQ handler function modifier. @@ -174,6 +175,8 @@ extern "C" { __attribute__((fastcall)) void sys_puts(char *msg); __attribute__((fastcall)) void sys_switch(Thread *otp, Thread *ntp); __attribute__((fastcall)) void sys_halt(void); + void InitCore(void); + void ChkIntSources(void); void threadexit(void); #ifdef __cplusplus } diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 5de6ee938..eaf2504dd 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -34,7 +34,6 @@ static msg_t ConsoleThread(void *arg); msg_t TestThread(void *p); -void InitCore(void); extern FullDuplexDriver COM1, COM2; #define cprint(msg) chMsgSend(cdtp, (msg_t)msg) -- cgit v1.2.3 From e2b6b440e12562804f161d8db677554bbd666bd1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Jan 2009 16:21:27 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@612 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index c00b4873f..07d741e99 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -30,6 +30,15 @@ * that this is not related to the compiler optimization options.*/ #define CH_OPTIMIZE_SPEED +/** Configuration option: If enabled then the used of nested @p chSysLock() / + * @p chSysUnlock() operations is allowed.
+ * For performance and code size reasons the recommended setting is leave + * this option disabled.
+ * You can use this option if you need to merge ChibiOS/RT with external + * libraries that require nested lock/unlock operations. + */ +//#define CH_USE_NESTED_LOCKS + /** Configuration option: if specified then the kernel performs the round * robin scheduling algorithm on threads of equal priority. */ #define CH_USE_ROUNDROBIN -- cgit v1.2.3 From 8b17d5526d2745c409aac95a3e1da3102959626c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Jan 2009 16:25:57 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@613 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 5f9f35716..70efa7edb 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -138,6 +138,11 @@ typedef struct { */ #define SYS_IRQ_EPILOGUE() +/** + * IRQ handler function modifier. + */ +#define SYS_IRQ_HANDLER + /** * Does nothing in this simulator. */ @@ -159,15 +164,15 @@ typedef struct { #define sys_enable_from_isr() /** - * In the simulator this does a polling pass on the simulated interrupt - * sources. + * Does nothing in this simulator. */ -#define sys_wait_for_interrupt() ChkIntSources() +#define sys_disable_all() /** - * IRQ handler function modifier. + * In the simulator this does a polling pass on the simulated interrupt + * sources. */ -#define SYS_IRQ_HANDLER +#define sys_wait_for_interrupt() ChkIntSources() #ifdef __cplusplus extern "C" { -- cgit v1.2.3 From a9b4e8fc7225e8e2f26554b388f9d069d8f05b5e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 16 Jan 2009 15:41:08 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@621 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.h | 21 ++++++++++++++++++--- demos/Win32-MinGW/main.c | 2 -- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 70efa7edb..40555df63 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -143,6 +143,16 @@ typedef struct { */ #define SYS_IRQ_HANDLER +/** + * Simulator initialization. + */ +#define sys_init() InitCore() + +/** + * Does nothing in this simulator. + */ +#define sys_disable_all() + /** * Does nothing in this simulator. */ @@ -156,17 +166,22 @@ typedef struct { /** * Does nothing in this simulator. */ -#define sys_disable_from_isr() +#define sys_lock() /** * Does nothing in this simulator. */ -#define sys_enable_from_isr() +#define sys_unlock() /** * Does nothing in this simulator. */ -#define sys_disable_all() +#define sys_lock_from_isr() + +/** + * Does nothing in this simulator. + */ +#define sys_unlock_from_isr() /** * In the simulator this does a polling pass on the simulated interrupt diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index eaf2504dd..a72d7b4da 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -279,8 +279,6 @@ static evhandler_t fhandlers[2] = { int main(void) { EventListener c1fel, c2fel; - InitCore(); - // Startup ChibiOS/RT. chSysInit(); -- cgit v1.2.3 From 4d2e568b56607bb166c4d2dd004b1c9970c2879f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 20 Jan 2009 20:11:02 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@650 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 2 +- demos/Win32-MinGW/chcore.c | 6 +++--- demos/Win32-MinGW/chcore.h | 36 ++++++++++++++++++------------------ 3 files changed, 22 insertions(+), 22 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index bda1426cb..841557827 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -77,7 +77,7 @@ ULIBDIR = ULIBS = # Define optimisation level here -OPT = -ggdb -Os -fomit-frame-pointer +OPT = -ggdb -O2 -fomit-frame-pointer # # End of user defines diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 1dc05569c..446508e3c 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -98,7 +98,7 @@ void ChkIntSources(void) { * @param msg pointer to the message */ __attribute__((fastcall)) -void sys_puts(char *msg) { +void port_puts(char *msg) { } /** @@ -107,7 +107,7 @@ void sys_puts(char *msg) { * @param ntp the thread to be switched in */ __attribute__((fastcall)) -void sys_switch(Thread *otp, Thread *ntp) { +void port_switch(Thread *otp, Thread *ntp) { register struct intctx volatile *esp asm("esp"); asm volatile ("push %ebp \n\t" \ @@ -126,7 +126,7 @@ void sys_switch(Thread *otp, Thread *ntp) { * Halts the system. In this implementation it just exits the simulation. */ __attribute__((fastcall)) -void sys_halt(void) { +void port_halt(void) { exit(2); } diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 40555df63..029de3566 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -65,9 +65,9 @@ struct intctx { * This structure usually contains just the saved stack pointer defined as a * pointer to a @p intctx structure. */ -typedef struct { +struct context { struct intctx volatile *esp; -} Context; +}; #define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a) @@ -130,71 +130,71 @@ typedef struct { * IRQ prologue code, inserted at the start of all IRQ handlers enabled to * invoke system APIs. */ -#define SYS_IRQ_PROLOGUE() +#define PORT_IRQ_PROLOGUE() /** * IRQ epilogue code, inserted at the end of all IRQ handlers enabled to * invoke system APIs. */ -#define SYS_IRQ_EPILOGUE() +#define PORT_IRQ_EPILOGUE() /** - * IRQ handler function modifier. + * IRQ handler function declaration. */ -#define SYS_IRQ_HANDLER +#define PORT_IRQ_HANDLER(id) void id(void) /** * Simulator initialization. */ -#define sys_init() InitCore() +#define port_init() InitCore() /** * Does nothing in this simulator. */ -#define sys_disable_all() +#define port_lock() /** * Does nothing in this simulator. */ -#define sys_disable() +#define port_unlock() /** * Does nothing in this simulator. */ -#define sys_enable() +#define port_lock_from_isr() /** * Does nothing in this simulator. */ -#define sys_lock() +#define port_unlock_from_isr() /** * Does nothing in this simulator. */ -#define sys_unlock() +#define port_disable() /** * Does nothing in this simulator. */ -#define sys_lock_from_isr() +#define port_suspend() /** * Does nothing in this simulator. */ -#define sys_unlock_from_isr() +#define port_enable() /** * In the simulator this does a polling pass on the simulated interrupt * sources. */ -#define sys_wait_for_interrupt() ChkIntSources() +#define port_wait_for_interrupt() ChkIntSources() #ifdef __cplusplus extern "C" { #endif - __attribute__((fastcall)) void sys_puts(char *msg); - __attribute__((fastcall)) void sys_switch(Thread *otp, Thread *ntp); - __attribute__((fastcall)) void sys_halt(void); + __attribute__((fastcall)) void port_puts(char *msg); + __attribute__((fastcall)) void port_switch(Thread *otp, Thread *ntp); + __attribute__((fastcall)) void port_halt(void); void InitCore(void); void ChkIntSources(void); void threadexit(void); -- cgit v1.2.3 From 1170025270003c5cbbc84bf07de5c83253318b28 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 20 Jan 2009 20:43:09 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@651 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index a72d7b4da..ae06ff841 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -127,9 +127,9 @@ static msg_t HelloWorldThread(void *arg) { PrintLineFDD(sd, "Hello World\r\n"); c = chFDDGetTimeout(sd, 333); switch (c) { - case -1: + case Q_TIMEOUT: continue; - case -2: + case Q_RESET: return 1; case 3: PrintLineFDD(sd, "^C\r\n"); -- cgit v1.2.3 From 2debe881379d58a4fa92a984471a02e7f5de07c4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 20 Jan 2009 21:23:48 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@652 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index ae06ff841..1d80b9d76 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -122,7 +122,7 @@ static msg_t HelloWorldThread(void *arg) { short c; FullDuplexDriver *sd = (FullDuplexDriver *)arg; - for (i = 0; i < 100; i++) { + for (i = 0; i < 10; i++) { PrintLineFDD(sd, "Hello World\r\n"); c = chFDDGetTimeout(sd, 333); -- cgit v1.2.3 From 3b31842a05737a1ff36d53b0141b05e60f1bdc0a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 1 Feb 2009 20:07:14 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@710 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chtypes.h | 1 - 1 file changed, 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h index 6f8662bd9..354da269e 100644 --- a/demos/Win32-MinGW/chtypes.h +++ b/demos/Win32-MinGW/chtypes.h @@ -32,7 +32,6 @@ typedef int8_t bool_t; typedef uint8_t tmode_t; typedef uint8_t tstate_t; -typedef uint16_t tid_t; typedef uint32_t tprio_t; typedef int32_t msg_t; typedef int32_t eventid_t; -- cgit v1.2.3 From ec4178dd0ff7587b79a8c525aa88d467642ce629 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 2 Feb 2009 12:48:17 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@712 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 07d741e99..a10e43b7d 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -51,6 +51,11 @@ * in the kernel.*/ #define CH_USE_SEMAPHORES +/** Configuration option: If enabled then the threads are enqueued on semaphores + * by priority rather than FIFO order. + * @note requires @p CH_USE_SEMAPHORES.*/ +//#define CH_USE_SEMAPHORES_PRIORITY + /** Configuration option: if specified then the Semaphores atomic Signal+Wait * APIs are included in the kernel.*/ #define CH_USE_SEMSW -- cgit v1.2.3 From 6cfef53ca56e835c9fcd28206971bf15e17fb31b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 7 Feb 2009 14:59:26 +0000 Subject: Configuration system improvements. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@739 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 459 +++++++++++++++++++++++++++++++-------------- 1 file changed, 313 insertions(+), 146 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index a10e43b7d..ac7131871 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -18,6 +18,8 @@ */ /** + * @file src/templates/chconf.h + * @brief Configuration file template. * @addtogroup Config * @{ */ @@ -25,184 +27,349 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ -/** Configuration option: if specified then time efficient rather than space - * efficient code is used when two possible implementations exist, note - * that this is not related to the compiler optimization options.*/ -#define CH_OPTIMIZE_SPEED - -/** Configuration option: If enabled then the used of nested @p chSysLock() / - * @p chSysUnlock() operations is allowed.
- * For performance and code size reasons the recommended setting is leave - * this option disabled.
- * You can use this option if you need to merge ChibiOS/RT with external - * libraries that require nested lock/unlock operations. - */ -//#define CH_USE_NESTED_LOCKS - -/** Configuration option: if specified then the kernel performs the round - * robin scheduling algorithm on threads of equal priority. */ -#define CH_USE_ROUNDROBIN - -/** Configuration option: if specified then the \p chThdWait() function - * is included in the kernel.*/ -#define CH_USE_WAITEXIT - -/** Configuration option: if specified then the Semaphores APIs are included - * in the kernel.*/ -#define CH_USE_SEMAPHORES - -/** Configuration option: If enabled then the threads are enqueued on semaphores - * by priority rather than FIFO order. - * @note requires @p CH_USE_SEMAPHORES.*/ -//#define CH_USE_SEMAPHORES_PRIORITY - -/** Configuration option: if specified then the Semaphores atomic Signal+Wait - * APIs are included in the kernel.*/ -#define CH_USE_SEMSW - -/** Configuration option: if specified then the Semaphores with timeout APIs - * are included in the kernel. - * @note requires \p CH_USE_SEMAPHORES.*/ -#define CH_USE_SEMAPHORES_TIMEOUT - -/** Configuration option: if specified then the Mutexes APIs are included in - * the kernel.*/ -#define CH_USE_MUTEXES - -/** Configuration option: if specified then the Conditional Variables APIs are - * included in the kernel. - * @note requires \p CH_USE_MUTEXES.*/ -#define CH_USE_CONDVARS - -/** Configuration option: if specified then the Conditional Variables APIs are - * included in the kernel. - * @note requires \p CH_USE_CONDVARS and \p CH_USE_MUTEXES.*/ -#define CH_USE_CONDVARS_TIMEOUT - -/** Configuration option: if specified then the Events APIs are included in - * the kernel.*/ -#define CH_USE_EVENTS - -/** Configuration option: if specified then the \p chEvtWaitXXXTimeout() - * functions are included in the kernel. - * @note requires \p CH_USE_EVENTS. - */ -#define CH_USE_EVENTS_TIMEOUT - -/** Configuration option: if specified then the Synchronous Messages APIs are - * included in the kernel.*/ -#define CH_USE_MESSAGES - -/** Configuration option: if specified then the \p chMsgSendWithEvent() - * function is included in the kernel. - * @note requires \p CH_USE_MESSAGES.*/ -#define CH_USE_MESSAGES_EVENT - -/** Configuration option: If enabled then the threads serve messages by - * priority instead of FIFO order. - * @note requires \p CH_USE_MESSAGES.*/ -//#define CH_USE_MESSAGES_PRIORITY - -/** Configuration option: if specified then the I/O queues APIs are included - * in the kernel.*/ -#define CH_USE_QUEUES - -/** Configuration option: if specified then the halfduplex queue APIs are - * included in the kernel.*/ -#define CH_USE_QUEUES_HALFDUPLEX - -/** Configuration option: if specified then the I/O queues with timeout - * APIs are included in the kernel. - * @note requires \p CH_USE_SEMAPHORES_TIMEOUT.*/ -#define CH_USE_QUEUES_TIMEOUT - -/** Configuration option: if specified then the full duplex serial driver APIs - * are included in the kernel.*/ -#define CH_USE_SERIAL_FULLDUPLEX - -/** Configuration option: if specified then the half duplex serial driver APIs - * are included in the kernel.*/ -#define CH_USE_SERIAL_HALFDUPLEX - -/** Configuration option: if specified then the memory heap allocator APIs - * are included in the kernel.*/ -#define CH_USE_HEAP - -/** Configuration option: Number of RAM bytes to use as system heap. If set to - * zero then the whole available RAM is used as system heap. +/** + * If specified then time efficient rather than space efficient code is used + * when two possible implementations exist. + * @note This is not related to the compiler optimization options. + * @note The default is @p TRUE. + */ +#ifndef CH_OPTIMIZE_SPEED +#define CH_OPTIMIZE_SPEED TRUE +#endif + +/** + * If enabled then the use of nested @p chSysLock() / @p chSysUnlock() + * operations is allowed.
+ * For performance and code size reasons the recommended setting is to leave + * this option disabled.
+ * You can use this option if you need to merge ChibiOS/RT with external + * libraries that require nested lock/unlock operations. + * @note The default is @p FALSE. + */ +#ifndef CH_USE_NESTED_LOCKS +#define CH_USE_NESTED_LOCKS FALSE +#endif + +/** + * If specified then the kernel performs the round robin scheduling algorithm + * on threads of equal priority. + * @note The default is @p TRUE. + */ +#ifndef CH_USE_ROUNDROBIN +#define CH_USE_ROUNDROBIN TRUE +#endif + +/** + * If specified then the @p chThdWait() function is included in the kernel. + * @note The default is @p TRUE. + */ +#ifndef CH_USE_WAITEXIT +#define CH_USE_WAITEXIT TRUE +#endif + +/** + * If specified then the Semaphores APIs are included in the kernel. + * @note The default is @p TRUE. + */ +#ifndef CH_USE_SEMAPHORES +#define CH_USE_SEMAPHORES TRUE +#endif + +/** + * If enabled then the threads are enqueued on semaphores by priority rather + * than FIFO order. + * @note The default is @p FALSE. Enable this if you have special requirements. + * @note Requires @p CH_USE_SEMAPHORES. + */ +#ifndef CH_USE_SEMAPHORES_PRIORITY +#define CH_USE_SEMAPHORES_PRIORITY FALSE +#endif + +/** + * If specified then the Semaphores the @p chSemWaitSignal() API is included + * in the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. + */ +#ifndef CH_USE_SEMSW +#define CH_USE_SEMSW TRUE +#endif + +/** + * If specified then the Semaphores with timeout APIs are included in the + * kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. + */ +#ifndef CH_USE_SEMAPHORES_TIMEOUT +#define CH_USE_SEMAPHORES_TIMEOUT TRUE +#endif + +/** + * If specified then the Mutexes APIs are included in the kernel. + * @note The default is @p TRUE. + */ +#ifndef CH_USE_MUTEXES +#define CH_USE_MUTEXES TRUE +#endif + +/** + * If specified then the Conditional Variables APIs are included in the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_MUTEXES. + */ +#ifndef CH_USE_CONDVARS +#define CH_USE_CONDVARS TRUE +#endif + +/** + * If specified then the Conditional Variables APIs are included in the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_CONDVARS. + */ +#ifndef CH_USE_CONDVARS_TIMEOUT +#define CH_USE_CONDVARS_TIMEOUT TRUE +#endif + +/** + * If specified then the Event flags APIs are included in the kernel. + * @note The default is @p TRUE. + */ +#ifndef CH_USE_EVENTS +#define CH_USE_EVENTS TRUE +#endif + +/** + * If specified then the @p chEvtWaitXXXTimeout() functions are included in + * the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_EVENTS. + */ +#ifndef CH_USE_EVENTS_TIMEOUT +#define CH_USE_EVENTS_TIMEOUT TRUE +#endif + +/** + * If specified then the Synchronous Messages APIs are included in the kernel. + * @note The default is @p TRUE. + */ +#ifndef CH_USE_MESSAGES +#define CH_USE_MESSAGES TRUE +#endif + +/** + * If specified then the @p chMsgSendWithEvent() function is included in the + * kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_MESSAGES and @p CH_USE_EVENTS. + */ +#ifndef CH_USE_MESSAGES_EVENT +#define CH_USE_MESSAGES_EVENT TRUE +#endif + +/** + * If enabled then messages are served by priority rather than in FIFO order. + * @note The default is @p FALSE. Enable this if you have special requirements. + * @note Requires @p CH_USE_MESSAGES. + */ +#ifndef CH_USE_MESSAGES_PRIORITY +#define CH_USE_MESSAGES_PRIORITY FALSE +#endif + +/** + * If specified then the I/O queues APIs are included in the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. + */ +#ifndef CH_USE_QUEUES +#define CH_USE_QUEUES TRUE +#endif + +/** + * If specified then the half duplex queues APIs are included in the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. + */ +#ifndef CH_USE_QUEUES_HALFDUPLEX +#define CH_USE_QUEUES_HALFDUPLEX TRUE +#endif + +/** + * If specified then the I/O queues with timeout APIs are included in the + * kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_QUEUES and @p CH_USE_SEMAPHORES_TIMEOUT. + */ +#ifndef CH_USE_QUEUES_TIMEOUT +#define CH_USE_QUEUES_TIMEOUT TRUE +#endif + +/** + * If specified then the full duplex serial driver APIs are included in the + * kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_QUEUES. + */ +#ifndef CH_USE_SERIAL_FULLDUPLEX +#define CH_USE_SERIAL_FULLDUPLEX TRUE +#endif + +/** + * If specified then the half duplex serial driver APIs are included in the + * kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_QUEUES_HALFDUPLEX. + */ +#ifndef CH_USE_SERIAL_HALFDUPLEX +#define CH_USE_SERIAL_HALFDUPLEX TRUE +#endif + +/** + * If specified then the memory heap allocator APIs are included in the kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_MUTEXES or @p CH_USE_SEMAPHORES. + * @note Mutexes are recommended. + */ +#ifndef CH_USE_HEAP +#define CH_USE_HEAP TRUE +#endif + +/** + * Number of RAM bytes to use as system heap. If set to zero then the whole + * available RAM is used as system heap. * @note In order to use the whole RAM as system heap the linker script must - * provide the \p __heap_base__ and \p __heap_end__ symbols. - * @note requires \p CH_USE_HEAP. + * provide the @p __heap_base__ and @p __heap_end__ symbols. + * @note Requires @p CH_USE_HEAP. */ -#define CH_HEAP_SIZE 0x20000 +#ifndef CH_HEAP_SIZE +#define CH_HEAP_SIZE 0x20000 +#endif -/** Configuration option: enforces the use of the C-runtime \p malloc() and - * \p free() functions as backend for the system heap allocator.*/ -//#define CH_USE_MALLOC_HEAP +/** + * If enabled enforces the use of the C-runtime @p malloc() and @p free() + * functions as backend for the system heap allocator. + * @note The default is @p FALSE. + * @note Requires @p CH_USE_HEAP. + */ +#ifndef CH_USE_MALLOC_HEAP +#define CH_USE_MALLOC_HEAP FALSE +#endif -/** Configuration option: if specified then the memory pools allocator APIs - * are included in the kernel.*/ -#define CH_USE_MEMPOOLS +/** + * If specified then the memory pools allocator APIs are included in the + * kernel. + * @note The default is @p TRUE. + */ +#ifndef CH_USE_MEMPOOLS +#define CH_USE_MEMPOOLS TRUE +#endif -/** Configuration option: if specified then the dynamic objects creation APIs - * are included in the kernel. - * @note requires \p CH_USE_WAITEXIT. +/** + * If specified then the dynamic threads creation APIs are included in the + * kernel. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_WAITEXIT. */ -#define CH_USE_DYNAMIC +#ifndef CH_USE_DYNAMIC +#define CH_USE_DYNAMIC TRUE +#endif -/** Configuration option: Frequency of the system timer that drives the system - * ticks. This also defines the system time unit.*/ -#define CH_FREQUENCY 1000 +/** + * Frequency of the system timer that drives the system ticks. This also + * defines the system tick time unit. + */ +#ifndef CH_FREQUENCY +#define CH_FREQUENCY 1000 +#endif -/** Configuration option: This constant is the number of ticks allowed for the - * threads before preemption occurs. This option is only meaningful if the - * option \p CH_USE_ROUNDROBIN is also active.*/ -#define CH_TIME_QUANTUM 20 +/** + * This constant is the number of system ticks allowed for the threads before + * preemption occurs. This option is only meaningful if the option + * @p CH_USE_ROUNDROBIN is also active. + */ +#ifndef CH_TIME_QUANTUM +#define CH_TIME_QUANTUM 20 +#endif -/** Configuration option: Defines a CPU register to be used as storage for the - * global \p currp variable. Caching this variable in a register can greatly - * improve both space and time efficiency of the generated code. Another side - * effect is that one less register has to be saved during the context switch - * resulting in lower RAM usage and faster code. - * @note This option is only useable with the GCC compiler and is only useful - * on processors with many registers like ARM cores. - * @note If this option is enabled then ALL the libraries linked to the - * ChibiOS/RT code must be recompiled with the GCC option \p - * -ffixed-\. +/** + * If enabled defines a CPU register to be used as storage for the global + * @p currp variable. Caching this variable in a register can greatly + * improve both space and time efficiency of the generated code. Another side + * effect is that one less register has to be saved during the context switch + * resulting in lower RAM usage and faster code. + * @note This option is only usable with the GCC compiler and is only useful + * on processors with many registers like ARM cores. + * @note If this option is enabled then ALL the libraries linked to the + * ChibiOS/RT code must be recompiled with the GCC option @p + * -ffixed-@. + * @note This option must be enabled in the Makefile, it is listed here for + * documentation. */ -//#define CH_CURRP_REGISTER_CACHE "reg" +#if defined(__DOXYGEN__) +#define CH_CURRP_REGISTER_CACHE "reg" +#endif -/** Configuration option: Includes basic debug support to the kernel. - * @note the debug support is port-dependent, it may be not present on some +/** + * Debug option, if enableed includes basic debug support to the kernel. + * @note The debug support is port-dependent, it may be not present on some * targets. In that case stub functions will be included. + * @note The default is @p FALSE. */ -//#define CH_USE_DEBUG +#ifndef CH_USE_DEBUG +#define CH_USE_DEBUG FALSE +#endif -/** Debug option: Includes the threads context switch tracing feature. +/** + * Debug option, includes the threads context switch tracing feature. + * @note The default is @p FALSE. */ -//#define CH_USE_TRACE +#ifndef CH_USE_TRACE +#define CH_USE_TRACE FALSE +#endif -/** User fields added to the end of the \p Thread structure. */ +/** + * User fields added to the end of the @p Thread structure. + */ +#ifndef THREAD_EXT_FIELDS #define THREAD_EXT_FIELDS \ struct { \ /* Add thread custom fields here.*/ \ /* The thread termination \p EventSource.*/ \ EventSource p_exitesource; \ }; +#endif -/** User initialization code added to the \p chThdCreate() API. - * @note It is invoked from within \p chThdInit(). */ +/** + * User initialization code added to the @p chThdInit() API. + * @note It is invoked from within @p chThdInit(). + */ +#ifndef THREAD_EXT_INIT #define THREAD_EXT_INIT(tp) { \ /* Add thread initialization code here.*/ \ chEvtInit(&tp->p_exitesource); \ } +#endif -/** User finalization code added to the \p chThdExit() API. - * @note It is inserted into lock zone. */ +/** + * User finalization code added to the @p chThdExit() API. + * @note It is inserted into lock zone. + */ +#ifndef THREAD_EXT_EXIT #define THREAD_EXT_EXIT(tp) { \ /* Add thread finalization code here.*/ \ chEvtBroadcastI(&currp->p_exitesource); \ } +#endif + +/** + * Code inserted inside the idle thread loop immediately after an interrupt + * resumed execution. + */ +#ifndef IDLE_LOOP_HOOK +#define IDLE_LOOP_HOOK() { \ + /* Idle loop code here.*/ \ +} +#endif #define chThdGetExitEventSource(tp) (&(tp)->p_exitesource) -- cgit v1.2.3 From fa9b36aff3676a897503a359314d08db8fc5a09d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 14 Feb 2009 18:20:33 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@766 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index ac7131871..396f8d9a1 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -310,21 +310,30 @@ #endif /** - * Debug option, if enableed includes basic debug support to the kernel. - * @note The debug support is port-dependent, it may be not present on some - * targets. In that case stub functions will be included. + * Debug option, if enabled all the assertions in the kernel code are + * activated. This includes function parameters checks and consistency + * checks inside the kernel. * @note The default is @p FALSE. */ -#ifndef CH_USE_DEBUG -#define CH_USE_DEBUG FALSE +#ifndef CH_DBG_ENABLE_ASSERTS +#define CH_DBG_ENABLE_ASSERTS FALSE #endif /** - * Debug option, includes the threads context switch tracing feature. + * Debug option, if enabled the context switch circular trace buffer is + * activated. * @note The default is @p FALSE. */ -#ifndef CH_USE_TRACE -#define CH_USE_TRACE FALSE +#ifndef CH_DBG_ENABLE_TRACE +#define CH_DBG_ENABLE_TRACE FALSE +#endif + +/** + * Debug option, if enabled the threads working area is filled with a byte + * pattern when a thread is created. + */ +#ifndef CH_DBG_FILL_THREADS +#define CH_DBG_FILL_THREADS FALSE #endif /** -- cgit v1.2.3 From 7fe2bf4789935d592c24dbbe2aaba18c34c021cf Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 17 Feb 2009 19:43:14 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@777 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 216 +++++++++++++++++++++++++++------------------ 1 file changed, 131 insertions(+), 85 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 396f8d9a1..e41f4410e 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -27,14 +27,25 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ +/*===========================================================================*/ +/* Kernel parameters. */ +/*===========================================================================*/ + /** - * If specified then time efficient rather than space efficient code is used - * when two possible implementations exist. - * @note This is not related to the compiler optimization options. - * @note The default is @p TRUE. + * Frequency of the system timer that drives the system ticks. This also + * defines the system tick time unit. */ -#ifndef CH_OPTIMIZE_SPEED -#define CH_OPTIMIZE_SPEED TRUE +#if !defined(CH_FREQUENCY) || defined(__DOXYGEN__) +#define CH_FREQUENCY 1000 +#endif + +/** + * This constant is the number of system ticks allowed for the threads before + * preemption occurs. This option is only meaningful if the option + * @p CH_USE_ROUNDROBIN is also active. + */ +#if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__) +#define CH_TIME_QUANTUM 20 #endif /** @@ -43,10 +54,10 @@ * For performance and code size reasons the recommended setting is to leave * this option disabled.
* You can use this option if you need to merge ChibiOS/RT with external - * libraries that require nested lock/unlock operations. + * libraries that require nested lock/unlock operations. * @note The default is @p FALSE. */ -#ifndef CH_USE_NESTED_LOCKS +#if !defined(CH_USE_NESTED_LOCKS) || defined(__DOXYGEN__) #define CH_USE_NESTED_LOCKS FALSE #endif @@ -55,15 +66,62 @@ * on threads of equal priority. * @note The default is @p TRUE. */ -#ifndef CH_USE_ROUNDROBIN +#if !defined(CH_USE_ROUNDROBIN) || defined(__DOXYGEN__) #define CH_USE_ROUNDROBIN TRUE #endif +/** + * Number of RAM bytes to use as system heap. If set to zero then the whole + * available RAM is used as system heap. + * @note In order to use the whole RAM as system heap the linker script must + * provide the @p __heap_base__ and @p __heap_end__ symbols. + * @note Requires @p CH_USE_HEAP. + */ +#if !defined(CH_HEAP_SIZE) || defined(__DOXYGEN__) +#define CH_HEAP_SIZE 0x20000 +#endif + +/*===========================================================================*/ +/* Performance options. */ +/*===========================================================================*/ + +/** + * If specified then time efficient rather than space efficient code is used + * when two possible implementations exist. + * @note This is not related to the compiler optimization options. + * @note The default is @p TRUE. + */ +#if !defined(CH_OPTIMIZE_SPEED) || defined(__DOXYGEN__) +#define CH_OPTIMIZE_SPEED TRUE +#endif + +/** + * If enabled defines a CPU register to be used as storage for the global + * @p currp variable. Caching this variable in a register can greatly + * improve both space and time efficiency of the generated code. Another side + * effect is that one less register has to be saved during the context switch + * resulting in lower RAM usage and faster code. + * @note This option is only usable with the GCC compiler and is only useful + * on processors with many registers like ARM cores. + * @note If this option is enabled then ALL the libraries linked to the + * ChibiOS/RT code must be recompiled with the GCC option @p + * -ffixed-@. + * @note This option must be enabled in the Makefile, it is listed here for + * documentation. + */ +#if defined(__DOXYGEN__) +#define CH_CURRP_REGISTER_CACHE "reg" +#endif + +/*===========================================================================*/ +/* Subsystem options. */ +/*===========================================================================*/ + /** * If specified then the @p chThdWait() function is included in the kernel. * @note The default is @p TRUE. */ -#ifndef CH_USE_WAITEXIT +#if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__) #define CH_USE_WAITEXIT TRUE #endif @@ -71,7 +129,7 @@ * If specified then the Semaphores APIs are included in the kernel. * @note The default is @p TRUE. */ -#ifndef CH_USE_SEMAPHORES +#if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__) #define CH_USE_SEMAPHORES TRUE #endif @@ -81,7 +139,7 @@ * @note The default is @p FALSE. Enable this if you have special requirements. * @note Requires @p CH_USE_SEMAPHORES. */ -#ifndef CH_USE_SEMAPHORES_PRIORITY +#if !defined(CH_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__) #define CH_USE_SEMAPHORES_PRIORITY FALSE #endif @@ -91,7 +149,7 @@ * @note The default is @p TRUE. * @note Requires @p CH_USE_SEMAPHORES. */ -#ifndef CH_USE_SEMSW +#if !defined(CH_USE_SEMSW) || defined(__DOXYGEN__) #define CH_USE_SEMSW TRUE #endif @@ -101,7 +159,7 @@ * @note The default is @p TRUE. * @note Requires @p CH_USE_SEMAPHORES. */ -#ifndef CH_USE_SEMAPHORES_TIMEOUT +#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__) #define CH_USE_SEMAPHORES_TIMEOUT TRUE #endif @@ -109,7 +167,7 @@ * If specified then the Mutexes APIs are included in the kernel. * @note The default is @p TRUE. */ -#ifndef CH_USE_MUTEXES +#if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__) #define CH_USE_MUTEXES TRUE #endif @@ -118,7 +176,7 @@ * @note The default is @p TRUE. * @note Requires @p CH_USE_MUTEXES. */ -#ifndef CH_USE_CONDVARS +#if !defined(CH_USE_CONDVARS) || defined(__DOXYGEN__) #define CH_USE_CONDVARS TRUE #endif @@ -127,7 +185,7 @@ * @note The default is @p TRUE. * @note Requires @p CH_USE_CONDVARS. */ -#ifndef CH_USE_CONDVARS_TIMEOUT +#if !defined(CH_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__) #define CH_USE_CONDVARS_TIMEOUT TRUE #endif @@ -135,7 +193,7 @@ * If specified then the Event flags APIs are included in the kernel. * @note The default is @p TRUE. */ -#ifndef CH_USE_EVENTS +#if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__) #define CH_USE_EVENTS TRUE #endif @@ -145,7 +203,7 @@ * @note The default is @p TRUE. * @note Requires @p CH_USE_EVENTS. */ -#ifndef CH_USE_EVENTS_TIMEOUT +#if !defined(CH_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__) #define CH_USE_EVENTS_TIMEOUT TRUE #endif @@ -153,7 +211,7 @@ * If specified then the Synchronous Messages APIs are included in the kernel. * @note The default is @p TRUE. */ -#ifndef CH_USE_MESSAGES +#if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__) #define CH_USE_MESSAGES TRUE #endif @@ -163,7 +221,7 @@ * @note The default is @p TRUE. * @note Requires @p CH_USE_MESSAGES and @p CH_USE_EVENTS. */ -#ifndef CH_USE_MESSAGES_EVENT +#if !defined(CH_USE_MESSAGES_EVENT) || defined(__DOXYGEN__) #define CH_USE_MESSAGES_EVENT TRUE #endif @@ -172,16 +230,25 @@ * @note The default is @p FALSE. Enable this if you have special requirements. * @note Requires @p CH_USE_MESSAGES. */ -#ifndef CH_USE_MESSAGES_PRIORITY +#if !defined(CH_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__) #define CH_USE_MESSAGES_PRIORITY FALSE #endif +/** + * If specified then the Asynchronous Messages (Mailboxes) APIs are included + * in the kernel. + * @note The default is @p TRUE. + */ +#if !defined(CH_USE_MAILBOXESS) || defined(__DOXYGEN__) +#define CH_USE_MAILBOXESS TRUE +#endif + /** * If specified then the I/O queues APIs are included in the kernel. * @note The default is @p TRUE. * @note Requires @p CH_USE_SEMAPHORES. */ -#ifndef CH_USE_QUEUES +#if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__) #define CH_USE_QUEUES TRUE #endif @@ -190,7 +257,7 @@ * @note The default is @p TRUE. * @note Requires @p CH_USE_SEMAPHORES. */ -#ifndef CH_USE_QUEUES_HALFDUPLEX +#if !defined(CH_USE_QUEUES_HALFDUPLEX) || defined(__DOXYGEN__) #define CH_USE_QUEUES_HALFDUPLEX TRUE #endif @@ -200,7 +267,7 @@ * @note The default is @p TRUE. * @note Requires @p CH_USE_QUEUES and @p CH_USE_SEMAPHORES_TIMEOUT. */ -#ifndef CH_USE_QUEUES_TIMEOUT +#if !defined(CH_USE_QUEUES_TIMEOUT) || defined(__DOXYGEN__) #define CH_USE_QUEUES_TIMEOUT TRUE #endif @@ -210,7 +277,7 @@ * @note The default is @p TRUE. * @note Requires @p CH_USE_QUEUES. */ -#ifndef CH_USE_SERIAL_FULLDUPLEX +#if !defined(CH_USE_SERIAL_FULLDUPLEX) || defined(__DOXYGEN__) #define CH_USE_SERIAL_FULLDUPLEX TRUE #endif @@ -220,7 +287,7 @@ * @note The default is @p TRUE. * @note Requires @p CH_USE_QUEUES_HALFDUPLEX. */ -#ifndef CH_USE_SERIAL_HALFDUPLEX +#if !defined(CH_USE_SERIAL_HALFDUPLEX) || defined(__DOXYGEN__) #define CH_USE_SERIAL_HALFDUPLEX TRUE #endif @@ -230,28 +297,17 @@ * @note Requires @p CH_USE_MUTEXES or @p CH_USE_SEMAPHORES. * @note Mutexes are recommended. */ -#ifndef CH_USE_HEAP +#if !defined(CH_USE_HEAP) || defined(__DOXYGEN__) #define CH_USE_HEAP TRUE #endif -/** - * Number of RAM bytes to use as system heap. If set to zero then the whole - * available RAM is used as system heap. - * @note In order to use the whole RAM as system heap the linker script must - * provide the @p __heap_base__ and @p __heap_end__ symbols. - * @note Requires @p CH_USE_HEAP. - */ -#ifndef CH_HEAP_SIZE -#define CH_HEAP_SIZE 0x20000 -#endif - /** * If enabled enforces the use of the C-runtime @p malloc() and @p free() * functions as backend for the system heap allocator. * @note The default is @p FALSE. * @note Requires @p CH_USE_HEAP. */ -#ifndef CH_USE_MALLOC_HEAP +#if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) #define CH_USE_MALLOC_HEAP FALSE #endif @@ -260,7 +316,7 @@ * kernel. * @note The default is @p TRUE. */ -#ifndef CH_USE_MEMPOOLS +#if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__) #define CH_USE_MEMPOOLS TRUE #endif @@ -270,52 +326,21 @@ * @note The default is @p TRUE. * @note Requires @p CH_USE_WAITEXIT. */ -#ifndef CH_USE_DYNAMIC +#if !defined(CH_USE_DYNAMIC) || defined(__DOXYGEN__) #define CH_USE_DYNAMIC TRUE #endif -/** - * Frequency of the system timer that drives the system ticks. This also - * defines the system tick time unit. - */ -#ifndef CH_FREQUENCY -#define CH_FREQUENCY 1000 -#endif - -/** - * This constant is the number of system ticks allowed for the threads before - * preemption occurs. This option is only meaningful if the option - * @p CH_USE_ROUNDROBIN is also active. - */ -#ifndef CH_TIME_QUANTUM -#define CH_TIME_QUANTUM 20 -#endif - -/** - * If enabled defines a CPU register to be used as storage for the global - * @p currp variable. Caching this variable in a register can greatly - * improve both space and time efficiency of the generated code. Another side - * effect is that one less register has to be saved during the context switch - * resulting in lower RAM usage and faster code. - * @note This option is only usable with the GCC compiler and is only useful - * on processors with many registers like ARM cores. - * @note If this option is enabled then ALL the libraries linked to the - * ChibiOS/RT code must be recompiled with the GCC option @p - * -ffixed-@. - * @note This option must be enabled in the Makefile, it is listed here for - * documentation. - */ -#if defined(__DOXYGEN__) -#define CH_CURRP_REGISTER_CACHE "reg" -#endif +/*===========================================================================*/ +/* Debug options. */ +/*===========================================================================*/ /** * Debug option, if enabled all the assertions in the kernel code are * activated. This includes function parameters checks and consistency - * checks inside the kernel. + * checks inside the kernel. * @note The default is @p FALSE. */ -#ifndef CH_DBG_ENABLE_ASSERTS +#if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) #define CH_DBG_ENABLE_ASSERTS FALSE #endif @@ -324,22 +349,43 @@ * activated. * @note The default is @p FALSE. */ -#ifndef CH_DBG_ENABLE_TRACE +#if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__) #define CH_DBG_ENABLE_TRACE FALSE #endif +/** + * Debug option, if enabled a runtime stack check is performed. + * @note The stack check is performed in a architecture/port dependent way. It + * may not be implemented at all. + */ +#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__) +#define CH_DBG_ENABLE_STACK_CHECK FALSE +#endif + /** * Debug option, if enabled the threads working area is filled with a byte - * pattern when a thread is created. + * pattern when a thread is created. */ -#ifndef CH_DBG_FILL_THREADS +#if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__) #define CH_DBG_FILL_THREADS FALSE #endif +/** + * Debug option, if enabled a field is added to the @p Thread structure that + * counts the system ticks occurred while executing the thread. + */ +#if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__) +#define CH_DBG_THREADS_PROFILING FALSE +#endif + +/*===========================================================================*/ +/* Kernel hooks. */ +/*===========================================================================*/ + /** * User fields added to the end of the @p Thread structure. */ -#ifndef THREAD_EXT_FIELDS +#if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) #define THREAD_EXT_FIELDS \ struct { \ /* Add thread custom fields here.*/ \ @@ -352,7 +398,7 @@ struct { \ * User initialization code added to the @p chThdInit() API. * @note It is invoked from within @p chThdInit(). */ -#ifndef THREAD_EXT_INIT +#if !defined(THREAD_EXT_INIT) || defined(__DOXYGEN__) #define THREAD_EXT_INIT(tp) { \ /* Add thread initialization code here.*/ \ chEvtInit(&tp->p_exitesource); \ @@ -363,7 +409,7 @@ struct { \ * User finalization code added to the @p chThdExit() API. * @note It is inserted into lock zone. */ -#ifndef THREAD_EXT_EXIT +#if !defined(THREAD_EXT_EXIT) || defined(__DOXYGEN__) #define THREAD_EXT_EXIT(tp) { \ /* Add thread finalization code here.*/ \ chEvtBroadcastI(&currp->p_exitesource); \ @@ -374,7 +420,7 @@ struct { \ * Code inserted inside the idle thread loop immediately after an interrupt * resumed execution. */ -#ifndef IDLE_LOOP_HOOK +#if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__) #define IDLE_LOOP_HOOK() { \ /* Idle loop code here.*/ \ } -- cgit v1.2.3 From 3d2f2081cebee2936d8073ab6a55177b6549013e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 17 Feb 2009 19:58:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@778 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index e41f4410e..761819bba 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -239,8 +239,8 @@ * in the kernel. * @note The default is @p TRUE. */ -#if !defined(CH_USE_MAILBOXESS) || defined(__DOXYGEN__) -#define CH_USE_MAILBOXESS TRUE +#if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__) +#define CH_USE_MAILBOXES TRUE #endif /** -- cgit v1.2.3 From daabc2b079b17a41ca2f1a2a6423373f811402ba Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 20 Feb 2009 20:14:42 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@791 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 761819bba..40cb2e53d 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -335,9 +335,18 @@ /*===========================================================================*/ /** - * Debug option, if enabled all the assertions in the kernel code are - * activated. This includes function parameters checks and consistency - * checks inside the kernel. + * Debug option, if enabled then the checks on the API functions input + * parameters are activated. + * @note The default is @p FALSE. + */ +#if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__) +#define CH_DBG_ENABLE_CHECKS FALSE +#endif + +/** + * Debug option, if enabled then all the assertions in the kernel code are + * activated. This includes consistency checks inside the kernel, runtime + * anomalies and port-defined checks. * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) -- cgit v1.2.3 From 605d283b6aced9dd69f32b6d6ac0e9f0d25cd10e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 20 Feb 2009 20:21:37 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@792 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 029de3566..97f248a54 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -109,7 +109,7 @@ struct context { /** * Enforces a correct alignment for a stack area size value. */ -#define STACK_ALIGN(n) ((((n) - 1) | sizeof(stkalign_t)) + 1) +#define STACK_ALIGN(n) ((((n) - 1) | (sizeof(stkalign_t) - 1)) + 1) /** * Computes the thread working area global size. -- cgit v1.2.3 From 1fa657d77dde43a9c283a67bf86c57531f624437 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 22 Feb 2009 08:43:49 +0000 Subject: Removed unused port functionality port_puts(). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@800 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.c | 8 -------- demos/Win32-MinGW/chcore.h | 1 - 2 files changed, 9 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 446508e3c..a2194336c 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -93,14 +93,6 @@ void ChkIntSources(void) { } } -/** - * Prints a message on the system console. - * @param msg pointer to the message - */ -__attribute__((fastcall)) -void port_puts(char *msg) { -} - /** * Performs a context switch between two threads. * @param otp the thread to be switched out diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 97f248a54..276b935da 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -192,7 +192,6 @@ struct context { #ifdef __cplusplus extern "C" { #endif - __attribute__((fastcall)) void port_puts(char *msg); __attribute__((fastcall)) void port_switch(Thread *otp, Thread *ntp); __attribute__((fastcall)) void port_halt(void); void InitCore(void); -- cgit v1.2.3 From da4f9beaee8f1f8f344012b4d9a122462a6c802e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 10 Mar 2009 15:31:58 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@827 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 1d80b9d76..c2ac24868 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -194,7 +194,7 @@ static msg_t ShellThread(void *arg) { else if (stricmp(lp, "time") == 0) { if (checkend(sd)) continue; - sprintf(line, "Time: %d\r\n", chSysGetTime()); + sprintf(line, "Time: %d\r\n", chTimeNow()); PrintLineFDD(sd, line); } else if (stricmp(lp, "hello") == 0) { -- cgit v1.2.3 From a8a6649caa7a12aef55883d5c1907a7f5cbca386 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 9 Apr 2009 12:27:02 +0000 Subject: Fixed bug 2745153. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@882 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 4 ++-- demos/Win32-MinGW/chcore.c | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index 841557827..c0e4afbca 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -77,7 +77,7 @@ ULIBDIR = ULIBS = # Define optimisation level here -OPT = -ggdb -O2 -fomit-frame-pointer +OPT = -ggdb -O0 -fomit-frame-pointer # # End of user defines @@ -93,7 +93,7 @@ LIBS = $(DLIBS) $(ULIBS) LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) -CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS) +CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) # Generate dependency information CPFLAGS += -MD -MP -MF .dep/$(@F).d diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index a2194336c..081a02753 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -98,20 +98,21 @@ void ChkIntSources(void) { * @param otp the thread to be switched out * @param ntp the thread to be switched in */ -__attribute__((fastcall)) -void port_switch(Thread *otp, Thread *ntp) { - register struct intctx volatile *esp asm("esp"); - - asm volatile ("push %ebp \n\t" \ +__attribute__((used)) +static void __dummy(Thread *otp, Thread *ntp) { + asm volatile (".globl @port_switch@8 \n\t" \ + "@port_switch@8: \n\t" \ + "push %ebp \n\t" \ "push %esi \n\t" \ "push %edi \n\t" \ - "push %ebx"); - otp->p_ctx.esp = esp; - esp = ntp->p_ctx.esp; - asm volatile ("pop %ebx \n\t" \ + "push %ebx \n\t" \ + "movl %esp, 16(%ecx) \n\t" \ + "movl 16(%edx), %esp \n\t" \ + "pop %ebx \n\t" \ "pop %edi \n\t" \ "pop %esi \n\t" \ - "pop %ebp"); + "pop %ebp \n\t" \ + "ret"); } /** -- cgit v1.2.3 From 418d221cde3d0c5a4e2ff3c7e84e369af550f965 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 9 Apr 2009 13:12:17 +0000 Subject: Gcov support in MinGW demo. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@883 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index c0e4afbca..db72f2488 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -19,6 +19,7 @@ TRGT = mingw32- CC = $(TRGT)gcc AS = $(TRGT)gcc -x assembler-with-cpp +COV = gcov # List all default C defines here, like -D_DEBUG=1 DDEFS = @@ -77,7 +78,10 @@ ULIBDIR = ULIBS = # Define optimisation level here -OPT = -ggdb -O0 -fomit-frame-pointer +OPT = -ggdb -O2 -fomit-frame-pointer + +# Debug target options here +DOPT = -ggdb -O0 -fomit-frame-pointer -fprofile-arcs -ftest-coverage # # End of user defines @@ -94,9 +98,11 @@ LIBS = $(DLIBS) $(ULIBS) LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) +DCPFLAGS = $(DOPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) # Generate dependency information CPFLAGS += -MD -MP -MF .dep/$(@F).d +DCPFLAGS += -MD -MP -MF .dep/$(@F).d # # makefile rules @@ -104,6 +110,10 @@ CPFLAGS += -MD -MP -MF .dep/$(@F).d all: $(OBJS) $(PROJECT).exe +debug: $(OBJS) $(PROJECT).exe +CPFLAGS = $(DCPFLAGS) +LDFLAGS += -lgcov + %o : %c $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@ @@ -113,15 +123,23 @@ all: $(OBJS) $(PROJECT).exe %exe: $(OBJS) $(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@ +gcov: + -mkdir gcov + $(COV) -u $(subst /,\,$(SRC)) + -mv *.gcov ./gcov + clean: -rm -f $(OBJS) -rm -f $(PROJECT).exe -rm -f $(PROJECT).map -rm -f $(SRC:.c=.c.bak) -rm -f $(SRC:.c=.lst) + -rm -f $(SRC:.c=.gcno) + -rm -f $(SRC:.c=.gcda) -rm -f $(ASRC:.s=.s.bak) -rm -f $(ASRC:.s=.lst) -rm -fR .dep + -rm -fR gcov # # Include the dependency files, should be the last of the makefile -- cgit v1.2.3 From 00bfdd2bc7717a0e6d6e9e61906aad1e7461ee31 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 10 Apr 2009 19:32:10 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@886 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index db72f2488..ed66e51fd 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -19,7 +19,6 @@ TRGT = mingw32- CC = $(TRGT)gcc AS = $(TRGT)gcc -x assembler-with-cpp -COV = gcov # List all default C defines here, like -D_DEBUG=1 DDEFS = @@ -66,7 +65,7 @@ SRC = chcore.c main.c ../../ports/win32/simcom.c \ ${TESTSRC} # List ASM source files here -ASRC = +ASRC = # List all user directories here UINCDIR = ../../src/include @@ -80,9 +79,6 @@ ULIBS = # Define optimisation level here OPT = -ggdb -O2 -fomit-frame-pointer -# Debug target options here -DOPT = -ggdb -O0 -fomit-frame-pointer -fprofile-arcs -ftest-coverage - # # End of user defines ############################################################################################## @@ -98,11 +94,9 @@ LIBS = $(DLIBS) $(ULIBS) LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) -DCPFLAGS = $(DOPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) # Generate dependency information CPFLAGS += -MD -MP -MF .dep/$(@F).d -DCPFLAGS += -MD -MP -MF .dep/$(@F).d # # makefile rules @@ -110,10 +104,6 @@ DCPFLAGS += -MD -MP -MF .dep/$(@F).d all: $(OBJS) $(PROJECT).exe -debug: $(OBJS) $(PROJECT).exe -CPFLAGS = $(DCPFLAGS) -LDFLAGS += -lgcov - %o : %c $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@ @@ -134,12 +124,9 @@ clean: -rm -f $(PROJECT).map -rm -f $(SRC:.c=.c.bak) -rm -f $(SRC:.c=.lst) - -rm -f $(SRC:.c=.gcno) - -rm -f $(SRC:.c=.gcda) -rm -f $(ASRC:.s=.s.bak) -rm -f $(ASRC:.s=.lst) -rm -fR .dep - -rm -fR gcov # # Include the dependency files, should be the last of the makefile -- cgit v1.2.3 From d62a644b1e910c7fccd65d768a838fcc651e4e80 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 19 Apr 2009 07:15:05 +0000 Subject: Removed the chMsgSendWithEvent() function and the related configuration option. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@914 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 40cb2e53d..208c67a18 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -215,16 +215,6 @@ #define CH_USE_MESSAGES TRUE #endif -/** - * If specified then the @p chMsgSendWithEvent() function is included in the - * kernel. - * @note The default is @p TRUE. - * @note Requires @p CH_USE_MESSAGES and @p CH_USE_EVENTS. - */ -#if !defined(CH_USE_MESSAGES_EVENT) || defined(__DOXYGEN__) -#define CH_USE_MESSAGES_EVENT TRUE -#endif - /** * If enabled then messages are served by priority rather than in FIFO order. * @note The default is @p FALSE. Enable this if you have special requirements. -- cgit v1.2.3 From 756658a69a1abca61281b4dbd84a6dada9fc91b5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 25 Apr 2009 14:56:16 +0000 Subject: Improved test code, architecture names added to the port code. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@918 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 276b935da..fdeb245fb 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -30,6 +30,11 @@ */ #define CH_ARCHITECTURE_WIN32SIM +/** + * Name of the implemented architecture. + */ +#define CH_ARCHITECTURE_NAME "WIN32 Simulator" + /** * 32 bit stack alignment. */ -- cgit v1.2.3 From c989a8967cdcbd54109d686678936a3581fd2c70 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 1 May 2009 13:11:26 +0000 Subject: Removed the CH_USE_SERIAL_HALFDUPLEX, CH_USE_QUEUES_TIMEOUT and CH_USE_QUEUES_HALFDUPLEX configuration options. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@927 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 208c67a18..b11bff238 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -242,25 +242,6 @@ #define CH_USE_QUEUES TRUE #endif -/** - * If specified then the half duplex queues APIs are included in the kernel. - * @note The default is @p TRUE. - * @note Requires @p CH_USE_SEMAPHORES. - */ -#if !defined(CH_USE_QUEUES_HALFDUPLEX) || defined(__DOXYGEN__) -#define CH_USE_QUEUES_HALFDUPLEX TRUE -#endif - -/** - * If specified then the I/O queues with timeout APIs are included in the - * kernel. - * @note The default is @p TRUE. - * @note Requires @p CH_USE_QUEUES and @p CH_USE_SEMAPHORES_TIMEOUT. - */ -#if !defined(CH_USE_QUEUES_TIMEOUT) || defined(__DOXYGEN__) -#define CH_USE_QUEUES_TIMEOUT TRUE -#endif - /** * If specified then the full duplex serial driver APIs are included in the * kernel. @@ -271,16 +252,6 @@ #define CH_USE_SERIAL_FULLDUPLEX TRUE #endif -/** - * If specified then the half duplex serial driver APIs are included in the - * kernel. - * @note The default is @p TRUE. - * @note Requires @p CH_USE_QUEUES_HALFDUPLEX. - */ -#if !defined(CH_USE_SERIAL_HALFDUPLEX) || defined(__DOXYGEN__) -#define CH_USE_SERIAL_HALFDUPLEX TRUE -#endif - /** * If specified then the memory heap allocator APIs are included in the kernel. * @note The default is @p TRUE. -- cgit v1.2.3 From 1f7dd2586a16b6f47ba6214faf954481de6c4086 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 3 May 2009 10:43:54 +0000 Subject: Adjusted LPC214x serial driver and MinGW demo because the latest changes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@942 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index c2ac24868..68dc4eb06 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -83,7 +83,7 @@ static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) { char *p = line; while (TRUE) { - short c = chIQGet(&sd->sd_iqueue); + short c = chIQGet(&sd->d2.iqueue); if (c < 0) return TRUE; if (c == 4) { @@ -162,8 +162,10 @@ static msg_t ShellThread(void *arg) { Thread *tp; WORKING_AREA(tarea, 2048); - chIQReset(&sd->sd_iqueue); - chOQReset(&sd->sd_oqueue); + chSysLock(); + chIQResetI(&sd->d2.iqueue); + chOQResetI(&sd->d2.oqueue); + chSysUnlock(); PrintLineFDD(sd, "ChibiOS/RT Command Shell\r\n\n"); while (TRUE) { PrintLineFDD(sd, "ch> "); @@ -241,8 +243,11 @@ static void COM1Handler(eventid_t id) { chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0); chThdResume(s1); } - if ((flags & SD_DISCONNECTED) && (s1 != NULL)) - chIQReset(&COM1.sd_iqueue); + if ((flags & SD_DISCONNECTED) && (s1 != NULL)) { + chSysLock(); + chIQResetI(&COM1.d2.iqueue); + chSysUnlock(); + } } static WORKING_AREA(s2area, 4096); @@ -264,8 +269,11 @@ static void COM2Handler(eventid_t id) { chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1); chThdResume(s2); } - if ((flags & SD_DISCONNECTED) && (s2 != NULL)) - chIQReset(&COM2.sd_iqueue); + if ((flags & SD_DISCONNECTED) && (s2 != NULL)) { + chSysLock(); + chIQResetI(&COM2.d2.iqueue); + chSysUnlock(); + } } static evhandler_t fhandlers[2] = { @@ -288,13 +296,13 @@ int main(void) { cprint("Console service started on COM1, COM2\n"); cprint(" - Listening for connections on COM1\n"); chFDDGetAndClearFlags(&COM1); - chEvtRegister(&COM1.sd_sevent, &c1fel, 0); + chEvtRegister(&COM1.d2.sevent, &c1fel, 0); cprint(" - Listening for connections on COM2\n"); chFDDGetAndClearFlags(&COM2); - chEvtRegister(&COM2.sd_sevent, &c2fel, 1); + chEvtRegister(&COM2.d2.sevent, &c2fel, 1); while (!chThdShouldTerminate()) chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS)); - chEvtUnregister(&COM2.sd_sevent, &c2fel); // Never invoked but this is an example... - chEvtUnregister(&COM1.sd_sevent, &c1fel); // Never invoked but this is an example... + chEvtUnregister(&COM2.d2.sevent, &c2fel); // Never invoked but this is an example... + chEvtUnregister(&COM1.d2.sevent, &c1fel); // Never invoked but this is an example... return 0; } -- cgit v1.2.3 From 7506cef74c79741c57cf9575ac8b3b400c50bf41 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 May 2009 15:44:17 +0000 Subject: Made CH_DBG_THREADS_PROFILING default to TRUE in all demos because the changes to the function test_cpu_pulse(). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@961 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index b11bff238..3712d1e6f 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -345,7 +345,7 @@ * counts the system ticks occurred while executing the thread. */ #if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__) -#define CH_DBG_THREADS_PROFILING FALSE +#define CH_DBG_THREADS_PROFILING TRUE #endif /*===========================================================================*/ -- cgit v1.2.3 From a6feec221cd3050e0f2d56950abd39677790d79f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 May 2009 16:05:41 +0000 Subject: Removed the CH_USE_SEMAPHORES_TIMEOUT configuration option. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@962 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 3712d1e6f..53ee70cc1 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -153,16 +153,6 @@ #define CH_USE_SEMSW TRUE #endif -/** - * If specified then the Semaphores with timeout APIs are included in the - * kernel. - * @note The default is @p TRUE. - * @note Requires @p CH_USE_SEMAPHORES. - */ -#if !defined(CH_USE_SEMAPHORES_TIMEOUT) || defined(__DOXYGEN__) -#define CH_USE_SEMAPHORES_TIMEOUT TRUE -#endif - /** * If specified then the Mutexes APIs are included in the kernel. * @note The default is @p TRUE. -- cgit v1.2.3 From 1ea7355d85e316aadfd90468b3e808bb3dc95ee9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 16 Aug 2009 13:07:24 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1073 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index ed66e51fd..616b46015 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -47,7 +47,7 @@ DLIBS = -lws2_32 PROJECT = ch # Define linker script file here -LDSCRIPT= +LDSCRIPT = # List all user C define here, like -D_DEBUG=1 UDEFS = @@ -56,19 +56,21 @@ UDEFS = UADEFS = # Imported source files -include ../../src/kernel.mk +include ../../os/kernel/kernel.mk include ../../test/test.mk # List C source files here -SRC = chcore.c main.c ../../ports/win32/simcom.c \ - ${KERNSRC} \ - ${TESTSRC} +SRC = ${KERNSRC} \ + ${TESTSRC} \ + chcore.c \ + ../../os/ports/GCC/win32/simcom.c \ + main.c # List ASM source files here ASRC = # List all user directories here -UINCDIR = ../../src/include +UINCDIR = $(KERNINC) $(TESTINC) # List the user directory to look for the libraries here ULIBDIR = -- cgit v1.2.3 From 68a37ee345f3f8f3bdcc8199a73a84a475efae7e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 30 Aug 2009 14:14:09 +0000 Subject: New serial driver for Win32 demo. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1142 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 7 ++- demos/Win32-MinGW/chcore.c | 17 ++----- demos/Win32-MinGW/main.c | 108 +++++++++++++++++++++++---------------------- 3 files changed, 63 insertions(+), 69 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index 616b46015..50b2a0af2 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -63,14 +63,17 @@ include ../../test/test.mk SRC = ${KERNSRC} \ ${TESTSRC} \ chcore.c \ - ../../os/ports/GCC/win32/simcom.c \ + ../../os/io/serial.c \ + ../../os/io/platforms/Win32/serial_lld.c \ main.c # List ASM source files here ASRC = # List all user directories here -UINCDIR = $(KERNINC) $(TESTINC) +UINCDIR = $(KERNINC) $(TESTINC) \ + ../../os/io \ + ../../os/io/platforms/Win32 # List the user directory to look for the libraries here ULIBDIR = diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 081a02753..70742d3c4 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -28,19 +28,11 @@ */ #include +#include static LARGE_INTEGER nextcnt; static LARGE_INTEGER slice; -void InitSimCom1(void); -void InitSimCom2(void); -BOOL Com1ConnInterruptSimCom(void); -BOOL Com2ConnInterruptSimCom(void); -BOOL Com1InInterruptSimCom(void); -BOOL Com2InInterruptSimCom(void); -BOOL Com1OutInterruptSimCom(void); -BOOL Com2OutInterruptSimCom(void); - /* * Simulated HW initialization. */ @@ -64,8 +56,7 @@ void InitCore(void) { QueryPerformanceCounter(&nextcnt); nextcnt.QuadPart += slice.QuadPart; - InitSimCom1(); - InitSimCom2(); + sdInit(); fflush(stdout); } @@ -75,9 +66,7 @@ void InitCore(void) { void ChkIntSources(void) { LARGE_INTEGER n; - if (Com1InInterruptSimCom() || Com2InInterruptSimCom() || - Com1OutInterruptSimCom() || Com2OutInterruptSimCom() || - Com1ConnInterruptSimCom() || Com2ConnInterruptSimCom()) { + if (sd_lld_interrupt_pending()) { if (chSchRescRequiredI()) chSchDoRescheduleI(); return; diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 68dc4eb06..bca8af11b 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -21,6 +21,7 @@ #include #include +#include static uint32_t wdguard; static WORKING_AREA(wdarea, 2048); @@ -34,8 +35,6 @@ static msg_t ConsoleThread(void *arg); msg_t TestThread(void *p); -extern FullDuplexDriver COM1, COM2; - #define cprint(msg) chMsgSend(cdtp, (msg_t)msg) /* @@ -73,13 +72,13 @@ static msg_t ConsoleThread(void *arg) { return 0; } -static void PrintLineFDD(FullDuplexDriver *sd, char *msg) { +static void PrintLineSD(SerialDriver *sd, char *msg) { while (*msg) - chFDDPut(sd, *msg++); + sdPut(sd, *msg++); } -static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) { +static bool_t GetLineFDD(SerialDriver *sd, char *line, int size) { char *p = line; while (TRUE) { @@ -87,27 +86,27 @@ static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) { if (c < 0) return TRUE; if (c == 4) { - PrintLineFDD(sd, "^D\r\n"); + PrintLineSD(sd, "^D\r\n"); return TRUE; } if (c == 8) { if (p != line) { - chFDDPut(sd, (uint8_t)c); - chFDDPut(sd, 0x20); - chFDDPut(sd, (uint8_t)c); + sdPut(sd, (uint8_t)c); + sdPut(sd, 0x20); + sdPut(sd, (uint8_t)c); p--; } continue; } if (c == '\r') { - PrintLineFDD(sd, "\r\n"); + PrintLineSD(sd, "\r\n"); *p = 0; return FALSE; } if (c < 0x20) continue; if (p < line + size - 1) { - chFDDPut(sd, (uint8_t)c); + sdPut(sd, (uint8_t)c); *p++ = (uint8_t)c; } } @@ -120,19 +119,19 @@ static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) { static msg_t HelloWorldThread(void *arg) { int i; short c; - FullDuplexDriver *sd = (FullDuplexDriver *)arg; + SerialDriver *sd = (SerialDriver *)arg; for (i = 0; i < 10; i++) { - PrintLineFDD(sd, "Hello World\r\n"); - c = chFDDGetTimeout(sd, 333); + PrintLineSD(sd, "Hello World\r\n"); + c = sdGetTimeout(sd, 333); switch (c) { case Q_TIMEOUT: continue; case Q_RESET: return 1; case 3: - PrintLineFDD(sd, "^C\r\n"); + PrintLineSD(sd, "^C\r\n"); return 0; default: chThdSleep(333); @@ -141,12 +140,12 @@ static msg_t HelloWorldThread(void *arg) { return 0; } -static bool_t checkend(FullDuplexDriver *sd) { +static bool_t checkend(SerialDriver *sd) { char * lp = strtok(NULL, " \009"); /* It is not thread safe but this is a demo.*/ if (lp) { - PrintLineFDD(sd, lp); - PrintLineFDD(sd, " ?\r\n"); + PrintLineSD(sd, lp); + PrintLineSD(sd, " ?\r\n"); return TRUE; } return FALSE; @@ -157,7 +156,7 @@ static bool_t checkend(FullDuplexDriver *sd) { * standard input and output. It recognizes few simple commands. */ static msg_t ShellThread(void *arg) { - FullDuplexDriver *sd = (FullDuplexDriver *)arg; + SerialDriver *sd = (SerialDriver *)arg; char *lp, line[64]; Thread *tp; WORKING_AREA(tarea, 2048); @@ -166,11 +165,11 @@ static msg_t ShellThread(void *arg) { chIQResetI(&sd->d2.iqueue); chOQResetI(&sd->d2.oqueue); chSysUnlock(); - PrintLineFDD(sd, "ChibiOS/RT Command Shell\r\n\n"); + PrintLineSD(sd, "ChibiOS/RT Command Shell\r\n\n"); while (TRUE) { - PrintLineFDD(sd, "ch> "); + PrintLineSD(sd, "ch> "); if (GetLineFDD(sd, line, sizeof(line))) { - PrintLineFDD(sd, "\nlogout"); + PrintLineSD(sd, "\nlogout"); break; } lp = strtok(line, " \009"); // Note: not thread safe but it is just a demo. @@ -180,24 +179,24 @@ static msg_t ShellThread(void *arg) { (stricmp(lp, "?") == 0)) { if (checkend(sd)) continue; - PrintLineFDD(sd, "Commands:\r\n"); - PrintLineFDD(sd, " help,h,? - This help\r\n"); - PrintLineFDD(sd, " exit - Logout from ChibiOS/RT\r\n"); - PrintLineFDD(sd, " time - Prints the system timer value\r\n"); - PrintLineFDD(sd, " hello - Runs the Hello World demo thread\r\n"); - PrintLineFDD(sd, " test - Runs the System Test thread\r\n"); + PrintLineSD(sd, "Commands:\r\n"); + PrintLineSD(sd, " help,h,? - This help\r\n"); + PrintLineSD(sd, " exit - Logout from ChibiOS/RT\r\n"); + PrintLineSD(sd, " time - Prints the system timer value\r\n"); + PrintLineSD(sd, " hello - Runs the Hello World demo thread\r\n"); + PrintLineSD(sd, " test - Runs the System Test thread\r\n"); } else if (stricmp(lp, "exit") == 0) { if (checkend(sd)) continue; - PrintLineFDD(sd, "\nlogout"); + PrintLineSD(sd, "\nlogout"); break; } else if (stricmp(lp, "time") == 0) { if (checkend(sd)) continue; sprintf(line, "Time: %d\r\n", chTimeNow()); - PrintLineFDD(sd, line); + PrintLineSD(sd, line); } else if (stricmp(lp, "hello") == 0) { if (checkend(sd)) @@ -216,8 +215,8 @@ static msg_t ShellThread(void *arg) { break; // Lost connection while executing the hello thread. } else { - PrintLineFDD(sd, lp); - PrintLineFDD(sd, " ?\r\n"); + PrintLineSD(sd, lp); + PrintLineSD(sd, " ?\r\n"); } } } @@ -229,23 +228,23 @@ static Thread *s1; EventListener s1tel; static void COM1Handler(eventid_t id) { - dflags_t flags; + sdflags_t flags; if (s1 && chThdTerminated(s1)) { s1 = NULL; - cprint("Init: disconnection on COM1\n"); + cprint("Init: disconnection on SD1\n"); } - flags = chFDDGetAndClearFlags(&COM1); + flags = sdGetAndClearFlags(&SD1); if ((flags & SD_CONNECTED) && (s1 == NULL)) { - cprint("Init: connection on COM1\n"); + cprint("Init: connection on SD1\n"); s1 = chThdInit(s1area, sizeof(s1area), - NORMALPRIO, ShellThread, &COM1); + NORMALPRIO, ShellThread, &SD1); chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0); chThdResume(s1); } if ((flags & SD_DISCONNECTED) && (s1 != NULL)) { chSysLock(); - chIQResetI(&COM1.d2.iqueue); + chIQResetI(&SD1.d2.iqueue); chSysUnlock(); } } @@ -255,23 +254,23 @@ static Thread *s2; EventListener s2tel; static void COM2Handler(eventid_t id) { - dflags_t flags; + sdflags_t flags; if (s2 && chThdTerminated(s2)) { s2 = NULL; - cprint("Init: disconnection on COM2\n"); + cprint("Init: disconnection on SD2\n"); } - flags = chFDDGetAndClearFlags(&COM2); + flags = sdGetAndClearFlags(&SD2); if ((flags & SD_CONNECTED) && (s2 == NULL)) { - cprint("Init: connection on COM2\n"); + cprint("Init: connection on SD2\n"); s2 = chThdInit(s2area, sizeof(s1area), - NORMALPRIO, ShellThread, &COM2); + NORMALPRIO, ShellThread, &SD2); chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1); chThdResume(s2); } if ((flags & SD_DISCONNECTED) && (s2 != NULL)) { chSysLock(); - chIQResetI(&COM2.d2.iqueue); + chIQResetI(&SD2.d2.iqueue); chSysUnlock(); } } @@ -290,19 +289,22 @@ int main(void) { // Startup ChibiOS/RT. chSysInit(); + sdStart(&SD1, NULL); + sdStart(&SD2, NULL); + chThdCreateStatic(wdarea, sizeof(wdarea), NORMALPRIO + 2, WatchdogThread, NULL); cdtp = chThdCreateStatic(cdarea, sizeof(cdarea), NORMALPRIO + 1, ConsoleThread, NULL); - cprint("Console service started on COM1, COM2\n"); - cprint(" - Listening for connections on COM1\n"); - chFDDGetAndClearFlags(&COM1); - chEvtRegister(&COM1.d2.sevent, &c1fel, 0); - cprint(" - Listening for connections on COM2\n"); - chFDDGetAndClearFlags(&COM2); - chEvtRegister(&COM2.d2.sevent, &c2fel, 1); + cprint("Console service started on SD1, SD2\n"); + cprint(" - Listening for connections on SD1\n"); + sdGetAndClearFlags(&SD1); + chEvtRegister(&SD1.d2.sevent, &c1fel, 0); + cprint(" - Listening for connections on SD2\n"); + sdGetAndClearFlags(&SD2); + chEvtRegister(&SD2.d2.sevent, &c2fel, 1); while (!chThdShouldTerminate()) chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS)); - chEvtUnregister(&COM2.d2.sevent, &c2fel); // Never invoked but this is an example... - chEvtUnregister(&COM1.d2.sevent, &c1fel); // Never invoked but this is an example... + chEvtUnregister(&SD1.d2.sevent, &c2fel); // Never invoked but this is an example... + chEvtUnregister(&SD2.d2.sevent, &c1fel); // Never invoked but this is an example... return 0; } -- cgit v1.2.3 From 07be1f54becd5106876ad7b83057aa5f750a7261 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 30 Aug 2009 16:59:19 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1144 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 53ee70cc1..8c124180e 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -232,16 +232,6 @@ #define CH_USE_QUEUES TRUE #endif -/** - * If specified then the full duplex serial driver APIs are included in the - * kernel. - * @note The default is @p TRUE. - * @note Requires @p CH_USE_QUEUES. - */ -#if !defined(CH_USE_SERIAL_FULLDUPLEX) || defined(__DOXYGEN__) -#define CH_USE_SERIAL_FULLDUPLEX TRUE -#endif - /** * If specified then the memory heap allocator APIs are included in the kernel. * @note The default is @p TRUE. -- cgit v1.2.3 From 5c75ead6a5bfb30df949f69e2fd3c90c62ac233f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 13 Sep 2009 12:25:29 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1163 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 70742d3c4..95d8b9de8 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -67,7 +67,7 @@ void ChkIntSources(void) { LARGE_INTEGER n; if (sd_lld_interrupt_pending()) { - if (chSchRescRequiredI()) + if (chSchIsRescRequiredExI()) chSchDoRescheduleI(); return; } @@ -77,7 +77,7 @@ void ChkIntSources(void) { if (n.QuadPart > nextcnt.QuadPart) { nextcnt.QuadPart += slice.QuadPart; chSysTimerHandlerI(); - if (chSchRescRequiredI()) + if (chSchIsRescRequiredExI()) chSchDoRescheduleI(); } } -- cgit v1.2.3 From 9b59b00627e0e068d6e63da7f21ee54d709a46c2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 19 Sep 2009 08:00:34 +0000 Subject: Improved makefiles. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1166 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index 50b2a0af2..f700ce159 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -56,15 +56,16 @@ UDEFS = UADEFS = # Imported source files -include ../../os/kernel/kernel.mk -include ../../test/test.mk +CHIBIOS = ../.. +include ${CHIBIOS}/os/kernel/kernel.mk +include ${CHIBIOS}/test/test.mk # List C source files here SRC = ${KERNSRC} \ ${TESTSRC} \ chcore.c \ - ../../os/io/serial.c \ - ../../os/io/platforms/Win32/serial_lld.c \ + ${CHIBIOS}/os/io/serial.c \ + ${CHIBIOS}/os/io/platforms/Win32/serial_lld.c \ main.c # List ASM source files here @@ -72,8 +73,8 @@ ASRC = # List all user directories here UINCDIR = $(KERNINC) $(TESTINC) \ - ../../os/io \ - ../../os/io/platforms/Win32 + ${CHIBIOS}/os/io \ + ${CHIBIOS}/os/io/platforms/Win32 # List the user directory to look for the libraries here ULIBDIR = -- cgit v1.2.3 From 0c0d93a91e14e60c58148f65bde4d7f45a26c67c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 16 Oct 2009 18:24:32 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1223 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 267 +++++++++++++++++++++++++++++---------------- 1 file changed, 174 insertions(+), 93 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 8c124180e..fda335bc7 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -18,9 +18,9 @@ */ /** - * @file src/templates/chconf.h + * @file templates/chconf.h * @brief Configuration file template. - * @addtogroup Config + * @addtogroup config * @{ */ @@ -32,29 +32,36 @@ /*===========================================================================*/ /** - * Frequency of the system timer that drives the system ticks. This also - * defines the system tick time unit. + * @brief System tick frequency. + * @details Frequency of the system timer that drives the system ticks. This + * setting also defines the system tick time unit. */ #if !defined(CH_FREQUENCY) || defined(__DOXYGEN__) #define CH_FREQUENCY 1000 #endif /** - * This constant is the number of system ticks allowed for the threads before - * preemption occurs. This option is only meaningful if the option - * @p CH_USE_ROUNDROBIN is also active. + * @brief Round robin interval. + * @details This constant is the number of system ticks allowed for the + * threads before preemption occurs. Setting this value to zero + * disables the round robin mechanism. + * + * @note Disabling round robin makes the kernel more compact and generally + * faster but forbids multiple threads at the same priority level. */ #if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__) #define CH_TIME_QUANTUM 20 #endif /** - * If enabled then the use of nested @p chSysLock() / @p chSysUnlock() - * operations is allowed.
- * For performance and code size reasons the recommended setting is to leave - * this option disabled.
- * You can use this option if you need to merge ChibiOS/RT with external - * libraries that require nested lock/unlock operations. + * @brief Nested locks. + * @details If enabled then the use of nested @p chSysLock() / @p chSysUnlock() + * operations is allowed.
+ * For performance and code size reasons the recommended setting + * is to leave this option disabled.
+ * You may use this option if you need to merge ChibiOS/RT with + * external libraries that require nested lock/unlock operations. + * * @note The default is @p FALSE. */ #if !defined(CH_USE_NESTED_LOCKS) || defined(__DOXYGEN__) @@ -62,23 +69,18 @@ #endif /** - * If specified then the kernel performs the round robin scheduling algorithm - * on threads of equal priority. - * @note The default is @p TRUE. - */ -#if !defined(CH_USE_ROUNDROBIN) || defined(__DOXYGEN__) -#define CH_USE_ROUNDROBIN TRUE -#endif - -/** - * Number of RAM bytes to use as system heap. If set to zero then the whole - * available RAM is used as system heap. - * @note In order to use the whole RAM as system heap the linker script must + * @brief Managed RAM size. + * @details Size of the RAM area to be managed by the OS. If set to zero + * then the whole available RAM is used. The core memory is made + * available to the heap allocator and/or can be used directly through + * the simplified core memory allocator. + * + * @note In order to let the OS manage the whole RAM the linker script must * provide the @p __heap_base__ and @p __heap_end__ symbols. - * @note Requires @p CH_USE_HEAP. + * @note Requires @p CH_USE_COREMEM. */ -#if !defined(CH_HEAP_SIZE) || defined(__DOXYGEN__) -#define CH_HEAP_SIZE 0x20000 +#if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__) +#define CH_MEMCORE_SIZE 0x20000 #endif /*===========================================================================*/ @@ -86,8 +88,10 @@ /*===========================================================================*/ /** - * If specified then time efficient rather than space efficient code is used - * when two possible implementations exist. + * @brief OS optimization. + * @details If enabled then time efficient rather than space efficient code + * is used when two possible implementations exist. + * * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ @@ -96,18 +100,20 @@ #endif /** - * If enabled defines a CPU register to be used as storage for the global - * @p currp variable. Caching this variable in a register can greatly - * improve both space and time efficiency of the generated code. Another side - * effect is that one less register has to be saved during the context switch - * resulting in lower RAM usage and faster code. + * @brief Exotic optimization. + * @details If defined then a CPU register is used as storage for the global + * @p currp variable. Caching this variable in a register greatly + * improves both space and time OS efficiency. A side effect is that + * one less register has to be saved during the context switch + * resulting in lower RAM usage and faster context switch. + * * @note This option is only usable with the GCC compiler and is only useful * on processors with many registers like ARM cores. * @note If this option is enabled then ALL the libraries linked to the * ChibiOS/RT code must be recompiled with the GCC option @p * -ffixed-@. * @note This option must be enabled in the Makefile, it is listed here for - * documentation. + * documentation only. */ #if defined(__DOXYGEN__) #define CH_CURRP_REGISTER_CACHE "reg" @@ -118,7 +124,10 @@ /*===========================================================================*/ /** - * If specified then the @p chThdWait() function is included in the kernel. + * @brief Threads synchronization APIs. + * @details If enabled then the @p chThdWait() function is included in + * the kernel. + * * @note The default is @p TRUE. */ #if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__) @@ -126,7 +135,9 @@ #endif /** - * If specified then the Semaphores APIs are included in the kernel. + * @brief Semaphores APIs. + * @details If enabled then the Semaphores APIs are included in the kernel. + * * @note The default is @p TRUE. */ #if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__) @@ -134,8 +145,10 @@ #endif /** - * If enabled then the threads are enqueued on semaphores by priority rather - * than FIFO order. + * @brief Semaphores queuing mode. + * @details If enabled then the threads are enqueued on semaphores by + * priority rather than in FIFO order. + * * @note The default is @p FALSE. Enable this if you have special requirements. * @note Requires @p CH_USE_SEMAPHORES. */ @@ -144,8 +157,10 @@ #endif /** - * If specified then the Semaphores the @p chSemWaitSignal() API is included - * in the kernel. + * @brief Atomic semaphore API. + * @details If enabled then the semaphores the @p chSemWaitSignal() API + * is included in the kernel. + * * @note The default is @p TRUE. * @note Requires @p CH_USE_SEMAPHORES. */ @@ -154,7 +169,9 @@ #endif /** - * If specified then the Mutexes APIs are included in the kernel. + * @brief Mutexes APIs. + * @details If enabled then the mutexes APIs are included in the kernel. + * * @note The default is @p TRUE. */ #if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__) @@ -162,7 +179,10 @@ #endif /** - * If specified then the Conditional Variables APIs are included in the kernel. + * @brief Conditional Variables APIs. + * @details If enabled then the conditional variables APIs are included + * in the kernel. + * * @note The default is @p TRUE. * @note Requires @p CH_USE_MUTEXES. */ @@ -171,7 +191,10 @@ #endif /** - * If specified then the Conditional Variables APIs are included in the kernel. + * @brief Conditional Variables APIs with timeout. + * @details If enabled then the conditional variables APIs with timeout + * specification are included in the kernel. + * * @note The default is @p TRUE. * @note Requires @p CH_USE_CONDVARS. */ @@ -180,7 +203,9 @@ #endif /** - * If specified then the Event flags APIs are included in the kernel. + * @brief Events Flags APIs. + * @details If enabled then the event flags APIs are included in the kernel. + * * @note The default is @p TRUE. */ #if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__) @@ -188,8 +213,10 @@ #endif /** - * If specified then the @p chEvtWaitXXXTimeout() functions are included in - * the kernel. + * @brief Events Flags APIs with timeout. + * @details If enabled then the events APIs with timeout specification + * are included in the kernel. + * * @note The default is @p TRUE. * @note Requires @p CH_USE_EVENTS. */ @@ -198,7 +225,10 @@ #endif /** - * If specified then the Synchronous Messages APIs are included in the kernel. + * @brief Synchronous Messages APIs. + * @details If enabled then the synchronous messages APIs are included + * in the kernel. + * * @note The default is @p TRUE. */ #if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__) @@ -206,7 +236,10 @@ #endif /** - * If enabled then messages are served by priority rather than in FIFO order. + * @brief Synchronous Messages queuing mode. + * @details If enabled then messages are served by priority rather than in + * FIFO order. + * * @note The default is @p FALSE. Enable this if you have special requirements. * @note Requires @p CH_USE_MESSAGES. */ @@ -215,16 +248,21 @@ #endif /** - * If specified then the Asynchronous Messages (Mailboxes) APIs are included - * in the kernel. + * @brief Mailboxes APIs. + * @details If enabled then the asynchronous messages (mailboxes) APIs are + * included in the kernel. + * * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. */ #if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__) #define CH_USE_MAILBOXES TRUE #endif /** - * If specified then the I/O queues APIs are included in the kernel. + * @brief I/O Queues APIs. + * @details If enabled then the I/O queues APIs are included in the kernel. + * * @note The default is @p TRUE. * @note Requires @p CH_USE_SEMAPHORES. */ @@ -233,9 +271,24 @@ #endif /** - * If specified then the memory heap allocator APIs are included in the kernel. + * @brief Core Memory Manager APIs. + * @details If enabled then the core memory manager APIs are included + * in the kernel. + * * @note The default is @p TRUE. - * @note Requires @p CH_USE_MUTEXES or @p CH_USE_SEMAPHORES. + */ +#if !defined(CH_USE_HEAP) || defined(__DOXYGEN__) +#define CH_USE_MEMCORE TRUE +#endif + +/** + * @brief Heap Allocator APIs. + * @details If enabled then the memory heap allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_USE_COREMEM and either @p CH_USE_MUTEXES or + * @p CH_USE_SEMAPHORES. * @note Mutexes are recommended. */ #if !defined(CH_USE_HEAP) || defined(__DOXYGEN__) @@ -243,18 +296,24 @@ #endif /** - * If enabled enforces the use of the C-runtime @p malloc() and @p free() - * functions as backend for the system heap allocator. + * @brief C-runtime allocator. + * @details If enabled the the heap allocator APIs just wrap the C-runtime + * @p malloc() and @p free() functions. + * * @note The default is @p FALSE. * @note Requires @p CH_USE_HEAP. + * @note The C-runtime may or may not require @p CH_USE_COREMEM, see the + * appropriate documentation. */ #if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) #define CH_USE_MALLOC_HEAP FALSE #endif /** - * If specified then the memory pools allocator APIs are included in the - * kernel. + * @brief Memory Pools Allocator APIs. + * @details If enabled then the memory pools allocator APIs are included + * in the kernel. + * * @note The default is @p TRUE. */ #if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__) @@ -262,8 +321,10 @@ #endif /** - * If specified then the dynamic threads creation APIs are included in the - * kernel. + * @brief Dynamic Threads APIs. + * @details If enabled then the dynamic threads creation APIs are included + * in the kernel. + * * @note The default is @p TRUE. * @note Requires @p CH_USE_WAITEXIT. */ @@ -276,8 +337,10 @@ /*===========================================================================*/ /** - * Debug option, if enabled then the checks on the API functions input - * parameters are activated. + * @brief Debug option, parameters checks. + * @details If enabled then the checks on the API functions input + * parameters are activated. + * * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__) @@ -285,9 +348,11 @@ #endif /** - * Debug option, if enabled then all the assertions in the kernel code are - * activated. This includes consistency checks inside the kernel, runtime - * anomalies and port-defined checks. + * @brief Debug option, consistency checks. + * @details If enabled then all the assertions in the kernel code are + * activated. This includes consistency checks inside the kernel, + * runtime anomalies and port-defined checks. + * * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) @@ -295,8 +360,10 @@ #endif /** - * Debug option, if enabled the context switch circular trace buffer is - * activated. + * @brief Debug option, trace buffer. + * @details If enabled then the context switch circular trace buffer is + * activated. + * * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__) @@ -304,25 +371,37 @@ #endif /** - * Debug option, if enabled a runtime stack check is performed. + * @brief Debug option, stack checks. + * @details If enabled then a runtime stack check is performed. + * + * @note The default is @p FALSE. * @note The stack check is performed in a architecture/port dependent way. It - * may not be implemented at all. + * may not be implemented or some ports. */ #if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__) #define CH_DBG_ENABLE_STACK_CHECK FALSE #endif /** - * Debug option, if enabled the threads working area is filled with a byte - * pattern when a thread is created. + * @brief Debug option, stacks initialization. + * @details If enabled then the threads working area is filled with a byte + * value when a thread is created. This can be useful for the + * runtime measurement of the used stack. + * + * @note The default is @p FALSE. */ #if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__) #define CH_DBG_FILL_THREADS FALSE #endif /** - * Debug option, if enabled a field is added to the @p Thread structure that - * counts the system ticks occurred while executing the thread. + * @brief Debug option, threads profiling. + * @details If enabled then a field is added to the @p Thread structure that + * counts the system ticks occurred while executing the thread. + * + * @note The default is @p TRUE. + * @note This debug option is defaulted to TRUE because it is required by + * some test cases into the test suite. */ #if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__) #define CH_DBG_THREADS_PROFILING TRUE @@ -333,42 +412,46 @@ /*===========================================================================*/ /** - * User fields added to the end of the @p Thread structure. + * @brief Threads descriptor structure hook. + * @details User fields added to the end of the @p Thread structure. */ #if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) #define THREAD_EXT_FIELDS \ struct { \ - /* Add thread custom fields here.*/ \ - /* The thread termination \p EventSource.*/ \ - EventSource p_exitesource; \ -}; + /* Add threads custom fields here.*/ \ + /* The thread termination \p EventSource.*/ \ EventSource p_exitesource; \}; #endif /** - * User initialization code added to the @p chThdInit() API. - * @note It is invoked from within @p chThdInit(). + * @brief Threads initialization hook. + * @details User initialization code added to the @p chThdInit() API. + * + * @note It is invoked from within @p chThdInit() and implicitily from all + * the threads creation APIs. */ #if !defined(THREAD_EXT_INIT) || defined(__DOXYGEN__) #define THREAD_EXT_INIT(tp) { \ - /* Add thread initialization code here.*/ \ - chEvtInit(&tp->p_exitesource); \ -} + /* Add threads initialization code here.*/ \ + chEvtInit(&tp->p_exitesource); \} #endif /** - * User finalization code added to the @p chThdExit() API. + * @brief Threads finalization hook. + * @details User finalization code added to the @p chThdExit() API. + * * @note It is inserted into lock zone. + * @note It is also invoked when the threads simply return in order to + * terminate. */ #if !defined(THREAD_EXT_EXIT) || defined(__DOXYGEN__) #define THREAD_EXT_EXIT(tp) { \ - /* Add thread finalization code here.*/ \ - chEvtBroadcastI(&currp->p_exitesource); \ -} + /* Add threads finalization code here.*/ \ + chEvtBroadcastI(&currp->p_exitesource); \} #endif /** - * Code inserted inside the idle thread loop immediately after an interrupt - * resumed execution. + * @brief Idle Loop hook. + * @details This hook is continuously invoked by the idle thread loop. */ #if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__) #define IDLE_LOOP_HOOK() { \ @@ -376,8 +459,6 @@ struct { \ } #endif -#define chThdGetExitEventSource(tp) (&(tp)->p_exitesource) - -#endif /* _CHCONF_H_ */ +#define chThdGetExitEventSource(tp) (&(tp)->p_exitesource)#endif /* _CHCONF_H_ */ /** @} */ -- cgit v1.2.3 From d61cb88dab424a8edcf3b2a06a0c7ea18890208a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 17 Oct 2009 07:35:31 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1224 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index fda335bc7..cef71f8c5 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -419,7 +419,9 @@ #define THREAD_EXT_FIELDS \ struct { \ /* Add threads custom fields here.*/ \ - /* The thread termination \p EventSource.*/ \ EventSource p_exitesource; \}; + /* The thread termination \p EventSource.*/ \ + EventSource p_exitesource; \ +}; #endif /** @@ -432,7 +434,8 @@ struct { \ #if !defined(THREAD_EXT_INIT) || defined(__DOXYGEN__) #define THREAD_EXT_INIT(tp) { \ /* Add threads initialization code here.*/ \ - chEvtInit(&tp->p_exitesource); \} + chEvtInit(&tp->p_exitesource); \ +} #endif /** @@ -446,7 +449,8 @@ struct { \ #if !defined(THREAD_EXT_EXIT) || defined(__DOXYGEN__) #define THREAD_EXT_EXIT(tp) { \ /* Add threads finalization code here.*/ \ - chEvtBroadcastI(&currp->p_exitesource); \} + chEvtBroadcastI(&currp->p_exitesource); \ +} #endif /** @@ -459,6 +463,8 @@ struct { \ } #endif -#define chThdGetExitEventSource(tp) (&(tp)->p_exitesource)#endif /* _CHCONF_H_ */ +#define chThdGetExitEventSource(tp) (&(tp)->p_exitesource) + +#endif /* _CHCONF_H_ */ /** @} */ -- cgit v1.2.3 From e9d7b9de5705a3b5c0b822077fbd165c86087481 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 17 Oct 2009 11:07:15 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1230 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 2 +- demos/Win32-MinGW/chcore.c | 3 ++- demos/Win32-MinGW/main.c | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index f700ce159..3552537ad 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -99,7 +99,7 @@ LIBS = $(DLIBS) $(ULIBS) LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR) ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS) -CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) +CPFLAGS = $(OPT) -Wall -Wextra -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS) # Generate dependency information CPFLAGS += -MD -MP -MF .dep/$(@F).d diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 95d8b9de8..8dcb3b9ad 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -89,8 +89,9 @@ void ChkIntSources(void) { */ __attribute__((used)) static void __dummy(Thread *otp, Thread *ntp) { + (void)otp; (void)ntp; asm volatile (".globl @port_switch@8 \n\t" \ - "@port_switch@8: \n\t" \ + "@port_switch@8: \n\t" \ "push %ebp \n\t" \ "push %esi \n\t" \ "push %edi \n\t" \ diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index bca8af11b..6a2b5367f 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -42,10 +42,11 @@ msg_t TestThread(void *p); * areas. The system is halted if something is wrong. */ static msg_t WatchdogThread(void *arg) { + + (void)arg; wdguard = 0xA51F2E3D; cdguard = 0xA51F2E3D; while (TRUE) { - if ((wdguard != 0xA51F2E3D) || (cdguard != 0xA51F2E3D)) { printf("Halted by watchdog"); @@ -64,6 +65,7 @@ static msg_t WatchdogThread(void *arg) { */ static msg_t ConsoleThread(void *arg) { + (void)arg; while (!chThdShouldTerminate()) { printf((char *)chMsgWait()); fflush(stdout); @@ -230,6 +232,7 @@ EventListener s1tel; static void COM1Handler(eventid_t id) { sdflags_t flags; + (void)id; if (s1 && chThdTerminated(s1)) { s1 = NULL; cprint("Init: disconnection on SD1\n"); @@ -256,6 +259,7 @@ EventListener s2tel; static void COM2Handler(eventid_t id) { sdflags_t flags; + (void)id; if (s2 && chThdTerminated(s2)) { s2 = NULL; cprint("Init: disconnection on SD2\n"); -- cgit v1.2.3 From 31f54b93735bca0ef23b68dc1a1cf735800bbf14 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 Dec 2009 17:44:03 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1398 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chcore.c | 4 ++-- demos/Win32-MinGW/main.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 8dcb3b9ad..f0555fab5 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -27,8 +27,8 @@ * @{ */ -#include -#include +#include "ch.h" +#include "hal.h" static LARGE_INTEGER nextcnt; static LARGE_INTEGER slice; diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 6a2b5367f..7f081c023 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -20,8 +20,8 @@ #include #include -#include -#include +#include "ch.h" +#include "hal.h" static uint32_t wdguard; static WORKING_AREA(wdarea, 2048); -- cgit v1.2.3 From 6d44bd72e3bd586dc84ff0fe65b1218173efa0a7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 Dec 2009 19:12:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1401 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 16 ++-- demos/Win32-MinGW/board.h | 23 +++++ demos/Win32-MinGW/chcore.c | 126 -------------------------- demos/Win32-MinGW/chcore.h | 211 -------------------------------------------- demos/Win32-MinGW/chtypes.h | 47 ---------- demos/Win32-MinGW/halconf.h | 96 ++++++++++++++++++++ demos/Win32-MinGW/main.c | 9 +- 7 files changed, 136 insertions(+), 392 deletions(-) create mode 100644 demos/Win32-MinGW/board.h delete mode 100644 demos/Win32-MinGW/chcore.c delete mode 100644 demos/Win32-MinGW/chcore.h delete mode 100644 demos/Win32-MinGW/chtypes.h create mode 100644 demos/Win32-MinGW/halconf.h (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index 3552537ad..e690b7804 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -57,24 +57,26 @@ UADEFS = # Imported source files CHIBIOS = ../.. +include ${CHIBIOS}/os/hal/hal.mk +include ${CHIBIOS}/os/hal/platforms/Win32/platform.mk +include ${CHIBIOS}/os/ports/GCC/SIMIA32/port.mk include ${CHIBIOS}/os/kernel/kernel.mk include ${CHIBIOS}/test/test.mk # List C source files here -SRC = ${KERNSRC} \ +SRC = ${PORTSRC} \ + ${KERNSRC} \ ${TESTSRC} \ - chcore.c \ - ${CHIBIOS}/os/io/serial.c \ - ${CHIBIOS}/os/io/platforms/Win32/serial_lld.c \ + ${HALSRC} \ + ${PLATFORMSRC} \ main.c # List ASM source files here ASRC = # List all user directories here -UINCDIR = $(KERNINC) $(TESTINC) \ - ${CHIBIOS}/os/io \ - ${CHIBIOS}/os/io/platforms/Win32 +UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) $(HALINC) $(PLATFORMINC) \ + ${CHIBIOS}/os/various # List the user directory to look for the libraries here ULIBDIR = diff --git a/demos/Win32-MinGW/board.h b/demos/Win32-MinGW/board.h new file mode 100644 index 000000000..a6e056d58 --- /dev/null +++ b/demos/Win32-MinGW/board.h @@ -0,0 +1,23 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +#endif /* _BOARD_H_ */ diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c deleted file mode 100644 index f0555fab5..000000000 --- a/demos/Win32-MinGW/chcore.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include -#include - -#undef CDECL - -/** - * @addtogroup WIN32SIM_CORE - * @{ - */ - -#include "ch.h" -#include "hal.h" - -static LARGE_INTEGER nextcnt; -static LARGE_INTEGER slice; - -/* - * Simulated HW initialization. - */ -void InitCore(void) { - WSADATA wsaData; - - // Initialization. - if (WSAStartup(2, &wsaData) != 0) { - printf("Unable to locate a winsock DLL\n"); - exit(1); - } - - printf("Win32 ChibiOS/RT simulator\n\n"); - printf("Thread structure %d bytes\n", sizeof(Thread)); - if (!QueryPerformanceFrequency(&slice)) { - printf("QueryPerformanceFrequency() error"); - exit(1); - } - printf("Core Frequency %u Hz\n", (int)slice.LowPart); - slice.QuadPart /= CH_FREQUENCY; - QueryPerformanceCounter(&nextcnt); - nextcnt.QuadPart += slice.QuadPart; - - sdInit(); - fflush(stdout); -} - -/* - * Interrupt simulation. - */ -void ChkIntSources(void) { - LARGE_INTEGER n; - - if (sd_lld_interrupt_pending()) { - if (chSchIsRescRequiredExI()) - chSchDoRescheduleI(); - return; - } - - // Interrupt Timer simulation (10ms interval). - QueryPerformanceCounter(&n); - if (n.QuadPart > nextcnt.QuadPart) { - nextcnt.QuadPart += slice.QuadPart; - chSysTimerHandlerI(); - if (chSchIsRescRequiredExI()) - chSchDoRescheduleI(); - } -} - -/** - * Performs a context switch between two threads. - * @param otp the thread to be switched out - * @param ntp the thread to be switched in - */ -__attribute__((used)) -static void __dummy(Thread *otp, Thread *ntp) { - (void)otp; (void)ntp; - asm volatile (".globl @port_switch@8 \n\t" \ - "@port_switch@8: \n\t" \ - "push %ebp \n\t" \ - "push %esi \n\t" \ - "push %edi \n\t" \ - "push %ebx \n\t" \ - "movl %esp, 16(%ecx) \n\t" \ - "movl 16(%edx), %esp \n\t" \ - "pop %ebx \n\t" \ - "pop %edi \n\t" \ - "pop %esi \n\t" \ - "pop %ebp \n\t" \ - "ret"); -} - -/** - * Halts the system. In this implementation it just exits the simulation. - */ -__attribute__((fastcall)) -void port_halt(void) { - - exit(2); -} - -/** - * Threads return point, it just invokes @p chThdExit(). - */ -void threadexit(void) { - - asm volatile ("push %eax \n\t" \ - "call _chThdExit"); -} - -/** @} */ diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h deleted file mode 100644 index fdeb245fb..000000000 --- a/demos/Win32-MinGW/chcore.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @addtogroup WIN32SIM_CORE - * @{ - */ - -#ifndef _CHCORE_H_ -#define _CHCORE_H_ - -/** - * Macro defining the a simulated architecture into Win32. - */ -#define CH_ARCHITECTURE_WIN32SIM - -/** - * Name of the implemented architecture. - */ -#define CH_ARCHITECTURE_NAME "WIN32 Simulator" - -/** - * 32 bit stack alignment. - */ -typedef uint32_t stkalign_t; - -/** - * Generic x86 register. - */ -typedef void *regx86; - -/** - * Interrupt saved context. - * This structure represents the stack frame saved during a preemption-capable - * interrupt handler. - */ -struct extctx { -}; - -/** - * System saved context. - * @note In this demo the floating point registers are not saved. - */ -struct intctx { - regx86 ebx; - regx86 edi; - regx86 esi; - regx86 ebp; - regx86 eip; -}; - -/** - * Platform dependent part of the @p Thread structure. - * This structure usually contains just the saved stack pointer defined as a - * pointer to a @p intctx structure. - */ -struct context { - struct intctx volatile *esp; -}; - -#define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a) - -/** - * Platform dependent part of the @p chThdInit() API. - * This code usually setup the context switching frame represented by a - * @p intctx structure. - */ -#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \ - uint8_t *esp = (uint8_t *)workspace + wsize; \ - APUSH(esp, arg); \ - APUSH(esp, threadexit); \ - esp -= sizeof(struct intctx); \ - ((struct intctx *)esp)->eip = pf; \ - ((struct intctx *)esp)->ebx = 0; \ - ((struct intctx *)esp)->edi = 0; \ - ((struct intctx *)esp)->esi = 0; \ - ((struct intctx *)esp)->ebp = 0; \ - tp->p_ctx.esp = (struct intctx *)esp; \ -} - -/** - * Stack size for the system idle thread. - */ -#ifndef IDLE_THREAD_STACK_SIZE -#define IDLE_THREAD_STACK_SIZE 256 -#endif - -/** - * Per-thread stack overhead for interrupts servicing, it is used in the - * calculation of the correct working area size. - * It requires stack space because the simulated "interrupt handlers" invoke - * Win32 APIs inside so it better have a lot of space. - */ -#ifndef INT_REQUIRED_STACK -#define INT_REQUIRED_STACK 16384 -#endif - -/** - * Enforces a correct alignment for a stack area size value. - */ -#define STACK_ALIGN(n) ((((n) - 1) | (sizeof(stkalign_t) - 1)) + 1) - - /** - * Computes the thread working area global size. - */ -#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \ - sizeof(void *) * 2 + \ - sizeof(struct intctx) + \ - sizeof(struct extctx) + \ - (n) + (INT_REQUIRED_STACK)) - -/** - * Macro used to allocate a thread working area aligned as both position and - * size. - */ -#define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)]; - -/** - * IRQ prologue code, inserted at the start of all IRQ handlers enabled to - * invoke system APIs. - */ -#define PORT_IRQ_PROLOGUE() - -/** - * IRQ epilogue code, inserted at the end of all IRQ handlers enabled to - * invoke system APIs. - */ -#define PORT_IRQ_EPILOGUE() - -/** - * IRQ handler function declaration. - */ -#define PORT_IRQ_HANDLER(id) void id(void) - -/** - * Simulator initialization. - */ -#define port_init() InitCore() - -/** - * Does nothing in this simulator. - */ -#define port_lock() - -/** - * Does nothing in this simulator. - */ -#define port_unlock() - -/** - * Does nothing in this simulator. - */ -#define port_lock_from_isr() - -/** - * Does nothing in this simulator. - */ -#define port_unlock_from_isr() - -/** - * Does nothing in this simulator. - */ -#define port_disable() - -/** - * Does nothing in this simulator. - */ -#define port_suspend() - -/** - * Does nothing in this simulator. - */ -#define port_enable() - -/** - * In the simulator this does a polling pass on the simulated interrupt - * sources. - */ -#define port_wait_for_interrupt() ChkIntSources() - -#ifdef __cplusplus -extern "C" { -#endif - __attribute__((fastcall)) void port_switch(Thread *otp, Thread *ntp); - __attribute__((fastcall)) void port_halt(void); - void InitCore(void); - void ChkIntSources(void); - void threadexit(void); -#ifdef __cplusplus -} -#endif - -#endif /* _CHCORE_H_ */ - -/** @} */ diff --git a/demos/Win32-MinGW/chtypes.h b/demos/Win32-MinGW/chtypes.h deleted file mode 100644 index 354da269e..000000000 --- a/demos/Win32-MinGW/chtypes.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef _CHTYPES_H_ -#define _CHTYPES_H_ - -#define __need_NULL -#define __need_size_t -#define __need_ptrdiff_t -#include - -#if !defined(_STDINT_H) && !defined(__STDINT_H_) -#include -#endif - -typedef int8_t bool_t; -typedef uint8_t tmode_t; -typedef uint8_t tstate_t; -typedef uint32_t tprio_t; -typedef int32_t msg_t; -typedef int32_t eventid_t; -typedef uint32_t eventmask_t; -typedef uint32_t systime_t; -typedef int32_t cnt_t; - -#define INLINE inline -#define PACK_STRUCT_STRUCT __attribute__((packed)) -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_END - -#endif /* _CHTYPES_H_ */ diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h new file mode 100644 index 000000000..a3d17a3c9 --- /dev/null +++ b/demos/Win32-MinGW/halconf.h @@ -0,0 +1,96 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file templates/halconf.h + * @brief HAL configuration header. + * @addtogroup HAL_CONF + * @{ + */ + +/* + * HAL configuration file, this file allows to enable or disable the various + * device drivers from your application. You may also use this file in order + * to change the device drivers settings found in the low level drivers + * headers, just define here the new settings and those will override the + * defaults defined in the LLD headers. + */ + +#ifndef _HALCONF_H_ +#define _HALCONF_H_ + +/** + * @brief Enables the PAL subsystem. + */ +#if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__) +#define CH_HAL_USE_PAL FALSE +#endif + +/** + * @brief Enables the ADC subsystem. + */ +#if !defined(CH_HAL_USE_ADC) || defined(__DOXYGEN__) +#define CH_HAL_USE_ADC FALSE +#endif + +/** + * @brief Enables the CAN subsystem. + */ +#if !defined(CH_HAL_USE_CAN) || defined(__DOXYGEN__) +#define CH_HAL_USE_CAN FALSE +#endif + +/** + * @brief Enables the MAC subsystem. + */ +#if !defined(CH_HAL_USE_MAC) || defined(__DOXYGEN__) +#define CH_HAL_USE_MAC FALSE +#endif + +/** + * @brief Enables the PWM subsystem. + */ +#if !defined(CH_HAL_USE_PWM) || defined(__DOXYGEN__) +#define CH_HAL_USE_PWM FALSE +#endif + +/** + * @brief Enables the SERIAL subsystem. + */ +#if !defined(CH_HAL_USE_SERIAL) || defined(__DOXYGEN__) +#define CH_HAL_USE_SERIAL TRUE +#endif + +/** + * @brief Enables the SPI subsystem. + */ +#if !defined(CH_HAL_USE_SPI) || defined(__DOXYGEN__) +#define CH_HAL_USE_SPI FALSE +#endif + +/** + * @brief Enables the MMC_SPI subsystem. + */ +#if !defined(CH_HAL_USE_MMC_SPI) || defined(__DOXYGEN__) +#define CH_HAL_USE_MMC_SPI FALSE +#endif + +#endif /* _HALCONF_H_ */ + +/** @} */ diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 7f081c023..2b0c5ea15 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -290,7 +290,14 @@ static evhandler_t fhandlers[2] = { int main(void) { EventListener c1fel, c2fel; - // Startup ChibiOS/RT. + /* + * HAL initialization. + */ + halInit(); + + /* + * ChibiOS/RT initialization. + */ chSysInit(); sdStart(&SD1, NULL); -- cgit v1.2.3 From 2441aa72104fb7c01505947d8b774a182e84e83d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 9 Dec 2009 21:29:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1409 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index cef71f8c5..ddd00b0f8 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -277,7 +277,7 @@ * * @note The default is @p TRUE. */ -#if !defined(CH_USE_HEAP) || defined(__DOXYGEN__) +#if !defined(CH_USE_MEMCORE) || defined(__DOXYGEN__) #define CH_USE_MEMCORE TRUE #endif -- cgit v1.2.3 From dea70dbc797e0936c2532ae55881437e06e169fa Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 10 Dec 2009 15:44:55 +0000 Subject: Added a small generic command line shell. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1411 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 3 +- demos/Win32-MinGW/main.c | 316 ++++++++++++++------------------------------- 2 files changed, 96 insertions(+), 223 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index e690b7804..76362dec1 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -21,7 +21,7 @@ CC = $(TRGT)gcc AS = $(TRGT)gcc -x assembler-with-cpp # List all default C defines here, like -D_DEBUG=1 -DDEFS = +DDEFS = -DSHELL_USE_IPRINTF=FALSE # List all default ASM defines here, like -D_DEBUG=1 DADEFS = @@ -69,6 +69,7 @@ SRC = ${PORTSRC} \ ${TESTSRC} \ ${HALSRC} \ ${PLATFORMSRC} \ + ${CHIBIOS}/os/various/shell.c \ main.c # List ASM source files here diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 2b0c5ea15..c2ead083e 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -17,53 +17,36 @@ along with this program. If not, see . */ -#include -#include - #include "ch.h" #include "hal.h" +#include "test.h" +#include "shell.h" -static uint32_t wdguard; -static WORKING_AREA(wdarea, 2048); - -static uint32_t cdguard; -static WORKING_AREA(cdarea, 2048); -static Thread *cdtp; - -static msg_t WatchdogThread(void *arg); -static msg_t ConsoleThread(void *arg); - -msg_t TestThread(void *p); +#define SHELL_WA_SIZE THD_WA_SIZE(4096) +#define CONSOLE_WA_SIZE THD_WA_SIZE(4096) #define cprint(msg) chMsgSend(cdtp, (msg_t)msg) -/* - * Watchdog thread, it checks magic values located under the various stack - * areas. The system is halted if something is wrong. - */ -static msg_t WatchdogThread(void *arg) { +static Thread *cdtp; +static Thread *shelltp1; +static Thread *shelltp2; - (void)arg; - wdguard = 0xA51F2E3D; - cdguard = 0xA51F2E3D; - while (TRUE) { - if ((wdguard != 0xA51F2E3D) || - (cdguard != 0xA51F2E3D)) { - printf("Halted by watchdog"); - fflush(stdout); - chSysHalt(); - } - chThdSleep(50); - } - return 0; -} +static const ShellConfig shell_cfg1 = { + (BaseChannel *)&SD1, + NULL +}; + +static const ShellConfig shell_cfg2 = { + (BaseChannel *)&SD2, + NULL +}; /* * Console print server done using synchronous messages. This makes the access * to the C printf() thread safe and the print operation atomic among threads. * In this example the message is the zero termitated string itself. */ -static msg_t ConsoleThread(void *arg) { +static msg_t console_thread(void *arg) { (void)arg; while (!chThdShouldTerminate()) { @@ -74,221 +57,87 @@ static msg_t ConsoleThread(void *arg) { return 0; } -static void PrintLineSD(SerialDriver *sd, char *msg) { - - while (*msg) - sdPut(sd, *msg++); -} - -static bool_t GetLineFDD(SerialDriver *sd, char *line, int size) { - char *p = line; - - while (TRUE) { - short c = chIQGet(&sd->d2.iqueue); - if (c < 0) - return TRUE; - if (c == 4) { - PrintLineSD(sd, "^D\r\n"); - return TRUE; - } - if (c == 8) { - if (p != line) { - sdPut(sd, (uint8_t)c); - sdPut(sd, 0x20); - sdPut(sd, (uint8_t)c); - p--; - } - continue; - } - if (c == '\r') { - PrintLineSD(sd, "\r\n"); - *p = 0; - return FALSE; - } - if (c < 0x20) - continue; - if (p < line + size - 1) { - sdPut(sd, (uint8_t)c); - *p++ = (uint8_t)c; - } - } -} - -/* - * Example thread, not much to see here. It simulates the CTRL-C but there - * are no real signals involved. +/** + * @brief Shell termination handler. + * + * @param[in] id event id. */ -static msg_t HelloWorldThread(void *arg) { - int i; - short c; - SerialDriver *sd = (SerialDriver *)arg; - - for (i = 0; i < 10; i++) { +static void termination_handler(eventid_t id) { - PrintLineSD(sd, "Hello World\r\n"); - c = sdGetTimeout(sd, 333); - switch (c) { - case Q_TIMEOUT: - continue; - case Q_RESET: - return 1; - case 3: - PrintLineSD(sd, "^C\r\n"); - return 0; - default: - chThdSleep(333); - } + (void)id; + if (shelltp1 && chThdTerminated(shelltp1)) { + chThdWait(shelltp1); + shelltp1 = NULL; + cprint("Init: shell on SD1 terminated\n"); + chSysLock(); + chOQResetI(&SD1.d2.oqueue); + chSysUnlock(); } - return 0; -} - -static bool_t checkend(SerialDriver *sd) { - - char * lp = strtok(NULL, " \009"); /* It is not thread safe but this is a demo.*/ - if (lp) { - PrintLineSD(sd, lp); - PrintLineSD(sd, " ?\r\n"); - return TRUE; + if (shelltp2 && chThdTerminated(shelltp2)) { + chThdWait(shelltp2); + shelltp2 = NULL; + cprint("Init: shell on SD2 terminated\n"); + chSysLock(); + chOQResetI(&SD2.d2.oqueue); + chSysUnlock(); } - return FALSE; } -/* - * Simple command shell thread, the argument is the serial line for the - * standard input and output. It recognizes few simple commands. +/** + * @brief SD1 status change handler. + * + * @param[in] id event id. */ -static msg_t ShellThread(void *arg) { - SerialDriver *sd = (SerialDriver *)arg; - char *lp, line[64]; - Thread *tp; - WORKING_AREA(tarea, 2048); - - chSysLock(); - chIQResetI(&sd->d2.iqueue); - chOQResetI(&sd->d2.oqueue); - chSysUnlock(); - PrintLineSD(sd, "ChibiOS/RT Command Shell\r\n\n"); - while (TRUE) { - PrintLineSD(sd, "ch> "); - if (GetLineFDD(sd, line, sizeof(line))) { - PrintLineSD(sd, "\nlogout"); - break; - } - lp = strtok(line, " \009"); // Note: not thread safe but it is just a demo. - if (lp) { - if ((stricmp(lp, "help") == 0) || - (stricmp(lp, "h") == 0) || - (stricmp(lp, "?") == 0)) { - if (checkend(sd)) - continue; - PrintLineSD(sd, "Commands:\r\n"); - PrintLineSD(sd, " help,h,? - This help\r\n"); - PrintLineSD(sd, " exit - Logout from ChibiOS/RT\r\n"); - PrintLineSD(sd, " time - Prints the system timer value\r\n"); - PrintLineSD(sd, " hello - Runs the Hello World demo thread\r\n"); - PrintLineSD(sd, " test - Runs the System Test thread\r\n"); - } - else if (stricmp(lp, "exit") == 0) { - if (checkend(sd)) - continue; - PrintLineSD(sd, "\nlogout"); - break; - } - else if (stricmp(lp, "time") == 0) { - if (checkend(sd)) - continue; - sprintf(line, "Time: %d\r\n", chTimeNow()); - PrintLineSD(sd, line); - } - else if (stricmp(lp, "hello") == 0) { - if (checkend(sd)) - continue; - tp = chThdCreateStatic(tarea, sizeof(tarea), - NORMALPRIO, HelloWorldThread, sd); - if (chThdWait(tp)) - break; // Lost connection while executing the hello thread. - } - else if (stricmp(lp, "test") == 0) { - if (checkend(sd)) - continue; - tp = chThdCreateStatic(tarea, sizeof(tarea), - NORMALPRIO, TestThread, arg); - if (chThdWait(tp)) - break; // Lost connection while executing the hello thread. - } - else { - PrintLineSD(sd, lp); - PrintLineSD(sd, " ?\r\n"); - } - } - } - return 0; -} - -static WORKING_AREA(s1area, 4096); -static Thread *s1; -EventListener s1tel; - -static void COM1Handler(eventid_t id) { +static void sd1_handler(eventid_t id) { sdflags_t flags; (void)id; - if (s1 && chThdTerminated(s1)) { - s1 = NULL; - cprint("Init: disconnection on SD1\n"); - } flags = sdGetAndClearFlags(&SD1); - if ((flags & SD_CONNECTED) && (s1 == NULL)) { + if ((flags & SD_CONNECTED) && (shelltp1 == NULL)) { cprint("Init: connection on SD1\n"); - s1 = chThdInit(s1area, sizeof(s1area), - NORMALPRIO, ShellThread, &SD1); - chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0); - chThdResume(s1); + shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO + 1); } - if ((flags & SD_DISCONNECTED) && (s1 != NULL)) { + if (flags & SD_DISCONNECTED) { + cprint("Init: disconnection on SD1\n"); chSysLock(); chIQResetI(&SD1.d2.iqueue); chSysUnlock(); } } -static WORKING_AREA(s2area, 4096); -static Thread *s2; -EventListener s2tel; - -static void COM2Handler(eventid_t id) { +/** + * @brief SD2 status change handler. + * + * @param[in] id event id. + */ +static void sd2_handler(eventid_t id) { sdflags_t flags; (void)id; - if (s2 && chThdTerminated(s2)) { - s2 = NULL; - cprint("Init: disconnection on SD2\n"); - } flags = sdGetAndClearFlags(&SD2); - if ((flags & SD_CONNECTED) && (s2 == NULL)) { + if ((flags & SD_CONNECTED) && (shelltp2 == NULL)) { cprint("Init: connection on SD2\n"); - s2 = chThdInit(s2area, sizeof(s1area), - NORMALPRIO, ShellThread, &SD2); - chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1); - chThdResume(s2); + shelltp2 = shellCreate(&shell_cfg2, SHELL_WA_SIZE, NORMALPRIO + 10); } - if ((flags & SD_DISCONNECTED) && (s2 != NULL)) { + if (flags & SD_DISCONNECTED) { + cprint("Init: disconnection on SD2\n"); chSysLock(); chIQResetI(&SD2.d2.iqueue); chSysUnlock(); } } -static evhandler_t fhandlers[2] = { - COM1Handler, - COM2Handler +static evhandler_t fhandlers[] = { + termination_handler, + sd1_handler, + sd2_handler }; /*------------------------------------------------------------------------* - * Simulator main, start here your threads, examples inside. * + * Simulator main. * *------------------------------------------------------------------------*/ int main(void) { - EventListener c1fel, c2fel; + EventListener sd1fel, sd2fel, tel; /* * HAL initialization. @@ -300,22 +149,45 @@ int main(void) { */ chSysInit(); + /* + * Serial ports (simulated) initialization. + */ sdStart(&SD1, NULL); sdStart(&SD2, NULL); - chThdCreateStatic(wdarea, sizeof(wdarea), NORMALPRIO + 2, WatchdogThread, NULL); - cdtp = chThdCreateStatic(cdarea, sizeof(cdarea), NORMALPRIO + 1, ConsoleThread, NULL); + /* + * Shell manager initialization. + */ + shellInit(); + chEvtRegister(&shell_terminated, &tel, 0); + + /* + * Console thread started. + */ + cdtp = chThdCreateFromHeap(NULL, CONSOLE_WA_SIZE, NORMALPRIO + 1, + console_thread, NULL); - cprint("Console service started on SD1, SD2\n"); + /* + * Initializing connection/disconnection events. + */ + cprint("Shell service started on SD1, SD2\n"); cprint(" - Listening for connections on SD1\n"); - sdGetAndClearFlags(&SD1); - chEvtRegister(&SD1.d2.sevent, &c1fel, 0); + (void) sdGetAndClearFlags(&SD1); + chEvtRegister(&SD1.d2.sevent, &sd1fel, 1); cprint(" - Listening for connections on SD2\n"); - sdGetAndClearFlags(&SD2); - chEvtRegister(&SD2.d2.sevent, &c2fel, 1); + (void) sdGetAndClearFlags(&SD2); + chEvtRegister(&SD2.d2.sevent, &sd2fel, 2); + + /* + * Events servicing loop. + */ while (!chThdShouldTerminate()) chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS)); - chEvtUnregister(&SD1.d2.sevent, &c2fel); // Never invoked but this is an example... - chEvtUnregister(&SD2.d2.sevent, &c1fel); // Never invoked but this is an example... + + /* + * Clean simulator exit. + */ + chEvtUnregister(&SD1.d2.sevent, &sd1fel); + chEvtUnregister(&SD2.d2.sevent, &sd2fel); return 0; } -- cgit v1.2.3 From 4bb9e7735d4a84e6ddee2b5778906e6cd54db577 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 10 Dec 2009 21:05:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1412 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 2 +- demos/Win32-MinGW/main.c | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index ddd00b0f8..34575541a 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -80,7 +80,7 @@ * @note Requires @p CH_USE_COREMEM. */ #if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__) -#define CH_MEMCORE_SIZE 0x20000 +#define CH_MEMCORE_SIZE 0x40000 #endif /*===========================================================================*/ diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index c2ead083e..22ea086c3 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -24,6 +24,7 @@ #define SHELL_WA_SIZE THD_WA_SIZE(4096) #define CONSOLE_WA_SIZE THD_WA_SIZE(4096) +#define TEST_WA_SIZE THD_WA_SIZE(4096) #define cprint(msg) chMsgSend(cdtp, (msg_t)msg) @@ -31,14 +32,33 @@ static Thread *cdtp; static Thread *shelltp1; static Thread *shelltp2; +void cmd_test(BaseChannel *chp, int argc, char *argv[]) { + Thread *tp; + + (void)argv; + if (argc > 0) { + shellPrintLine(chp, "Usage: test"); + return; + } + tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(), + TestThread, chp); + chThdWait(tp); +// TestThread(chp); +} + +static const ShellCommand commands[] = { + {"test", cmd_test}, + {NULL, NULL} +}; + static const ShellConfig shell_cfg1 = { (BaseChannel *)&SD1, - NULL + commands }; static const ShellConfig shell_cfg2 = { (BaseChannel *)&SD2, - NULL + commands }; /* -- cgit v1.2.3 From d980d7e3e434af2cd17ee2b04deaab65164204ce Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 10 Dec 2009 22:26:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1413 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 6 +----- demos/Win32-MinGW/main.c | 5 ++++- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 34575541a..2c3a29a30 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -80,7 +80,7 @@ * @note Requires @p CH_USE_COREMEM. */ #if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__) -#define CH_MEMCORE_SIZE 0x40000 +#define CH_MEMCORE_SIZE 0x20000 #endif /*===========================================================================*/ @@ -419,8 +419,6 @@ #define THREAD_EXT_FIELDS \ struct { \ /* Add threads custom fields here.*/ \ - /* The thread termination \p EventSource.*/ \ - EventSource p_exitesource; \ }; #endif @@ -434,7 +432,6 @@ struct { \ #if !defined(THREAD_EXT_INIT) || defined(__DOXYGEN__) #define THREAD_EXT_INIT(tp) { \ /* Add threads initialization code here.*/ \ - chEvtInit(&tp->p_exitesource); \ } #endif @@ -449,7 +446,6 @@ struct { \ #if !defined(THREAD_EXT_EXIT) || defined(__DOXYGEN__) #define THREAD_EXT_EXIT(tp) { \ /* Add threads finalization code here.*/ \ - chEvtBroadcastI(&currp->p_exitesource); \ } #endif diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 22ea086c3..140f3bd79 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -42,8 +42,11 @@ void cmd_test(BaseChannel *chp, int argc, char *argv[]) { } tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(), TestThread, chp); + if (tp == NULL) { + shellPrintLine(chp, "out of memory"); + return; + } chThdWait(tp); -// TestThread(chp); } static const ShellCommand commands[] = { -- cgit v1.2.3 From 0f8d30486bffb71cd431e67084fcc502411236b9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 11 Dec 2009 16:15:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1417 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 140f3bd79..01ca7cad9 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -91,6 +91,7 @@ static void termination_handler(eventid_t id) { if (shelltp1 && chThdTerminated(shelltp1)) { chThdWait(shelltp1); shelltp1 = NULL; + chThdSleepMilliseconds(10); cprint("Init: shell on SD1 terminated\n"); chSysLock(); chOQResetI(&SD1.d2.oqueue); @@ -99,6 +100,7 @@ static void termination_handler(eventid_t id) { if (shelltp2 && chThdTerminated(shelltp2)) { chThdWait(shelltp2); shelltp2 = NULL; + chThdSleepMilliseconds(10); cprint("Init: shell on SD2 terminated\n"); chSysLock(); chOQResetI(&SD2.d2.oqueue); -- cgit v1.2.3 From 5d22110eeb4b5a9999ae259b7384a4608e725490 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 24 Dec 2009 09:57:44 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1465 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 2 +- demos/Win32-MinGW/main.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index 76362dec1..c1a452297 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -21,7 +21,7 @@ CC = $(TRGT)gcc AS = $(TRGT)gcc -x assembler-with-cpp # List all default C defines here, like -D_DEBUG=1 -DDEFS = -DSHELL_USE_IPRINTF=FALSE +DDEFS = -DSIMULATOR -DSHELL_USE_IPRINTF=FALSE # List all default ASM defines here, like -D_DEBUG=1 DADEFS = diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 01ca7cad9..009ec4a89 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -26,7 +26,7 @@ #define CONSOLE_WA_SIZE THD_WA_SIZE(4096) #define TEST_WA_SIZE THD_WA_SIZE(4096) -#define cprint(msg) chMsgSend(cdtp, (msg_t)msg) +#define cputs(msg) chMsgSend(cdtp, (msg_t)msg) static Thread *cdtp; static Thread *shelltp1; @@ -73,7 +73,7 @@ static msg_t console_thread(void *arg) { (void)arg; while (!chThdShouldTerminate()) { - printf((char *)chMsgWait()); + puts((char *)chMsgWait()); fflush(stdout); chMsgRelease(RDY_OK); } @@ -92,7 +92,7 @@ static void termination_handler(eventid_t id) { chThdWait(shelltp1); shelltp1 = NULL; chThdSleepMilliseconds(10); - cprint("Init: shell on SD1 terminated\n"); + cputs("Init: shell on SD1 terminated"); chSysLock(); chOQResetI(&SD1.d2.oqueue); chSysUnlock(); @@ -101,7 +101,7 @@ static void termination_handler(eventid_t id) { chThdWait(shelltp2); shelltp2 = NULL; chThdSleepMilliseconds(10); - cprint("Init: shell on SD2 terminated\n"); + cputs("Init: shell on SD2 terminated"); chSysLock(); chOQResetI(&SD2.d2.oqueue); chSysUnlock(); @@ -119,11 +119,11 @@ static void sd1_handler(eventid_t id) { (void)id; flags = sdGetAndClearFlags(&SD1); if ((flags & SD_CONNECTED) && (shelltp1 == NULL)) { - cprint("Init: connection on SD1\n"); + cputs("Init: connection on SD1"); shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO + 1); } if (flags & SD_DISCONNECTED) { - cprint("Init: disconnection on SD1\n"); + cputs("Init: disconnection on SD1"); chSysLock(); chIQResetI(&SD1.d2.iqueue); chSysUnlock(); @@ -141,11 +141,11 @@ static void sd2_handler(eventid_t id) { (void)id; flags = sdGetAndClearFlags(&SD2); if ((flags & SD_CONNECTED) && (shelltp2 == NULL)) { - cprint("Init: connection on SD2\n"); + cputs("Init: connection on SD2"); shelltp2 = shellCreate(&shell_cfg2, SHELL_WA_SIZE, NORMALPRIO + 10); } if (flags & SD_DISCONNECTED) { - cprint("Init: disconnection on SD2\n"); + cputs("Init: disconnection on SD2"); chSysLock(); chIQResetI(&SD2.d2.iqueue); chSysUnlock(); @@ -195,11 +195,11 @@ int main(void) { /* * Initializing connection/disconnection events. */ - cprint("Shell service started on SD1, SD2\n"); - cprint(" - Listening for connections on SD1\n"); + cputs("Shell service started on SD1, SD2"); + cputs(" - Listening for connections on SD1"); (void) sdGetAndClearFlags(&SD1); chEvtRegister(&SD1.d2.sevent, &sd1fel, 1); - cprint(" - Listening for connections on SD2\n"); + cputs(" - Listening for connections on SD2"); (void) sdGetAndClearFlags(&SD2); chEvtRegister(&SD2.d2.sevent, &sd2fel, 2); -- cgit v1.2.3 From da565f622c53f2fb23c1d66332ee764e44361ea3 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 29 Dec 2009 16:22:45 +0000 Subject: New HAL configuration file ported to all demos. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1482 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 56 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 3 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index a3d17a3c9..376dfe816 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -27,14 +27,23 @@ /* * HAL configuration file, this file allows to enable or disable the various * device drivers from your application. You may also use this file in order - * to change the device drivers settings found in the low level drivers - * headers, just define here the new settings and those will override the - * defaults defined in the LLD headers. + * to override the device drivers default settings. */ #ifndef _HALCONF_H_ #define _HALCONF_H_ +/* + * Uncomment the following line in order to include a mcu-related + * settings file. This file can be used to include platform specific + * header files or to override the low level drivers settings. + */ +/*#include "mcuconf.h"*/ + +/*===========================================================================*/ +/* PAL driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the PAL subsystem. */ @@ -42,6 +51,10 @@ #define CH_HAL_USE_PAL FALSE #endif +/*===========================================================================*/ +/* ADC driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the ADC subsystem. */ @@ -49,6 +62,10 @@ #define CH_HAL_USE_ADC FALSE #endif +/*===========================================================================*/ +/* CAN driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the CAN subsystem. */ @@ -56,6 +73,10 @@ #define CH_HAL_USE_CAN FALSE #endif +/*===========================================================================*/ +/* MAC driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the MAC subsystem. */ @@ -63,6 +84,10 @@ #define CH_HAL_USE_MAC FALSE #endif +/*===========================================================================*/ +/* PWM driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the PWM subsystem. */ @@ -70,6 +95,10 @@ #define CH_HAL_USE_PWM FALSE #endif +/*===========================================================================*/ +/* SERIAL driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the SERIAL subsystem. */ @@ -77,6 +106,10 @@ #define CH_HAL_USE_SERIAL TRUE #endif +/*===========================================================================*/ +/* SPI driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the SPI subsystem. */ @@ -84,6 +117,15 @@ #define CH_HAL_USE_SPI FALSE #endif +/* + * Default SPI settings overrides (uncomment to override). + */ +/*#define SPI_USE_MUTUAL_EXCLUSION TRUE*/ + +/*===========================================================================*/ +/* MMC_SPI driver related settings. */ +/*===========================================================================*/ + /** * @brief Enables the MMC_SPI subsystem. */ @@ -91,6 +133,14 @@ #define CH_HAL_USE_MMC_SPI FALSE #endif +/* + * Default MMC_SPI settings overrides (uncomment to override). + */ +/*#define MMC_SECTOR_SIZE 512*/ +/*#define MMC_NICE_WAITING TRUE*/ +/*#define MMC_POLLING_INTERVAL 10*/ +/*#define MMC_POLLING_DELAY 10*/ + #endif /* _HALCONF_H_ */ /** @} */ -- cgit v1.2.3 From 61038954f731debcf474b097a1f7283e4cf198fc Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Jan 2010 12:41:56 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1493 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 376dfe816..c0f12c57d 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -38,7 +38,7 @@ * settings file. This file can be used to include platform specific * header files or to override the low level drivers settings. */ -/*#include "mcuconf.h"*/ +#include "mcuconf.h" /*===========================================================================*/ /* PAL driver related settings. */ @@ -48,7 +48,7 @@ * @brief Enables the PAL subsystem. */ #if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__) -#define CH_HAL_USE_PAL FALSE +#define CH_HAL_USE_PAL TRUE #endif /*===========================================================================*/ @@ -59,7 +59,7 @@ * @brief Enables the ADC subsystem. */ #if !defined(CH_HAL_USE_ADC) || defined(__DOXYGEN__) -#define CH_HAL_USE_ADC FALSE +#define CH_HAL_USE_ADC FALSE #endif /*===========================================================================*/ @@ -70,7 +70,7 @@ * @brief Enables the CAN subsystem. */ #if !defined(CH_HAL_USE_CAN) || defined(__DOXYGEN__) -#define CH_HAL_USE_CAN FALSE +#define CH_HAL_USE_CAN FALSE #endif /*===========================================================================*/ @@ -81,7 +81,7 @@ * @brief Enables the MAC subsystem. */ #if !defined(CH_HAL_USE_MAC) || defined(__DOXYGEN__) -#define CH_HAL_USE_MAC FALSE +#define CH_HAL_USE_MAC FALSE #endif /*===========================================================================*/ @@ -92,7 +92,7 @@ * @brief Enables the PWM subsystem. */ #if !defined(CH_HAL_USE_PWM) || defined(__DOXYGEN__) -#define CH_HAL_USE_PWM FALSE +#define CH_HAL_USE_PWM FALSE #endif /*===========================================================================*/ @@ -103,9 +103,15 @@ * @brief Enables the SERIAL subsystem. */ #if !defined(CH_HAL_USE_SERIAL) || defined(__DOXYGEN__) -#define CH_HAL_USE_SERIAL TRUE +#define CH_HAL_USE_SERIAL TRUE #endif +/* + * Default SERIAL settings overrides (uncomment to override). + */ +/*#define SERIAL_DEFAULT_BITRATE 38400*/ +/*#define SERIAL_BUFFERS_SIZE 64*/ + /*===========================================================================*/ /* SPI driver related settings. */ /*===========================================================================*/ @@ -114,13 +120,13 @@ * @brief Enables the SPI subsystem. */ #if !defined(CH_HAL_USE_SPI) || defined(__DOXYGEN__) -#define CH_HAL_USE_SPI FALSE +#define CH_HAL_USE_SPI FALSE #endif /* * Default SPI settings overrides (uncomment to override). */ -/*#define SPI_USE_MUTUAL_EXCLUSION TRUE*/ +/*#define SPI_USE_MUTUAL_EXCLUSION TRUE*/ /*===========================================================================*/ /* MMC_SPI driver related settings. */ @@ -130,16 +136,16 @@ * @brief Enables the MMC_SPI subsystem. */ #if !defined(CH_HAL_USE_MMC_SPI) || defined(__DOXYGEN__) -#define CH_HAL_USE_MMC_SPI FALSE +#define CH_HAL_USE_MMC_SPI FALSE #endif /* * Default MMC_SPI settings overrides (uncomment to override). */ -/*#define MMC_SECTOR_SIZE 512*/ -/*#define MMC_NICE_WAITING TRUE*/ -/*#define MMC_POLLING_INTERVAL 10*/ -/*#define MMC_POLLING_DELAY 10*/ +/*#define MMC_SECTOR_SIZE 512*/ +/*#define MMC_NICE_WAITING TRUE*/ +/*#define MMC_POLLING_INTERVAL 10*/ +/*#define MMC_POLLING_DELAY 10*/ #endif /* _HALCONF_H_ */ -- cgit v1.2.3 From 15e6fecf11e470abebe963177434f83883e63acf Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Jan 2010 13:02:43 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1494 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index c0f12c57d..58d49966f 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -48,7 +48,7 @@ * @brief Enables the PAL subsystem. */ #if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__) -#define CH_HAL_USE_PAL TRUE +#define CH_HAL_USE_PAL FALSE #endif /*===========================================================================*/ -- cgit v1.2.3 From bedb87c1e7cc9741c57c299d81d6e24c5e9c59c5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Jan 2010 13:35:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1495 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 2 +- demos/Win32-MinGW/main.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 58d49966f..f80ceafb0 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -38,7 +38,7 @@ * settings file. This file can be used to include platform specific * header files or to override the low level drivers settings. */ -#include "mcuconf.h" +/*#include "mcuconf.h"*/ /*===========================================================================*/ /* PAL driver related settings. */ diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 009ec4a89..8acfda91d 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -94,7 +94,7 @@ static void termination_handler(eventid_t id) { chThdSleepMilliseconds(10); cputs("Init: shell on SD1 terminated"); chSysLock(); - chOQResetI(&SD1.d2.oqueue); + chOQResetI(&SD1.sd.oqueue); chSysUnlock(); } if (shelltp2 && chThdTerminated(shelltp2)) { @@ -103,7 +103,7 @@ static void termination_handler(eventid_t id) { chThdSleepMilliseconds(10); cputs("Init: shell on SD2 terminated"); chSysLock(); - chOQResetI(&SD2.d2.oqueue); + chOQResetI(&SD2.sd.oqueue); chSysUnlock(); } } @@ -125,7 +125,7 @@ static void sd1_handler(eventid_t id) { if (flags & SD_DISCONNECTED) { cputs("Init: disconnection on SD1"); chSysLock(); - chIQResetI(&SD1.d2.iqueue); + chIQResetI(&SD1.sd.iqueue); chSysUnlock(); } } @@ -147,7 +147,7 @@ static void sd2_handler(eventid_t id) { if (flags & SD_DISCONNECTED) { cputs("Init: disconnection on SD2"); chSysLock(); - chIQResetI(&SD2.d2.iqueue); + chIQResetI(&SD2.sd.iqueue); chSysUnlock(); } } @@ -198,10 +198,10 @@ int main(void) { cputs("Shell service started on SD1, SD2"); cputs(" - Listening for connections on SD1"); (void) sdGetAndClearFlags(&SD1); - chEvtRegister(&SD1.d2.sevent, &sd1fel, 1); + chEvtRegister(&SD1.sd.sevent, &sd1fel, 1); cputs(" - Listening for connections on SD2"); (void) sdGetAndClearFlags(&SD2); - chEvtRegister(&SD2.d2.sevent, &sd2fel, 2); + chEvtRegister(&SD2.sd.sevent, &sd2fel, 2); /* * Events servicing loop. @@ -212,7 +212,7 @@ int main(void) { /* * Clean simulator exit. */ - chEvtUnregister(&SD1.d2.sevent, &sd1fel); - chEvtUnregister(&SD2.d2.sevent, &sd2fel); + chEvtUnregister(&SD1.sd.sevent, &sd1fel); + chEvtUnregister(&SD2.sd.sevent, &sd2fel); return 0; } -- cgit v1.2.3 From 11215c3bcb0b0cbe5794cfc92d0c20de6c8696d9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 22 Jan 2010 14:51:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1539 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 8acfda91d..11123bffb 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -94,7 +94,7 @@ static void termination_handler(eventid_t id) { chThdSleepMilliseconds(10); cputs("Init: shell on SD1 terminated"); chSysLock(); - chOQResetI(&SD1.sd.oqueue); + chOQResetI(&SD1.oqueue); chSysUnlock(); } if (shelltp2 && chThdTerminated(shelltp2)) { @@ -103,7 +103,7 @@ static void termination_handler(eventid_t id) { chThdSleepMilliseconds(10); cputs("Init: shell on SD2 terminated"); chSysLock(); - chOQResetI(&SD2.sd.oqueue); + chOQResetI(&SD2.oqueue); chSysUnlock(); } } @@ -125,7 +125,7 @@ static void sd1_handler(eventid_t id) { if (flags & SD_DISCONNECTED) { cputs("Init: disconnection on SD1"); chSysLock(); - chIQResetI(&SD1.sd.iqueue); + chIQResetI(&SD1.iqueue); chSysUnlock(); } } @@ -147,7 +147,7 @@ static void sd2_handler(eventid_t id) { if (flags & SD_DISCONNECTED) { cputs("Init: disconnection on SD2"); chSysLock(); - chIQResetI(&SD2.sd.iqueue); + chIQResetI(&SD2.iqueue); chSysUnlock(); } } @@ -198,10 +198,10 @@ int main(void) { cputs("Shell service started on SD1, SD2"); cputs(" - Listening for connections on SD1"); (void) sdGetAndClearFlags(&SD1); - chEvtRegister(&SD1.sd.sevent, &sd1fel, 1); + chEvtRegister(&SD1.sevent, &sd1fel, 1); cputs(" - Listening for connections on SD2"); (void) sdGetAndClearFlags(&SD2); - chEvtRegister(&SD2.sd.sevent, &sd2fel, 2); + chEvtRegister(&SD2.sevent, &sd2fel, 2); /* * Events servicing loop. @@ -212,7 +212,7 @@ int main(void) { /* * Clean simulator exit. */ - chEvtUnregister(&SD1.sd.sevent, &sd1fel); - chEvtUnregister(&SD2.sd.sevent, &sd2fel); + chEvtUnregister(&SD1.sevent, &sd1fel); + chEvtUnregister(&SD2.sevent, &sd2fel); return 0; } -- cgit v1.2.3 From e32275f84af6e07cbe737262ce90c75f69b9a1c1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 3 Feb 2010 09:37:33 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1563 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 2c3a29a30..8767ba170 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -123,6 +123,16 @@ /* Subsystem options. */ /*===========================================================================*/ +/** + * @brief Threads registry APIs. + * @details If enabled then the registry APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_USE_REGISTRY) || defined(__DOXYGEN__) +#define CH_USE_REGISTRY TRUE +#endif + /** * @brief Threads synchronization APIs. * @details If enabled then the @p chThdWait() function is included in -- cgit v1.2.3 From 217d1529c1a126054fbdb9e071cd103194fd499e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 3 Feb 2010 18:40:10 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1564 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 11123bffb..b43ad24db 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -32,7 +32,60 @@ static Thread *cdtp; static Thread *shelltp1; static Thread *shelltp2; -void cmd_test(BaseChannel *chp, int argc, char *argv[]) { +static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) { + size_t n, size; + char buf[52]; + + (void)argv; + if (argc > 0) { + shellPrintLine(chp, "Usage: mem"); + return; + } + n = chHeapStatus(NULL, &size); + sprintf(buf, "core free memory : %i bytes", chCoreFree()); + shellPrintLine(chp, buf); + sprintf(buf, "heap fragments : %i", n); + shellPrintLine(chp, buf); + sprintf(buf, "heap free total : %i bytes", size); + shellPrintLine(chp, buf); +} + +static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { + static const char *states[] = { + "READY", + "CURRENT", + "SUSPENDED", + "WTSEM", + "WTMTX", + "WTCOND", + "SLEEPING", + "WTEXIT", + "WTOREVT", + "WTANDEVT", + "SNDMSG", + "WTMSG", + "FINAL" + }; + Thread *tp; + char buf[60]; + + (void)argv; + if (argc > 0) { + shellPrintLine(chp, "Usage: threads"); + return; + } + shellPrintLine(chp, " addr stack prio refs state time"); + tp = chRegFirstThread(); + do { + sprintf(buf, "%8p %8p %4i %4i %9s %i", + tp, tp->p_ctx.esp, tp->p_prio, tp->p_refs - 1, + states[tp->p_state], tp->p_time); + shellPrintLine(chp, buf); + tp = chRegNextThread(tp); + } while (tp != NULL); +} + +static void cmd_test(BaseChannel *chp, int argc, char *argv[]) { Thread *tp; (void)argv; @@ -50,6 +103,8 @@ void cmd_test(BaseChannel *chp, int argc, char *argv[]) { } static const ShellCommand commands[] = { + {"mem", cmd_mem}, + {"threads", cmd_threads}, {"test", cmd_test}, {NULL, NULL} }; -- cgit v1.2.3 From 157b6f9695e7f72f2d54b231c19cb4045710ed01 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 21 Feb 2010 07:24:53 +0000 Subject: Updated license dates. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1646 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/board.h | 2 +- demos/Win32-MinGW/chconf.h | 4 ++-- demos/Win32-MinGW/halconf.h | 10 +++++----- demos/Win32-MinGW/main.c | 18 +++++++++--------- 4 files changed, 17 insertions(+), 17 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/board.h b/demos/Win32-MinGW/board.h index a6e056d58..7b89d92d0 100644 --- a/demos/Win32-MinGW/board.h +++ b/demos/Win32-MinGW/board.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 8767ba170..2f45fb0f3 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -396,7 +396,7 @@ * @brief Debug option, stacks initialization. * @details If enabled then the threads working area is filled with a byte * value when a thread is created. This can be useful for the - * runtime measurement of the used stack. + * runtime measurement of the used stack. * * @note The default is @p FALSE. */ diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index f80ceafb0..40264527c 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -27,7 +27,7 @@ /* * HAL configuration file, this file allows to enable or disable the various * device drivers from your application. You may also use this file in order - * to override the device drivers default settings. + * to override the device drivers default settings. */ #ifndef _HALCONF_H_ @@ -36,7 +36,7 @@ /* * Uncomment the following line in order to include a mcu-related * settings file. This file can be used to include platform specific - * header files or to override the low level drivers settings. + * header files or to override the low level drivers settings. */ /*#include "mcuconf.h"*/ @@ -45,7 +45,7 @@ /*===========================================================================*/ /** - * @brief Enables the PAL subsystem. + * @brief Enables the PAL subsystem. */ #if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__) #define CH_HAL_USE_PAL FALSE @@ -124,7 +124,7 @@ #endif /* - * Default SPI settings overrides (uncomment to override). + * Default SPI settings overrides (uncomment to override). */ /*#define SPI_USE_MUTUAL_EXCLUSION TRUE*/ diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index b43ad24db..1418b70ec 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -137,8 +137,8 @@ static msg_t console_thread(void *arg) { /** * @brief Shell termination handler. - * - * @param[in] id event id. + * + * @param[in] id event id. */ static void termination_handler(eventid_t id) { @@ -230,25 +230,25 @@ int main(void) { chSysInit(); /* - * Serial ports (simulated) initialization. + * Serial ports (simulated) initialization. */ sdStart(&SD1, NULL); sdStart(&SD2, NULL); /* - * Shell manager initialization. + * Shell manager initialization. */ shellInit(); chEvtRegister(&shell_terminated, &tel, 0); /* - * Console thread started. + * Console thread started. */ cdtp = chThdCreateFromHeap(NULL, CONSOLE_WA_SIZE, NORMALPRIO + 1, console_thread, NULL); /* - * Initializing connection/disconnection events. + * Initializing connection/disconnection events. */ cputs("Shell service started on SD1, SD2"); cputs(" - Listening for connections on SD1"); @@ -259,13 +259,13 @@ int main(void) { chEvtRegister(&SD2.sevent, &sd2fel, 2); /* - * Events servicing loop. + * Events servicing loop. */ while (!chThdShouldTerminate()) chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS)); /* - * Clean simulator exit. + * Clean simulator exit. */ chEvtUnregister(&SD1.sevent, &sd1fel); chEvtUnregister(&SD2.sevent, &sd2fel); -- cgit v1.2.3 From 1c03b33539fac79a32ac10db444a1b0a7af0d65f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 21 Feb 2010 11:14:39 +0000 Subject: Simulator PAL driver. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1649 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 40264527c..b325b7238 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -48,7 +48,7 @@ * @brief Enables the PAL subsystem. */ #if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__) -#define CH_HAL_USE_PAL FALSE +#define CH_HAL_USE_PAL TRUE #endif /*===========================================================================*/ -- cgit v1.2.3 From 79075f9e81d9d56be5da3bf6cdae56f4ace950de Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 19 Mar 2010 12:48:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1755 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 215 +++++++++++++++++++++++---------------------- 1 file changed, 112 insertions(+), 103 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 2f45fb0f3..dd249746f 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -18,9 +18,13 @@ */ /** - * @file templates/chconf.h - * @brief Configuration file template. + * @file templates/chconf.h + * @brief Configuration file template. + * @details A copy of this file must be placed in each project directory, it + * contains the application specific kernel settings. + * * @addtogroup config + * @details Kernel related settings and hooks. * @{ */ @@ -32,7 +36,7 @@ /*===========================================================================*/ /** - * @brief System tick frequency. + * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ @@ -41,20 +45,22 @@ #endif /** - * @brief Round robin interval. + * @brief Round robin interval. * @details This constant is the number of system ticks allowed for the * threads before preemption occurs. Setting this value to zero - * disables the round robin mechanism. + * disables the preemption for threads with equal priority and the + * round robin becomes cooperative. Note that higher priority + * threads can still preempt, the kernel is always preemptive. * - * @note Disabling round robin makes the kernel more compact and generally - * faster but forbids multiple threads at the same priority level. + * @note Disabling the round robin preemption makes the kernel more compact + * and generally faster. */ #if !defined(CH_TIME_QUANTUM) || defined(__DOXYGEN__) #define CH_TIME_QUANTUM 20 #endif /** - * @brief Nested locks. + * @brief Nested locks. * @details If enabled then the use of nested @p chSysLock() / @p chSysUnlock() * operations is allowed.
* For performance and code size reasons the recommended setting @@ -62,22 +68,22 @@ * You may use this option if you need to merge ChibiOS/RT with * external libraries that require nested lock/unlock operations. * - * @note The default is @p FALSE. + * @note T he default is @p FALSE. */ #if !defined(CH_USE_NESTED_LOCKS) || defined(__DOXYGEN__) #define CH_USE_NESTED_LOCKS FALSE #endif /** - * @brief Managed RAM size. + * @brief Managed RAM size. * @details Size of the RAM area to be managed by the OS. If set to zero * then the whole available RAM is used. The core memory is made * available to the heap allocator and/or can be used directly through * the simplified core memory allocator. * - * @note In order to let the OS manage the whole RAM the linker script must - * provide the @p __heap_base__ and @p __heap_end__ symbols. - * @note Requires @p CH_USE_COREMEM. + * @note In order to let the OS manage the whole RAM the linker script must + * provide the @p __heap_base__ and @p __heap_end__ symbols. + * @note Requires @p CH_USE_COREMEM. */ #if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__) #define CH_MEMCORE_SIZE 0x20000 @@ -88,32 +94,32 @@ /*===========================================================================*/ /** - * @brief OS optimization. + * @brief OS optimization. * @details If enabled then time efficient rather than space efficient code * is used when two possible implementations exist. * - * @note This is not related to the compiler optimization options. - * @note The default is @p TRUE. + * @note This is not related to the compiler optimization options. + * @note The default is @p TRUE. */ #if !defined(CH_OPTIMIZE_SPEED) || defined(__DOXYGEN__) #define CH_OPTIMIZE_SPEED TRUE #endif /** - * @brief Exotic optimization. + * @brief Exotic optimization. * @details If defined then a CPU register is used as storage for the global * @p currp variable. Caching this variable in a register greatly * improves both space and time OS efficiency. A side effect is that * one less register has to be saved during the context switch * resulting in lower RAM usage and faster context switch. * - * @note This option is only usable with the GCC compiler and is only useful - * on processors with many registers like ARM cores. - * @note If this option is enabled then ALL the libraries linked to the - * ChibiOS/RT code must be recompiled with the GCC option @p - * -ffixed-@. - * @note This option must be enabled in the Makefile, it is listed here for - * documentation only. + * @note This option is only usable with the GCC compiler and is only useful + * on processors with many registers like ARM cores. + * @note If this option is enabled then ALL the libraries linked to the + * ChibiOS/RT code must be recompiled with the GCC option @p + * -ffixed-@. + * @note This option must be enabled in the Makefile, it is listed here for + * documentation only. */ #if defined(__DOXYGEN__) #define CH_CURRP_REGISTER_CACHE "reg" @@ -124,219 +130,220 @@ /*===========================================================================*/ /** - * @brief Threads registry APIs. + * @brief Threads registry APIs. * @details If enabled then the registry APIs are included in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_REGISTRY) || defined(__DOXYGEN__) #define CH_USE_REGISTRY TRUE #endif /** - * @brief Threads synchronization APIs. + * @brief Threads synchronization APIs. * @details If enabled then the @p chThdWait() function is included in * the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_WAITEXIT) || defined(__DOXYGEN__) #define CH_USE_WAITEXIT TRUE #endif /** - * @brief Semaphores APIs. + * @brief Semaphores APIs. * @details If enabled then the Semaphores APIs are included in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_SEMAPHORES) || defined(__DOXYGEN__) #define CH_USE_SEMAPHORES TRUE #endif /** - * @brief Semaphores queuing mode. + * @brief Semaphores queuing mode. * @details If enabled then the threads are enqueued on semaphores by * priority rather than in FIFO order. * - * @note The default is @p FALSE. Enable this if you have special requirements. - * @note Requires @p CH_USE_SEMAPHORES. + * @note The default is @p FALSE. Enable this if you have special requirements. + * @note Requires @p CH_USE_SEMAPHORES. */ #if !defined(CH_USE_SEMAPHORES_PRIORITY) || defined(__DOXYGEN__) #define CH_USE_SEMAPHORES_PRIORITY FALSE #endif /** - * @brief Atomic semaphore API. - * @details If enabled then the semaphores the @p chSemWaitSignal() API + * @brief Atomic semaphore API. + * @details If enabled then the semaphores the @p chSemSignalWait() API * is included in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_SEMAPHORES. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. */ #if !defined(CH_USE_SEMSW) || defined(__DOXYGEN__) #define CH_USE_SEMSW TRUE #endif /** - * @brief Mutexes APIs. + * @brief Mutexes APIs. * @details If enabled then the mutexes APIs are included in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_MUTEXES) || defined(__DOXYGEN__) #define CH_USE_MUTEXES TRUE #endif /** - * @brief Conditional Variables APIs. + * @brief Conditional Variables APIs. * @details If enabled then the conditional variables APIs are included * in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_MUTEXES. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_MUTEXES. */ #if !defined(CH_USE_CONDVARS) || defined(__DOXYGEN__) #define CH_USE_CONDVARS TRUE #endif /** - * @brief Conditional Variables APIs with timeout. + * @brief Conditional Variables APIs with timeout. * @details If enabled then the conditional variables APIs with timeout * specification are included in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_CONDVARS. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_CONDVARS. */ #if !defined(CH_USE_CONDVARS_TIMEOUT) || defined(__DOXYGEN__) #define CH_USE_CONDVARS_TIMEOUT TRUE #endif /** - * @brief Events Flags APIs. + * @brief Events Flags APIs. * @details If enabled then the event flags APIs are included in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_EVENTS) || defined(__DOXYGEN__) #define CH_USE_EVENTS TRUE #endif /** - * @brief Events Flags APIs with timeout. + * @brief Events Flags APIs with timeout. * @details If enabled then the events APIs with timeout specification * are included in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_EVENTS. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_EVENTS. */ #if !defined(CH_USE_EVENTS_TIMEOUT) || defined(__DOXYGEN__) #define CH_USE_EVENTS_TIMEOUT TRUE #endif /** - * @brief Synchronous Messages APIs. + * @brief Synchronous Messages APIs. * @details If enabled then the synchronous messages APIs are included * in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_MESSAGES) || defined(__DOXYGEN__) #define CH_USE_MESSAGES TRUE #endif /** - * @brief Synchronous Messages queuing mode. + * @brief Synchronous Messages queuing mode. * @details If enabled then messages are served by priority rather than in * FIFO order. * - * @note The default is @p FALSE. Enable this if you have special requirements. - * @note Requires @p CH_USE_MESSAGES. + * @note The default is @p FALSE. Enable this if you have special requirements. + * @note Requires @p CH_USE_MESSAGES. */ #if !defined(CH_USE_MESSAGES_PRIORITY) || defined(__DOXYGEN__) #define CH_USE_MESSAGES_PRIORITY FALSE #endif /** - * @brief Mailboxes APIs. + * @brief Mailboxes APIs. * @details If enabled then the asynchronous messages (mailboxes) APIs are * included in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_SEMAPHORES. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. */ #if !defined(CH_USE_MAILBOXES) || defined(__DOXYGEN__) #define CH_USE_MAILBOXES TRUE #endif /** - * @brief I/O Queues APIs. + * @brief I/O Queues APIs. * @details If enabled then the I/O queues APIs are included in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_SEMAPHORES. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_SEMAPHORES. */ #if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__) #define CH_USE_QUEUES TRUE #endif /** - * @brief Core Memory Manager APIs. + * @brief Core Memory Manager APIs. * @details If enabled then the core memory manager APIs are included * in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_MEMCORE) || defined(__DOXYGEN__) #define CH_USE_MEMCORE TRUE #endif /** - * @brief Heap Allocator APIs. + * @brief Heap Allocator APIs. * @details If enabled then the memory heap allocator APIs are included * in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_COREMEM and either @p CH_USE_MUTEXES or - * @p CH_USE_SEMAPHORES. - * @note Mutexes are recommended. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_COREMEM and either @p CH_USE_MUTEXES or + * @p CH_USE_SEMAPHORES. + * @note Mutexes are recommended. */ #if !defined(CH_USE_HEAP) || defined(__DOXYGEN__) #define CH_USE_HEAP TRUE #endif /** - * @brief C-runtime allocator. + * @brief C-runtime allocator. * @details If enabled the the heap allocator APIs just wrap the C-runtime * @p malloc() and @p free() functions. * - * @note The default is @p FALSE. - * @note Requires @p CH_USE_HEAP. - * @note The C-runtime may or may not require @p CH_USE_COREMEM, see the - * appropriate documentation. + * @note The default is @p FALSE. + * @note Requires @p CH_USE_HEAP. + * @note The C-runtime may or may not require @p CH_USE_COREMEM, see the + * appropriate documentation. */ #if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) #define CH_USE_MALLOC_HEAP FALSE #endif /** - * @brief Memory Pools Allocator APIs. + * @brief Memory Pools Allocator APIs. * @details If enabled then the memory pools allocator APIs are included * in the kernel. * - * @note The default is @p TRUE. + * @note The default is @p TRUE. */ #if !defined(CH_USE_MEMPOOLS) || defined(__DOXYGEN__) #define CH_USE_MEMPOOLS TRUE #endif /** - * @brief Dynamic Threads APIs. + * @brief Dynamic Threads APIs. * @details If enabled then the dynamic threads creation APIs are included * in the kernel. * - * @note The default is @p TRUE. - * @note Requires @p CH_USE_WAITEXIT. + * @note The default is @p TRUE. + * @note Requires @p CH_USE_WAITEXIT. + * @note Requires @p CH_USE_HEAP and/or @p CH_USE_MEMPOOLS. */ #if !defined(CH_USE_DYNAMIC) || defined(__DOXYGEN__) #define CH_USE_DYNAMIC TRUE @@ -347,71 +354,73 @@ /*===========================================================================*/ /** - * @brief Debug option, parameters checks. + * @brief Debug option, parameters checks. * @details If enabled then the checks on the API functions input * parameters are activated. * - * @note The default is @p FALSE. + * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__) #define CH_DBG_ENABLE_CHECKS FALSE #endif /** - * @brief Debug option, consistency checks. + * @brief Debug option, consistency checks. * @details If enabled then all the assertions in the kernel code are * activated. This includes consistency checks inside the kernel, * runtime anomalies and port-defined checks. * - * @note The default is @p FALSE. + * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) #define CH_DBG_ENABLE_ASSERTS FALSE #endif /** - * @brief Debug option, trace buffer. + * @brief Debug option, trace buffer. * @details If enabled then the context switch circular trace buffer is * activated. * - * @note The default is @p FALSE. + * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__) #define CH_DBG_ENABLE_TRACE FALSE #endif /** - * @brief Debug option, stack checks. + * @brief Debug option, stack checks. * @details If enabled then a runtime stack check is performed. * - * @note The default is @p FALSE. - * @note The stack check is performed in a architecture/port dependent way. It - * may not be implemented or some ports. + * @note The default is @p FALSE. + * @note The stack check is performed in a architecture/port dependent way. + * It may not be implemented or some ports. + * @note The default failure mode is to halt the system with the global + * @p panic_msg variable set to @p NULL. */ #if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__) #define CH_DBG_ENABLE_STACK_CHECK FALSE #endif /** - * @brief Debug option, stacks initialization. + * @brief Debug option, stacks initialization. * @details If enabled then the threads working area is filled with a byte * value when a thread is created. This can be useful for the * runtime measurement of the used stack. * - * @note The default is @p FALSE. + * @note The default is @p FALSE. */ #if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__) #define CH_DBG_FILL_THREADS FALSE #endif /** - * @brief Debug option, threads profiling. + * @brief Debug option, threads profiling. * @details If enabled then a field is added to the @p Thread structure that * counts the system ticks occurred while executing the thread. * - * @note The default is @p TRUE. - * @note This debug option is defaulted to TRUE because it is required by - * some test cases into the test suite. + * @note The default is @p TRUE. + * @note This debug option is defaulted to TRUE because it is required by + * some test cases into the test suite. */ #if !defined(CH_DBG_THREADS_PROFILING) || defined(__DOXYGEN__) #define CH_DBG_THREADS_PROFILING TRUE @@ -422,7 +431,7 @@ /*===========================================================================*/ /** - * @brief Threads descriptor structure hook. + * @brief Threads descriptor structure hook. * @details User fields added to the end of the @p Thread structure. */ #if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) @@ -433,11 +442,11 @@ struct { \ #endif /** - * @brief Threads initialization hook. + * @brief Threads initialization hook. * @details User initialization code added to the @p chThdInit() API. * - * @note It is invoked from within @p chThdInit() and implicitily from all - * the threads creation APIs. + * @note It is invoked from within @p chThdInit() and implicitily from all + * the threads creation APIs. */ #if !defined(THREAD_EXT_INIT) || defined(__DOXYGEN__) #define THREAD_EXT_INIT(tp) { \ @@ -446,12 +455,12 @@ struct { \ #endif /** - * @brief Threads finalization hook. + * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. + * @note It is inserted into lock zone. + * @note It is also invoked when the threads simply return in order to + * terminate. */ #if !defined(THREAD_EXT_EXIT) || defined(__DOXYGEN__) #define THREAD_EXT_EXIT(tp) { \ @@ -460,7 +469,7 @@ struct { \ #endif /** - * @brief Idle Loop hook. + * @brief Idle Loop hook. * @details This hook is continuously invoked by the idle thread loop. */ #if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__) -- cgit v1.2.3 From bc9d319ddb279f973404c2b1abf15ec1091bd891 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 4 May 2010 12:31:05 +0000 Subject: Improved code coverage. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1902 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 1418b70ec..aa6d29716 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -42,7 +42,7 @@ static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) { return; } n = chHeapStatus(NULL, &size); - sprintf(buf, "core free memory : %i bytes", chCoreFree()); + sprintf(buf, "core free memory : %i bytes", chCoreStatus()); shellPrintLine(chp, buf); sprintf(buf, "heap fragments : %i", n); shellPrintLine(chp, buf); -- cgit v1.2.3 From fd41cf487a4e4e6d949efecdedc16b3e67d5d0b4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 4 Jun 2010 12:33:23 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1997 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index dd249746f..59a895f70 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -480,6 +480,10 @@ struct { \ #define chThdGetExitEventSource(tp) (&(tp)->p_exitesource) +/*===========================================================================*/ +/* Port-specific settings (override port settings defaulted in chcore.h). */ +/*===========================================================================*/ + #endif /* _CHCONF_H_ */ /** @} */ -- cgit v1.2.3 From 131b177925913634bd96e02e7a9f7d529a122df0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 24 Jul 2010 09:10:47 +0000 Subject: Updated all the halconf.h files in the tree. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2088 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index b325b7238..b870f61b8 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -147,6 +147,17 @@ /*#define MMC_POLLING_INTERVAL 10*/ /*#define MMC_POLLING_DELAY 10*/ +/*===========================================================================*/ +/* UART driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the UART subsystem. + */ +#if !defined(CH_HAL_USE_UART) || defined(__DOXYGEN__) +#define CH_HAL_USE_UART FALSE +#endif + #endif /* _HALCONF_H_ */ /** @} */ -- cgit v1.2.3 From 138c0f900d823b2c953038048bc40b14610f958a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 21 Aug 2010 08:38:14 +0000 Subject: Added new kernel hooks (on halt and on systick). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2136 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 59a895f70..41bb68fc6 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -434,11 +434,9 @@ * @brief Threads descriptor structure hook. * @details User fields added to the end of the @p Thread structure. */ -#if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) -#define THREAD_EXT_FIELDS \ -struct { \ - /* Add threads custom fields here.*/ \ -}; +#if !defined(THREAD_EXT_FIELDS_HOOK) || defined(__DOXYGEN__) +#define THREAD_EXT_FIELDS_HOOK \ + /* Add threads custom fields here.*/ #endif /** @@ -448,9 +446,9 @@ struct { \ * @note It is invoked from within @p chThdInit() and implicitily from all * the threads creation APIs. */ -#if !defined(THREAD_EXT_INIT) || defined(__DOXYGEN__) -#define THREAD_EXT_INIT(tp) { \ - /* Add threads initialization code here.*/ \ +#if !defined(THREAD_EXT_INIT_HOOK) || defined(__DOXYGEN__) +#define THREAD_EXT_INIT_HOOK(tp) { \ + /* Add threads initialization code here.*/ \ } #endif @@ -462,9 +460,9 @@ struct { \ * @note It is also invoked when the threads simply return in order to * terminate. */ -#if !defined(THREAD_EXT_EXIT) || defined(__DOXYGEN__) -#define THREAD_EXT_EXIT(tp) { \ - /* Add threads finalization code here.*/ \ +#if !defined(THREAD_EXT_EXIT_HOOK) || defined(__DOXYGEN__) +#define THREAD_EXT_EXIT_HOOK(tp) { \ + /* Add threads finalization code here.*/ \ } #endif @@ -473,12 +471,32 @@ struct { \ * @details This hook is continuously invoked by the idle thread loop. */ #if !defined(IDLE_LOOP_HOOK) || defined(__DOXYGEN__) -#define IDLE_LOOP_HOOK() { \ - /* Idle loop code here.*/ \ +#define IDLE_LOOP_HOOK() { \ + /* Idle loop code here.*/ \ } #endif -#define chThdGetExitEventSource(tp) (&(tp)->p_exitesource) +/** + * @brief System tick event hook. + * @details This hook is invoked in the system tick handler immediately + * after processing the virtual timers queue. + */ +#if !defined(SYSTEM_TICK_EVENT_HOOK) || defined(__DOXYGEN__) +#define SYSTEM_TICK_EVENT_HOOK() { \ + /* System tick event code here.*/ \ +} +#endif + +/** + * @brief System halt hook. + * @details This hook is invoked in case to a system halting error before + * the system is halted. + */ +#if !defined(SYSTEM_HALT_HOOK) || defined(__DOXYGEN__) +#define SYSTEM_HALT_HOOK() { \ + /* System halt code here.*/ \ +} +#endif /*===========================================================================*/ /* Port-specific settings (override port settings defaulted in chcore.h). */ -- cgit v1.2.3 From 781b0b129cccbecba160effce8c4ddd68295b8b9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 11 Sep 2010 10:57:11 +0000 Subject: Fixed bug 3064204. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2175 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index b870f61b8..6976d598e 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -62,6 +62,11 @@ #define CH_HAL_USE_ADC FALSE #endif +/* + * Default ADC settings overrides (uncomment to override). + */ +/*#define ADC_USE_WAIT TRUE*/ + /*===========================================================================*/ /* CAN driver related settings. */ /*===========================================================================*/ @@ -73,6 +78,11 @@ #define CH_HAL_USE_CAN FALSE #endif +/* + * Default CAN settings overrides (uncomment to override). + */ +/*#define CAN_USE_SLEEP_MODE TRUE*/ + /*===========================================================================*/ /* MAC driver related settings. */ /*===========================================================================*/ -- cgit v1.2.3 From efdf9a658b9bffb0a42dc792f2852f88873f4240 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 27 Sep 2010 18:43:55 +0000 Subject: Reverted name change for macro THREAD_EXT_FIELDS. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2210 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 41bb68fc6..3ced2ccbc 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -431,11 +431,11 @@ /*===========================================================================*/ /** - * @brief Threads descriptor structure hook. + * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p Thread structure. */ -#if !defined(THREAD_EXT_FIELDS_HOOK) || defined(__DOXYGEN__) -#define THREAD_EXT_FIELDS_HOOK \ +#if !defined(THREAD_EXT_FIELDS) || defined(__DOXYGEN__) +#define THREAD_EXT_FIELDS \ /* Add threads custom fields here.*/ #endif -- cgit v1.2.3 From d8be44136c1e6d02ee105ac0791f9e6732551fec Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 1 Nov 2010 17:29:56 +0000 Subject: Fixed bug 3100946, renamed HAL switches removing the CH_ part. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2326 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 232 ++++++++++++++++++++++++++++++-------------- 1 file changed, 161 insertions(+), 71 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 6976d598e..acc98744c 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -18,156 +18,246 @@ */ /** - * @file templates/halconf.h - * @brief HAL configuration header. + * @file templates/halconf.h + * @brief HAL configuration header. + * @details HAL configuration file, this file allows to enable or disable the + * various device drivers from your application. You may also use + * this file in order to override the device drivers default settings. + * * @addtogroup HAL_CONF * @{ */ /* - * HAL configuration file, this file allows to enable or disable the various - * device drivers from your application. You may also use this file in order - * to override the device drivers default settings. + * */ #ifndef _HALCONF_H_ #define _HALCONF_H_ -/* - * Uncomment the following line in order to include a mcu-related - * settings file. This file can be used to include platform specific - * header files or to override the low level drivers settings. - */ /*#include "mcuconf.h"*/ -/*===========================================================================*/ -/* PAL driver related settings. */ -/*===========================================================================*/ +/** + * @brief Enables the PAL subsystem. + */ +#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) +#define HAL_USE_PAL TRUE +#endif /** - * @brief Enables the PAL subsystem. + * @brief Enables the ADC subsystem. */ -#if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__) -#define CH_HAL_USE_PAL TRUE +#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) +#define HAL_USE_ADC FALSE #endif -/*===========================================================================*/ -/* ADC driver related settings. */ -/*===========================================================================*/ +/** + * @brief Enables the CAN subsystem. + */ +#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) +#define HAL_USE_CAN FALSE +#endif /** - * @brief Enables the ADC subsystem. + * @brief Enables the I2C subsystem. */ -#if !defined(CH_HAL_USE_ADC) || defined(__DOXYGEN__) -#define CH_HAL_USE_ADC FALSE +#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) +#define HAL_USE_I2C FALSE #endif -/* - * Default ADC settings overrides (uncomment to override). +/** + * @brief Enables the MAC subsystem. + */ +#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) +#define HAL_USE_MAC FALSE +#endif + +/** + * @brief Enables the MMC_SPI subsystem. + */ +#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) +#define HAL_USE_MMC_SPI FALSE +#endif + +/** + * @brief Enables the PWM subsystem. + */ +#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) +#define HAL_USE_PWM FALSE +#endif + +/** + * @brief Enables the SERIAL subsystem. + */ +#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL TRUE +#endif + +/** + * @brief Enables the SPI subsystem. + */ +#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) +#define HAL_USE_SPI FALSE +#endif + +/** + * @brief Enables the UART subsystem. */ -/*#define ADC_USE_WAIT TRUE*/ +#if !defined(HAL_USE_UART) || defined(__DOXYGEN__) +#define HAL_USE_UART FALSE +#endif /*===========================================================================*/ -/* CAN driver related settings. */ +/* ADC driver related settings. */ /*===========================================================================*/ /** - * @brief Enables the CAN subsystem. + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. */ -#if !defined(CH_HAL_USE_CAN) || defined(__DOXYGEN__) -#define CH_HAL_USE_CAN FALSE +#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) +#define ADC_USE_WAIT TRUE #endif -/* - * Default CAN settings overrides (uncomment to override). +/** + * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. + * @note Disabling this option saves both code and data space. */ -/*#define CAN_USE_SLEEP_MODE TRUE*/ +#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define ADC_USE_MUTUAL_EXCLUSION TRUE +#endif /*===========================================================================*/ -/* MAC driver related settings. */ +/* CAN driver related settings. */ /*===========================================================================*/ /** - * @brief Enables the MAC subsystem. + * @brief Sleep mode related APIs inclusion switch. */ -#if !defined(CH_HAL_USE_MAC) || defined(__DOXYGEN__) -#define CH_HAL_USE_MAC FALSE +#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) +#define CAN_USE_SLEEP_MODE TRUE #endif /*===========================================================================*/ -/* PWM driver related settings. */ +/* I2C driver related settings. */ /*===========================================================================*/ /** - * @brief Enables the PWM subsystem. + * @brief Enables the mutual exclusion APIs on the I2C bus. */ -#if !defined(CH_HAL_USE_PWM) || defined(__DOXYGEN__) -#define CH_HAL_USE_PWM FALSE +#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define I2C_USE_MUTUAL_EXCLUSION TRUE #endif /*===========================================================================*/ -/* SERIAL driver related settings. */ +/* MAC driver related settings. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* MMC_SPI driver related settings. */ /*===========================================================================*/ /** - * @brief Enables the SERIAL subsystem. + * @brief Block size for MMC transfers. */ -#if !defined(CH_HAL_USE_SERIAL) || defined(__DOXYGEN__) -#define CH_HAL_USE_SERIAL TRUE +#if !defined(MMC_SECTOR_SIZE) || defined(__DOXYGEN__) +#define MMC_SECTOR_SIZE 512 #endif -/* - * Default SERIAL settings overrides (uncomment to override). +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + * This option is recommended also if the SPI driver does not + * use a DMA channel and heavily loads the CPU. */ -/*#define SERIAL_DEFAULT_BITRATE 38400*/ -/*#define SERIAL_BUFFERS_SIZE 64*/ +#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) +#define MMC_NICE_WAITING TRUE +#endif -/*===========================================================================*/ -/* SPI driver related settings. */ -/*===========================================================================*/ +/** + * @brief Number of positive insertion queries before generating the + * insertion event. + */ +#if !defined(MMC_POLLING_INTERVAL) || defined(__DOXYGEN__) +#define MMC_POLLING_INTERVAL 10 +#endif /** - * @brief Enables the SPI subsystem. + * @brief Interval, in milliseconds, between insertion queries. */ -#if !defined(CH_HAL_USE_SPI) || defined(__DOXYGEN__) -#define CH_HAL_USE_SPI FALSE +#if !defined(MMC_POLLING_DELAY) || defined(__DOXYGEN__) +#define MMC_POLLING_DELAY 10 #endif -/* - * Default SPI settings overrides (uncomment to override). +/** + * @brief Uses the SPI polled API for small data transfers. + * @details Polled transfers usually improve performance because it + * saves two context switches and interrupt servicing. Note + * that this option has no effect on large transfers which + * are always performed using DMAs/IRQs. */ -/*#define SPI_USE_MUTUAL_EXCLUSION TRUE*/ +#if !defined(MMC_USE_SPI_POLLING) || defined(__DOXYGEN__) +#define MMC_USE_SPI_POLLING TRUE +#endif /*===========================================================================*/ -/* MMC_SPI driver related settings. */ +/* PAL driver related settings. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* PWM driver related settings. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* SERIAL driver related settings. */ /*===========================================================================*/ /** - * @brief Enables the MMC_SPI subsystem. + * @brief Default bit rate. + * @details Configuration parameter, this is the baud rate selected for the + * default configuration. */ -#if !defined(CH_HAL_USE_MMC_SPI) || defined(__DOXYGEN__) -#define CH_HAL_USE_MMC_SPI FALSE +#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) +#define SERIAL_DEFAULT_BITRATE 38400 #endif -/* - * Default MMC_SPI settings overrides (uncomment to override). +/** + * @brief Serial buffers size. + * @details Configuration parameter, you can change the depth of the queue + * buffers depending on the requirements of your application. + * @note The default is 64 bytes for both the transmission and receive + * buffers. */ -/*#define MMC_SECTOR_SIZE 512*/ -/*#define MMC_NICE_WAITING TRUE*/ -/*#define MMC_POLLING_INTERVAL 10*/ -/*#define MMC_POLLING_DELAY 10*/ +#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_BUFFERS_SIZE 16 +#endif /*===========================================================================*/ -/* UART driver related settings. */ +/* SPI driver related settings. */ /*===========================================================================*/ /** - * @brief Enables the UART subsystem. + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. */ -#if !defined(CH_HAL_USE_UART) || defined(__DOXYGEN__) -#define CH_HAL_USE_UART FALSE +#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) +#define SPI_USE_WAIT TRUE #endif +/** + * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define SPI_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* UART driver related settings. */ +/*===========================================================================*/ + #endif /* _HALCONF_H_ */ /** @} */ -- cgit v1.2.3 From ef765be75f392d516bf77b307df5e2192458b3cc Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 20 Nov 2010 11:13:15 +0000 Subject: Fixed a misplaced comment in all the halconf.h files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2394 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index acc98744c..30695a2a3 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -28,10 +28,6 @@ * @{ */ -/* - * - */ - #ifndef _HALCONF_H_ #define _HALCONF_H_ -- cgit v1.2.3 From 68b05c757a60ba3bddbfb76d02b992f96d1e63f9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 2 Dec 2010 17:40:37 +0000 Subject: Fixed typo in configuration files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2453 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 3ced2ccbc..6b9da5975 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -68,7 +68,7 @@ * You may use this option if you need to merge ChibiOS/RT with * external libraries that require nested lock/unlock operations. * - * @note T he default is @p FALSE. + * @note The default is @p FALSE. */ #if !defined(CH_USE_NESTED_LOCKS) || defined(__DOXYGEN__) #define CH_USE_NESTED_LOCKS FALSE -- cgit v1.2.3 From e3a932e0e64d54c083e534541ac1ab36c4b82046 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 19 Dec 2010 11:20:30 +0000 Subject: Win32 simulator updated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2505 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 5 ++++- demos/Win32-MinGW/board.h | 23 ----------------------- demos/Win32-MinGW/main.c | 10 +++++----- 3 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 demos/Win32-MinGW/board.h (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index c1a452297..652c60b44 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -57,6 +57,7 @@ UADEFS = # Imported source files CHIBIOS = ../.. +include $(CHIBIOS)/boards/simulator/board.mk include ${CHIBIOS}/os/hal/hal.mk include ${CHIBIOS}/os/hal/platforms/Win32/platform.mk include ${CHIBIOS}/os/ports/GCC/SIMIA32/port.mk @@ -69,6 +70,7 @@ SRC = ${PORTSRC} \ ${TESTSRC} \ ${HALSRC} \ ${PLATFORMSRC} \ + $(BOARDSRC) \ ${CHIBIOS}/os/various/shell.c \ main.c @@ -76,7 +78,8 @@ SRC = ${PORTSRC} \ ASRC = # List all user directories here -UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) $(HALINC) $(PLATFORMINC) \ +UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \ + $(HALINC) $(PLATFORMINC) $(BOARDINC) \ ${CHIBIOS}/os/various # List the user directory to look for the libraries here diff --git a/demos/Win32-MinGW/board.h b/demos/Win32-MinGW/board.h deleted file mode 100644 index 7b89d92d0..000000000 --- a/demos/Win32-MinGW/board.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef _BOARD_H_ -#define _BOARD_H_ - -#endif /* _BOARD_H_ */ diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index aa6d29716..9ce9b284a 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -220,13 +220,13 @@ int main(void) { EventListener sd1fel, sd2fel, tel; /* - * HAL initialization. + * System initializations. + * - HAL initialization, this also initializes the configured device drivers + * and performs the board-specific initializations. + * - Kernel initialization, the main() function becomes a thread and the + * RTOS is active. */ halInit(); - - /* - * ChibiOS/RT initialization. - */ chSysInit(); /* -- cgit v1.2.3 From ff333430f1317247299863b592293faa7799e0a4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 9 Jan 2011 10:10:39 +0000 Subject: Serial driver changes, bug 3153550 fixed. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2625 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 9ce9b284a..cbdfc100d 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -172,12 +172,12 @@ static void sd1_handler(eventid_t id) { sdflags_t flags; (void)id; - flags = sdGetAndClearFlags(&SD1); - if ((flags & SD_CONNECTED) && (shelltp1 == NULL)) { + flags = chIOGetAndClearFlags(&SD1); + if ((flags & IO_CONNECTED) && (shelltp1 == NULL)) { cputs("Init: connection on SD1"); shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO + 1); } - if (flags & SD_DISCONNECTED) { + if (flags & IO_DISCONNECTED) { cputs("Init: disconnection on SD1"); chSysLock(); chIQResetI(&SD1.iqueue); @@ -194,12 +194,12 @@ static void sd2_handler(eventid_t id) { sdflags_t flags; (void)id; - flags = sdGetAndClearFlags(&SD2); - if ((flags & SD_CONNECTED) && (shelltp2 == NULL)) { + flags = chIOGetAndClearFlags(&SD2); + if ((flags & IO_CONNECTED) && (shelltp2 == NULL)) { cputs("Init: connection on SD2"); shelltp2 = shellCreate(&shell_cfg2, SHELL_WA_SIZE, NORMALPRIO + 10); } - if (flags & SD_DISCONNECTED) { + if (flags & IO_DISCONNECTED) { cputs("Init: disconnection on SD2"); chSysLock(); chIQResetI(&SD2.iqueue); @@ -252,11 +252,11 @@ int main(void) { */ cputs("Shell service started on SD1, SD2"); cputs(" - Listening for connections on SD1"); - (void) sdGetAndClearFlags(&SD1); - chEvtRegister(&SD1.sevent, &sd1fel, 1); + (void) chIOGetAndClearFlags(&SD1); + chEvtRegister(chIOGetEventSource(&SD1), &sd1fel, 1); cputs(" - Listening for connections on SD2"); - (void) sdGetAndClearFlags(&SD2); - chEvtRegister(&SD2.sevent, &sd2fel, 2); + (void) chIOGetAndClearFlags(&SD2); + chEvtRegister(chIOGetEventSource(&SD2), &sd2fel, 2); /* * Events servicing loop. @@ -267,7 +267,7 @@ int main(void) { /* * Clean simulator exit. */ - chEvtUnregister(&SD1.sevent, &sd1fel); - chEvtUnregister(&SD2.sevent, &sd2fel); + chEvtUnregister(chIOGetEventSource(&SD1), &sd1fel); + chEvtUnregister(chIOGetEventSource(&SD2), &sd2fel); return 0; } -- cgit v1.2.3 From b4319d0aab553542c83bafad69f4224065cc6142 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 9 Jan 2011 10:39:16 +0000 Subject: Removed some instances of sdflags_t. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2627 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index cbdfc100d..d2effad35 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -169,7 +169,7 @@ static void termination_handler(eventid_t id) { * @param[in] id event id. */ static void sd1_handler(eventid_t id) { - sdflags_t flags; + ioflags_t flags; (void)id; flags = chIOGetAndClearFlags(&SD1); @@ -191,7 +191,7 @@ static void sd1_handler(eventid_t id) { * @param[in] id event id. */ static void sd2_handler(eventid_t id) { - sdflags_t flags; + ioflags_t flags; (void)id; flags = chIOGetAndClearFlags(&SD2); -- cgit v1.2.3 From db7b60f402fda8ffb708e73feea7ed566eea0386 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 20 Feb 2011 15:26:43 +0000 Subject: Modified all the halconf.h files to include the USB and Serial over USB drivers. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2753 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 30695a2a3..d6696b6c2 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -89,6 +89,13 @@ #define HAL_USE_SERIAL TRUE #endif +/** + * @brief Enables the SERIAL over USB subsystem. + */ +#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL_USB FALSE +#endif + /** * @brief Enables the SPI subsystem. */ @@ -103,6 +110,13 @@ #define HAL_USE_UART FALSE #endif +/** + * @brief Enables the USB subsystem. + */ +#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) +#define HAL_USE_USB FALSE +#endif + /*===========================================================================*/ /* ADC driver related settings. */ /*===========================================================================*/ -- cgit v1.2.3 From 6f6e1a6401eda000dce198150937c7919b4c9855 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 23 Feb 2011 18:59:39 +0000 Subject: Improved messages subsystem. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2759 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index d2effad35..0830ab149 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -122,15 +122,16 @@ static const ShellConfig shell_cfg2 = { /* * Console print server done using synchronous messages. This makes the access * to the C printf() thread safe and the print operation atomic among threads. - * In this example the message is the zero termitated string itself. + * In this example the message is the zero terminated string itself. */ static msg_t console_thread(void *arg) { (void)arg; while (!chThdShouldTerminate()) { - puts((char *)chMsgWait()); + Thread *tp = chMsgWait(); + puts((char *)chMsgGet(tp)); fflush(stdout); - chMsgRelease(RDY_OK); + chMsgRelease(tp, RDY_OK); } return 0; } -- cgit v1.2.3 From 761f9f7287db259fe4a280d9ad13e2ed6eaf95a3 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 28 Feb 2011 19:28:47 +0000 Subject: Updated the various halconf.h and mcuconf.h with the GPT settings. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2782 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index d6696b6c2..4d73d65cb 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -54,6 +54,13 @@ #define HAL_USE_CAN FALSE #endif +/** + * @brief Enables the GPT subsystem. + */ +#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) +#define HAL_USE_GPT FALSE +#endif + /** * @brief Enables the I2C subsystem. */ -- cgit v1.2.3 From e7e79a6ccb4f3e320b2b8b7bad1b14d65218641d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 18 Mar 2011 18:38:08 +0000 Subject: License updated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2827 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 3 ++- demos/Win32-MinGW/halconf.h | 3 ++- demos/Win32-MinGW/main.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 6b9da5975..acb041f00 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 4d73d65cb..34daac121 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 0830ab149..8540afed5 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From dfc2c1e189dff36c57dfa521ac33289fe34972d2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 23 Apr 2011 17:37:09 +0000 Subject: Updated all the HAL configuration files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2900 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 34daac121..9f736e7dd 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -69,6 +69,13 @@ #define HAL_USE_I2C FALSE #endif +/** + * @brief Enables the ICU subsystem. + */ +#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) +#define HAL_USE_ICU TRUE +#endif + /** * @brief Enables the MAC subsystem. */ -- cgit v1.2.3 From 82215e70199aa16ccad770a0e47ca5131a3f8b93 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 May 2011 09:16:22 +0000 Subject: All halcof.h files updated for the SDC driver. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2932 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 9f736e7dd..e89032a9c 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -97,6 +97,13 @@ #define HAL_USE_PWM FALSE #endif +/** + * @brief Enables the SDC subsystem. + */ +#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) +#define HAL_USE_SDC TRUE +#endif + /** * @brief Enables the SERIAL subsystem. */ -- cgit v1.2.3 From 85f17ebe017f0ef2a42d96eb3525346db5b9c65e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 13 May 2011 17:20:39 +0000 Subject: Customer CR. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2951 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index acb041f00..6c00f9851 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -90,6 +90,23 @@ #define CH_MEMCORE_SIZE 0x20000 #endif +/** + * @brief Idle thread automatic spawn suppression. + * @details When this option is activated the function @p chSysInit() + * does not spawn the idle thread automatically. The application has + * then the responsibility to do one of the following: + * - Spawn a custom idle thread at priority @p IDLEPRIO. + * - Change the main() thread priority to @p IDLEPRIO then enter + * an endless loop. In this scenario the @p main() thread acts as + * the idle thread. + * . + * @note Unless an idle thread is spawned the @p main() thread must not + * enter a sleep state. + */ +#if !defined(CH_NO_IDLE_THREAD) || defined(__DOXYGEN__) +#define CH_NO_IDLE_THREAD FALSE +#endif + /*===========================================================================*/ /* Performance options. */ /*===========================================================================*/ -- cgit v1.2.3 From 8af2607871d3a2f5bc92ce9fb095a23d7adab27b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 14 May 2011 05:24:10 +0000 Subject: Updated HAL configuration files with SDC driver settings. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2953 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index e89032a9c..37e5ce01f 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -242,6 +242,36 @@ /* PWM driver related settings. */ /*===========================================================================*/ +/*===========================================================================*/ +/* SDC driver related settings. */ +/*===========================================================================*/ +/** + * @brief Number of initialization attempts before rejecting the card. + * @note Attempts are performed at 10mS intevals. + */ +#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) +#define SDC_INIT_RETRY 100 +#endif + +/** + * @brief Include support for MMC cards. + * @note MMC support is not yet implemented so this option must be kept + * at @p FALSE. + */ +#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) +#define SDC_MMC_SUPPORT FALSE +#endif + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + */ +#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) +#define SDC_NICE_WAITING TRUE +#endif + /*===========================================================================*/ /* SERIAL driver related settings. */ /*===========================================================================*/ -- cgit v1.2.3 From 67e6534f658113f8bdfccab5fb6373214501d32b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 14 May 2011 07:05:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2955 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 37e5ce01f..8af25ee13 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -101,7 +101,7 @@ * @brief Enables the SDC subsystem. */ #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) -#define HAL_USE_SDC TRUE +#define HAL_USE_SDC FALSE #endif /** -- cgit v1.2.3 From 391474c15f0695d4b1bbe1549fefc98ef3cf9e4d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 14 May 2011 07:11:40 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2956 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 8af25ee13..7c6d8a758 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -73,7 +73,7 @@ * @brief Enables the ICU subsystem. */ #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) -#define HAL_USE_ICU TRUE +#define HAL_USE_ICU FALSE #endif /** -- cgit v1.2.3 From b4aa14e88c9e28a16a5f9c0c220fac6cc36750ad Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 18 May 2011 09:03:50 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2971 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 6c00f9851..cda9cabab 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -123,26 +123,6 @@ #define CH_OPTIMIZE_SPEED TRUE #endif -/** - * @brief Exotic optimization. - * @details If defined then a CPU register is used as storage for the global - * @p currp variable. Caching this variable in a register greatly - * improves both space and time OS efficiency. A side effect is that - * one less register has to be saved during the context switch - * resulting in lower RAM usage and faster context switch. - * - * @note This option is only usable with the GCC compiler and is only useful - * on processors with many registers like ARM cores. - * @note If this option is enabled then ALL the libraries linked to the - * ChibiOS/RT code must be recompiled with the GCC option @p - * -ffixed-@. - * @note This option must be enabled in the Makefile, it is listed here for - * documentation only. - */ -#if defined(__DOXYGEN__) -#define CH_CURRP_REGISTER_CACHE "reg" -#endif - /*===========================================================================*/ /* Subsystem options. */ /*===========================================================================*/ -- cgit v1.2.3 From 3495905f51318549a2bd6764360a4812aac869fa Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 19 May 2011 17:46:52 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2974 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 1 - 1 file changed, 1 deletion(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index cda9cabab..c01a15331 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -278,7 +278,6 @@ * @details If enabled then the I/O queues APIs are included in the kernel. * * @note The default is @p TRUE. - * @note Requires @p CH_USE_SEMAPHORES. */ #if !defined(CH_USE_QUEUES) || defined(__DOXYGEN__) #define CH_USE_QUEUES TRUE -- cgit v1.2.3 From 6b6790350e7861f2a15b308d84bc052681d1d150 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 19 May 2011 18:54:35 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2980 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index c01a15331..e571b2800 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -84,7 +84,7 @@ * * @note In order to let the OS manage the whole RAM the linker script must * provide the @p __heap_base__ and @p __heap_end__ symbols. - * @note Requires @p CH_USE_COREMEM. + * @note Requires @p CH_USE_MEMCORE. */ #if !defined(CH_MEMCORE_SIZE) || defined(__DOXYGEN__) #define CH_MEMCORE_SIZE 0x20000 @@ -300,7 +300,7 @@ * in the kernel. * * @note The default is @p TRUE. - * @note Requires @p CH_USE_COREMEM and either @p CH_USE_MUTEXES or + * @note Requires @p CH_USE_MEMCORE and either @p CH_USE_MUTEXES or * @p CH_USE_SEMAPHORES. * @note Mutexes are recommended. */ @@ -315,7 +315,7 @@ * * @note The default is @p FALSE. * @note Requires @p CH_USE_HEAP. - * @note The C-runtime may or may not require @p CH_USE_COREMEM, see the + * @note The C-runtime may or may not require @p CH_USE_MEMCORE, see the * appropriate documentation. */ #if !defined(CH_USE_MALLOC_HEAP) || defined(__DOXYGEN__) -- cgit v1.2.3 From b9933c2089f5f0cd93738ae9081c45fcf3df54b7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 11 Aug 2011 17:51:37 +0000 Subject: Implemented system state checker debug option, remove the option CH_USE_NESTED_LOCKS. Documentation improvements and fixes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3221 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 61 +++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 20 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index e571b2800..4572090b0 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -33,7 +33,10 @@ #define _CHCONF_H_ /*===========================================================================*/ -/* Kernel parameters. */ +/** + * @name Kernel parameters and options + * @{ + */ /*===========================================================================*/ /** @@ -60,21 +63,6 @@ #define CH_TIME_QUANTUM 20 #endif -/** - * @brief Nested locks. - * @details If enabled then the use of nested @p chSysLock() / @p chSysUnlock() - * operations is allowed.
- * For performance and code size reasons the recommended setting - * is to leave this option disabled.
- * You may use this option if you need to merge ChibiOS/RT with - * external libraries that require nested lock/unlock operations. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_USE_NESTED_LOCKS) || defined(__DOXYGEN__) -#define CH_USE_NESTED_LOCKS FALSE -#endif - /** * @brief Managed RAM size. * @details Size of the RAM area to be managed by the OS. If set to zero @@ -107,8 +95,13 @@ #define CH_NO_IDLE_THREAD FALSE #endif +/** @} */ + /*===========================================================================*/ -/* Performance options. */ +/** + * @name Performance options + * @{ + */ /*===========================================================================*/ /** @@ -123,8 +116,13 @@ #define CH_OPTIMIZE_SPEED TRUE #endif +/** @} */ + /*===========================================================================*/ -/* Subsystem options. */ +/** + * @name Subsystem options + * @{ + */ /*===========================================================================*/ /** @@ -346,10 +344,26 @@ #define CH_USE_DYNAMIC TRUE #endif +/** @} */ + /*===========================================================================*/ -/* Debug options. */ +/** + * @name Debug options + * @{ + */ /*===========================================================================*/ +/** + * @brief Debug option, system state check. + * @details If enabled the correct call protocol for system APIs is checked + * at runtime. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__) +#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#endif + /** * @brief Debug option, parameters checks. * @details If enabled then the checks on the API functions input @@ -423,8 +437,13 @@ #define CH_DBG_THREADS_PROFILING TRUE #endif +/** @} */ + /*===========================================================================*/ -/* Kernel hooks. */ +/** + * @name Kernel hooks + * @{ + */ /*===========================================================================*/ /** @@ -495,6 +514,8 @@ } #endif +/** @} */ + /*===========================================================================*/ /* Port-specific settings (override port settings defaulted in chcore.h). */ /*===========================================================================*/ -- cgit v1.2.3 From 5cee2c08d787d1b14c62d5595b72644a773fe443 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 13 Aug 2011 15:40:57 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3226 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 4572090b0..fa22f7210 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -482,6 +482,16 @@ } #endif +/** + * @brief Context switch hook. + * @details This hook is invoked just before switching between threads. + */ +#if !defined(THREAD_CONTEXT_SWITCH_HOOK) || defined(__DOXYGEN__) +#define THREAD_CONTEXT_SWITCH_HOOK(ntp, otp) { \ + /* System halt code here.*/ \ +} +#endif + /** * @brief Idle Loop hook. * @details This hook is continuously invoked by the idle thread loop. @@ -503,6 +513,7 @@ } #endif + /** * @brief System halt hook. * @details This hook is invoked in case to a system halting error before -- cgit v1.2.3 From 698e37b41c08fd2a3b250ba3d0737c942af14f19 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 15 Aug 2011 08:49:20 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3236 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 1 + demos/Win32-MinGW/main.c | 32 +++++++++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index 652c60b44..73e938d44 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -72,6 +72,7 @@ SRC = ${PORTSRC} \ ${PLATFORMSRC} \ $(BOARDSRC) \ ${CHIBIOS}/os/various/shell.c \ + ${CHIBIOS}/os/various/chprintf.c \ main.c # List ASM source files here diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 8540afed5..a735dfa0c 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -22,6 +22,7 @@ #include "hal.h" #include "test.h" #include "shell.h" +#include "chprintf.h" #define SHELL_WA_SIZE THD_WA_SIZE(4096) #define CONSOLE_WA_SIZE THD_WA_SIZE(4096) @@ -35,20 +36,16 @@ static Thread *shelltp2; static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) { size_t n, size; - char buf[52]; (void)argv; if (argc > 0) { - shellPrintLine(chp, "Usage: mem"); + chprintf(chp, "Usage: mem\r\n"); return; } n = chHeapStatus(NULL, &size); - sprintf(buf, "core free memory : %i bytes", chCoreStatus()); - shellPrintLine(chp, buf); - sprintf(buf, "heap fragments : %i", n); - shellPrintLine(chp, buf); - sprintf(buf, "heap free total : %i bytes", size); - shellPrintLine(chp, buf); + chprintf(chp, "core free memory : %u bytes\r\n", chCoreStatus()); + chprintf(chp, "heap fragments : %u\r\n", n); + chprintf(chp, "heap free total : %u bytes\r\n", size); } static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { @@ -63,25 +60,26 @@ static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { "WTEXIT", "WTOREVT", "WTANDEVT", + "SNDMSGQ", "SNDMSG", "WTMSG", + "WTQUEUE", "FINAL" }; Thread *tp; - char buf[60]; (void)argv; if (argc > 0) { - shellPrintLine(chp, "Usage: threads"); + chprintf(chp, "Usage: threads\r\n"); return; } - shellPrintLine(chp, " addr stack prio refs state time"); + chprintf(chp, " addr stack prio refs state time\r\n"); tp = chRegFirstThread(); do { - sprintf(buf, "%8p %8p %4i %4i %9s %i", - tp, tp->p_ctx.esp, tp->p_prio, tp->p_refs - 1, - states[tp->p_state], tp->p_time); - shellPrintLine(chp, buf); + chprintf(chp, "%.8lx %.8lx %4lu %4lu %9s %lu\r\n", + (uint32_t)tp, (uint32_t)tp->p_ctx.r13, + (uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1), + states[tp->p_state], (uint32_t)tp->p_time); tp = chRegNextThread(tp); } while (tp != NULL); } @@ -91,13 +89,13 @@ static void cmd_test(BaseChannel *chp, int argc, char *argv[]) { (void)argv; if (argc > 0) { - shellPrintLine(chp, "Usage: test"); + chprintf(chp, "Usage: test\r\n"); return; } tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(), TestThread, chp); if (tp == NULL) { - shellPrintLine(chp, "out of memory"); + chprintf(chp, "out of memory\r\n"); return; } chThdWait(tp); -- cgit v1.2.3 From bc571ccd326886a8cbbde85de66b6fab91336193 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 12 Sep 2011 19:15:30 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3312 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 7c6d8a758..9bd348124 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -55,6 +55,13 @@ #define HAL_USE_CAN FALSE #endif +/** + * @brief Enables the EXT subsystem. + */ +#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) +#define HAL_USE_EXT FALSE +#endif + /** * @brief Enables the GPT subsystem. */ @@ -185,6 +192,13 @@ /* MAC driver related settings. */ /*===========================================================================*/ +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) +#define MAC_USE_EVENTS TRUE +#endif + /*===========================================================================*/ /* MMC_SPI driver related settings. */ /*===========================================================================*/ @@ -234,14 +248,6 @@ #define MMC_USE_SPI_POLLING TRUE #endif -/*===========================================================================*/ -/* PAL driver related settings. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* PWM driver related settings. */ -/*===========================================================================*/ - /*===========================================================================*/ /* SDC driver related settings. */ /*===========================================================================*/ -- cgit v1.2.3 From b86e5efeeb17af6937319d0fd874fc64b0c1ccb4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 12 Sep 2011 19:27:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3313 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 9bd348124..aa145ef4d 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -251,6 +251,7 @@ /*===========================================================================*/ /* SDC driver related settings. */ /*===========================================================================*/ + /** * @brief Number of initialization attempts before rejecting the card. * @note Attempts are performed at 10mS intevals. @@ -322,10 +323,6 @@ #define SPI_USE_MUTUAL_EXCLUSION TRUE #endif -/*===========================================================================*/ -/* UART driver related settings. */ -/*===========================================================================*/ - #endif /* _HALCONF_H_ */ /** @} */ -- cgit v1.2.3 From c39d08fc2ae9c43f73114e24292520306bddde19 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 23 Sep 2011 15:48:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3384 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/.cproject | 224 ++++++++++++++++++++++++++++++++++++++++++++ demos/Win32-MinGW/.project | 94 +++++++++++++++++++ 2 files changed, 318 insertions(+) create mode 100644 demos/Win32-MinGW/.cproject create mode 100644 demos/Win32-MinGW/.project (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/.cproject b/demos/Win32-MinGW/.cproject new file mode 100644 index 000000000..5342c0657 --- /dev/null +++ b/demos/Win32-MinGW/.cproject @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demos/Win32-MinGW/.project b/demos/Win32-MinGW/.project new file mode 100644 index 000000000..fda7a8f5b --- /dev/null +++ b/demos/Win32-MinGW/.project @@ -0,0 +1,94 @@ + + + Win32-MinGW + + + _Common Files + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?children? + ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\|| + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + mingw32-make + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + false + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.core.cnature + + + + os + 2 + WORKSPACE_LOC/os + + + test + 2 + WORKSPACE_LOC/test + + + -- cgit v1.2.3 From 8ce9365e009b1f1555bcd4901118ebf8de2eaa3d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 25 Sep 2011 15:31:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3411 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/.cproject | 224 -------------------------------------------- demos/Win32-MinGW/.project | 94 ------------------- 2 files changed, 318 deletions(-) delete mode 100644 demos/Win32-MinGW/.cproject delete mode 100644 demos/Win32-MinGW/.project (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/.cproject b/demos/Win32-MinGW/.cproject deleted file mode 100644 index 5342c0657..000000000 --- a/demos/Win32-MinGW/.cproject +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demos/Win32-MinGW/.project b/demos/Win32-MinGW/.project deleted file mode 100644 index fda7a8f5b..000000000 --- a/demos/Win32-MinGW/.project +++ /dev/null @@ -1,94 +0,0 @@ - - - Win32-MinGW - - - _Common Files - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?children? - ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\|| - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.autoBuildTarget - all - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - mingw32-make - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.fullBuildTarget - all - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - false - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.core.cnature - - - - os - 2 - WORKSPACE_LOC/os - - - test - 2 - WORKSPACE_LOC/test - - - -- cgit v1.2.3 From eea23b22826e76dba443a12c651d5490a0314471 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 8 Oct 2011 16:56:03 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3439 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index aa145ef4d..682089a94 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -104,6 +104,13 @@ #define HAL_USE_PWM FALSE #endif +/** + * @brief Enables the RTC subsystem. + */ +#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) +#define HAL_USE_RTC FALSE +#endif + /** * @brief Enables the SDC subsystem. */ -- cgit v1.2.3 From 309b1e411426e8d36d9a552ef2870da3db912a80 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 23 Oct 2011 11:39:45 +0000 Subject: Improvements to the USB driver, first phase. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3449 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index a735dfa0c..d4cc554ce 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -49,23 +49,7 @@ static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) { } static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { - static const char *states[] = { - "READY", - "CURRENT", - "SUSPENDED", - "WTSEM", - "WTMTX", - "WTCOND", - "SLEEPING", - "WTEXIT", - "WTOREVT", - "WTANDEVT", - "SNDMSGQ", - "SNDMSG", - "WTMSG", - "WTQUEUE", - "FINAL" - }; + static const char *states[] = {THD_STATE_NAMES}; Thread *tp; (void)argv; -- cgit v1.2.3 From a2708c091beb3331967dff2af9a9232744427de4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 9 Jan 2012 19:37:58 +0000 Subject: Updated all halconf.h files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3777 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 682089a94..5fc7a5215 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -34,6 +34,13 @@ /*#include "mcuconf.h"*/ +/** + * @brief Enables the TM subsystem. + */ +#if !defined(HAL_USE_TM) || defined(__DOXYGEN__) +#define HAL_USE_TM TRUE +#endif + /** * @brief Enables the PAL subsystem. */ -- cgit v1.2.3 From 58f1fe92ee9c68ffd08bccd19f67eafbbc968a71 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 11 Jan 2012 18:02:20 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3788 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 2 +- demos/Win32-MinGW/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 5fc7a5215..2d6ea6061 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -38,7 +38,7 @@ * @brief Enables the TM subsystem. */ #if !defined(HAL_USE_TM) || defined(__DOXYGEN__) -#define HAL_USE_TM TRUE +#define HAL_USE_TM FALSE #endif /** diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index d4cc554ce..61abfb093 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -61,7 +61,7 @@ static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { tp = chRegFirstThread(); do { chprintf(chp, "%.8lx %.8lx %4lu %4lu %9s %lu\r\n", - (uint32_t)tp, (uint32_t)tp->p_ctx.r13, + (uint32_t)tp, (uint32_t)tp->p_ctx.esp, (uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1), states[tp->p_state], (uint32_t)tp->p_time); tp = chRegNextThread(tp); -- cgit v1.2.3 From de5dcbba856524599a8f06d3a9bdbf1b01db44c2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 21 Jan 2012 14:29:42 +0000 Subject: License text updated with new year. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3846 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 2 +- demos/Win32-MinGW/halconf.h | 2 +- demos/Win32-MinGW/main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index fa22f7210..de77658a9 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 2d6ea6061..79e3cbd09 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 61abfb093..d42ee770d 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From f038bffdb512f67d4f90e8cba499713458eebd67 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 1 Apr 2012 09:13:04 +0000 Subject: Fixed bug 3510812. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4066 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 2 +- demos/Win32-MinGW/halconf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index de77658a9..e5794592e 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -459,7 +459,7 @@ * @brief Threads initialization hook. * @details User initialization code added to the @p chThdInit() API. * - * @note It is invoked from within @p chThdInit() and implicitily from all + * @note It is invoked from within @p chThdInit() and implicitly from all * the threads creation APIs. */ #if !defined(THREAD_EXT_INIT_HOOK) || defined(__DOXYGEN__) diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 79e3cbd09..202137119 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -268,7 +268,7 @@ /** * @brief Number of initialization attempts before rejecting the card. - * @note Attempts are performed at 10mS intevals. + * @note Attempts are performed at 10mS intervals. */ #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) #define SDC_INIT_RETRY 100 -- cgit v1.2.3 From ecfab096a90b19280078d84c53c13099672303b2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 22 Jul 2012 08:18:58 +0000 Subject: Win32 simulator fixed. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4474 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index d42ee770d..dc6e3685a 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -34,7 +34,7 @@ static Thread *cdtp; static Thread *shelltp1; static Thread *shelltp2; -static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) { +static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) { size_t n, size; (void)argv; @@ -48,7 +48,7 @@ static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) { chprintf(chp, "heap free total : %u bytes\r\n", size); } -static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { +static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { static const char *states[] = {THD_STATE_NAMES}; Thread *tp; @@ -68,7 +68,7 @@ static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { } while (tp != NULL); } -static void cmd_test(BaseChannel *chp, int argc, char *argv[]) { +static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) { Thread *tp; (void)argv; @@ -93,12 +93,12 @@ static const ShellCommand commands[] = { }; static const ShellConfig shell_cfg1 = { - (BaseChannel *)&SD1, + (BaseSequentialStream *)&SD1, commands }; static const ShellConfig shell_cfg2 = { - (BaseChannel *)&SD2, + (BaseSequentialStream *)&SD2, commands }; @@ -153,15 +153,15 @@ static void termination_handler(eventid_t id) { * @param[in] id event id. */ static void sd1_handler(eventid_t id) { - ioflags_t flags; + chnflags_t flags; (void)id; - flags = chIOGetAndClearFlags(&SD1); - if ((flags & IO_CONNECTED) && (shelltp1 == NULL)) { + flags = chnGetAndClearFlags(&SD1); + if ((flags & CHN_CONNECTED) && (shelltp1 == NULL)) { cputs("Init: connection on SD1"); shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO + 1); } - if (flags & IO_DISCONNECTED) { + if (flags & CHN_DISCONNECTED) { cputs("Init: disconnection on SD1"); chSysLock(); chIQResetI(&SD1.iqueue); @@ -175,15 +175,15 @@ static void sd1_handler(eventid_t id) { * @param[in] id event id. */ static void sd2_handler(eventid_t id) { - ioflags_t flags; + chnflags_t flags; (void)id; - flags = chIOGetAndClearFlags(&SD2); - if ((flags & IO_CONNECTED) && (shelltp2 == NULL)) { + flags = chnGetAndClearFlags(&SD2); + if ((flags & CHN_CONNECTED) && (shelltp2 == NULL)) { cputs("Init: connection on SD2"); shelltp2 = shellCreate(&shell_cfg2, SHELL_WA_SIZE, NORMALPRIO + 10); } - if (flags & IO_DISCONNECTED) { + if (flags & CHN_DISCONNECTED) { cputs("Init: disconnection on SD2"); chSysLock(); chIQResetI(&SD2.iqueue); @@ -236,11 +236,11 @@ int main(void) { */ cputs("Shell service started on SD1, SD2"); cputs(" - Listening for connections on SD1"); - (void) chIOGetAndClearFlags(&SD1); - chEvtRegister(chIOGetEventSource(&SD1), &sd1fel, 1); + (void) chnGetAndClearFlags(&SD1); + chEvtRegister(chnGetEventSource(&SD1), &sd1fel, 1); cputs(" - Listening for connections on SD2"); - (void) chIOGetAndClearFlags(&SD2); - chEvtRegister(chIOGetEventSource(&SD2), &sd2fel, 2); + (void) chnGetAndClearFlags(&SD2); + chEvtRegister(chnGetEventSource(&SD2), &sd2fel, 2); /* * Events servicing loop. @@ -251,7 +251,7 @@ int main(void) { /* * Clean simulator exit. */ - chEvtUnregister(chIOGetEventSource(&SD1), &sd1fel); - chEvtUnregister(chIOGetEventSource(&SD2), &sd2fel); + chEvtUnregister(chnGetEventSource(&SD1), &sd1fel); + chEvtUnregister(chnGetEventSource(&SD2), &sd2fel); return 0; } -- cgit v1.2.3 From f90a0f37906a9363a6e702d8ac1c4c8257370efa Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 16 Sep 2012 09:08:43 +0000 Subject: Removed flags handling in BaseAsynchronousChannel. Modified serial drivers to use the new event flags. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4671 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index dc6e3685a..7514faebf 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -147,16 +147,18 @@ static void termination_handler(eventid_t id) { } } +static EventListener sd1fel, sd2fel; + /** * @brief SD1 status change handler. * * @param[in] id event id. */ static void sd1_handler(eventid_t id) { - chnflags_t flags; + flagsmask_t flags; (void)id; - flags = chnGetAndClearFlags(&SD1); + flags = chEvtGetAndClearFlags(&sd1fel); if ((flags & CHN_CONNECTED) && (shelltp1 == NULL)) { cputs("Init: connection on SD1"); shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO + 1); @@ -175,10 +177,10 @@ static void sd1_handler(eventid_t id) { * @param[in] id event id. */ static void sd2_handler(eventid_t id) { - chnflags_t flags; + flagsmask_t flags; (void)id; - flags = chnGetAndClearFlags(&SD2); + flags = chEvtGetAndClearFlags(&sd2fel); if ((flags & CHN_CONNECTED) && (shelltp2 == NULL)) { cputs("Init: connection on SD2"); shelltp2 = shellCreate(&shell_cfg2, SHELL_WA_SIZE, NORMALPRIO + 10); @@ -201,7 +203,7 @@ static evhandler_t fhandlers[] = { * Simulator main. * *------------------------------------------------------------------------*/ int main(void) { - EventListener sd1fel, sd2fel, tel; + EventListener tel; /* * System initializations. @@ -236,10 +238,8 @@ int main(void) { */ cputs("Shell service started on SD1, SD2"); cputs(" - Listening for connections on SD1"); - (void) chnGetAndClearFlags(&SD1); chEvtRegister(chnGetEventSource(&SD1), &sd1fel, 1); cputs(" - Listening for connections on SD2"); - (void) chnGetAndClearFlags(&SD2); chEvtRegister(chnGetEventSource(&SD2), &sd2fel, 2); /* -- cgit v1.2.3 From 950cacebb01b21ad22d9406b48912022e800998a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 28 Oct 2012 07:42:57 +0000 Subject: Fixed bug 3581304. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4786 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/readme.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/readme.txt b/demos/Win32-MinGW/readme.txt index 047425ffe..e72e2e0a3 100644 --- a/demos/Win32-MinGW/readme.txt +++ b/demos/Win32-MinGW/readme.txt @@ -11,8 +11,8 @@ I/O is simulated over TCP/IP sockets. The demo listens on the two serial ports, when a connection is detected a thread is started that serves a small command shell. -The demo shows how create/terminate threads at runtime, how listen to events, -how ho work with serial ports, how use the messages. +The demo shows how to create/terminate threads at runtime, how to listen to +events, how to work with serial ports, how to use the messages. You can develop your ChibiOS/RT application using this demo as a simulator then you can recompile it for a different architecture. See demo.c for details. -- cgit v1.2.3 From 77d7a3741d05e24286f41d3bfdfdee78f4dbd8a6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 30 Dec 2012 09:43:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4995 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 202137119..9c78834c5 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -206,6 +206,13 @@ /* MAC driver related settings. */ /*===========================================================================*/ +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) +#define MAC_USE_ZERO_COPY FALSE +#endif + /** * @brief Enables an event sources for incoming packets. */ -- cgit v1.2.3 From a82dec52e68b99553e1793f46e49e297f03df635 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 26 Jan 2013 10:40:00 +0000 Subject: Fixed bug 3601621. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5091 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index 73e938d44..1b77c241c 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -117,10 +117,10 @@ CPFLAGS += -MD -MP -MF .dep/$(@F).d all: $(OBJS) $(PROJECT).exe -%o : %c +%.o : %.c $(CC) -c $(CPFLAGS) -I . $(INCDIR) $< -o $@ -%o : %s +%.o : %.s $(AS) -c $(ASFLAGS) $< -o $@ %exe: $(OBJS) -- cgit v1.2.3 From 097062ca3be263bac3906c4b23d56ca765504ba8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Feb 2013 10:35:45 +0000 Subject: Removed obsolete options from the haconf.h files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5101 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/halconf.h | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 9c78834c5..8e12621e3 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -224,13 +224,6 @@ /* MMC_SPI driver related settings. */ /*===========================================================================*/ -/** - * @brief Block size for MMC transfers. - */ -#if !defined(MMC_SECTOR_SIZE) || defined(__DOXYGEN__) -#define MMC_SECTOR_SIZE 512 -#endif - /** * @brief Delays insertions. * @details If enabled this options inserts delays into the MMC waiting @@ -243,32 +236,6 @@ #define MMC_NICE_WAITING TRUE #endif -/** - * @brief Number of positive insertion queries before generating the - * insertion event. - */ -#if !defined(MMC_POLLING_INTERVAL) || defined(__DOXYGEN__) -#define MMC_POLLING_INTERVAL 10 -#endif - -/** - * @brief Interval, in milliseconds, between insertion queries. - */ -#if !defined(MMC_POLLING_DELAY) || defined(__DOXYGEN__) -#define MMC_POLLING_DELAY 10 -#endif - -/** - * @brief Uses the SPI polled API for small data transfers. - * @details Polled transfers usually improve performance because it - * saves two context switches and interrupt servicing. Note - * that this option has no effect on large transfers which - * are always performed using DMAs/IRQs. - */ -#if !defined(MMC_USE_SPI_POLLING) || defined(__DOXYGEN__) -#define MMC_USE_SPI_POLLING TRUE -#endif - /*===========================================================================*/ /* SDC driver related settings. */ /*===========================================================================*/ -- cgit v1.2.3 From 184a71345c6a36a9a8664eda8fbcc3ea728267a8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Feb 2013 10:58:09 +0000 Subject: Updated license years. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5102 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 2 +- demos/Win32-MinGW/halconf.h | 2 +- demos/Win32-MinGW/main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index e5794592e..e705956d7 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index 8e12621e3..fd6c25f3e 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 7514faebf..04d615611 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From 853216256ad4cdacf5f94edb7d6b738c6be165a1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 30 Mar 2013 10:32:37 +0000 Subject: Relicensing parts of the tree under the Apache 2.0 license. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5521 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/chconf.h | 24 ++++++++++-------------- demos/Win32-MinGW/halconf.h | 24 ++++++++++-------------- demos/Win32-MinGW/main.c | 24 ++++++++++-------------- 3 files changed, 30 insertions(+), 42 deletions(-) (limited to 'demos/Win32-MinGW') diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index e705956d7..88fc072c1 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + 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 - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + 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. */ /** diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h index fd6c25f3e..d406bacc1 100644 --- a/demos/Win32-MinGW/halconf.h +++ b/demos/Win32-MinGW/halconf.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + 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 - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + 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. */ /** diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 04d615611..0d5dab844 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + 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 - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + 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. */ #include "ch.h" -- cgit v1.2.3