diff options
Diffstat (limited to 'demos/Win32-MinGW')
-rw-r--r-- | demos/Win32-MinGW/chcore.h | 4 | ||||
-rw-r--r-- | demos/Win32-MinGW/chtypes.h | 36 | ||||
-rw-r--r-- | demos/Win32-MinGW/demo.c | 16 |
3 files changed, 25 insertions, 31 deletions
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 <stdint.h>
+#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 <ch.h>
-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) {
|