git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@212 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2008-03-03 15:52:55 +00:00
parent c9efc76157
commit ec0a917ae1
24 changed files with 207 additions and 220 deletions

View File

@ -51,7 +51,7 @@ int main(int argc, char **argv) {
while (TRUE) { while (TRUE) {
chThdSleep(500); chThdSleep(500);
if (!(AT91C_BASE_PIOB->PIO_PDSR & PIOB_SW1)) if (!(AT91C_BASE_PIOB->PIO_PDSR & PIOB_SW1))
chFDDWrite(&COM1, (BYTE8 *)"Hello World!\r\n", 14); chFDDWrite(&COM1, (uint8_t *)"Hello World!\r\n", 14);
if (!(AT91C_BASE_PIOB->PIO_PDSR & PIOB_SW2)) if (!(AT91C_BASE_PIOB->PIO_PDSR & PIOB_SW2))
TestThread(&COM1); TestThread(&COM1);
} }

View File

@ -73,7 +73,7 @@ static void TimerHandler(t_eventid id) {
if (!(IO0PIN & 0x00008000)) // Button 1 if (!(IO0PIN & 0x00008000)) // Button 1
PlaySound(1000, 100); PlaySound(1000, 100);
if (!(IO0PIN & 0x00010000)) { // Button 2 if (!(IO0PIN & 0x00010000)) { // Button 2
chFDDWrite(&COM1, (BYTE8 *)"Hello World!\r\n", 14); chFDDWrite(&COM1, (uint8_t *)"Hello World!\r\n", 14);
PlaySound(2000, 100); PlaySound(2000, 100);
} }
} }
@ -84,7 +84,7 @@ static void TimerHandler(t_eventid id) {
* driver and reads a sector. * driver and reads a sector.
*/ */
static void InsertHandler(t_eventid id) { static void InsertHandler(t_eventid id) {
static BYTE8 rwbuf[512]; static uint8_t rwbuf[512];
MMCCSD data; MMCCSD data;
PlaySoundWait(1000, 100); PlaySoundWait(1000, 100);

View File

@ -91,14 +91,14 @@ void mmcStopPolling(void) {
/* /*
* Returns TRUE if the card is safely inserted in the reader. * Returns TRUE if the card is safely inserted in the reader.
*/ */
BOOL mmcCardInserted (void) { t_bool mmcCardInserted (void) {
return cnt == 0; return cnt == 0;
} }
static void wait(void) { static void wait(void) {
int i; int i;
BYTE8 buf[4]; uint8_t buf[4];
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
sspRW(buf, NULL, 1); sspRW(buf, NULL, 1);
@ -116,8 +116,8 @@ static void wait(void) {
} }
} }
static void sendhdr(BYTE8 cmd, ULONG32 arg) { static void sendhdr(uint8_t cmd, uint32_t arg) {
BYTE8 buf[6]; uint8_t buf[6];
/* /*
* Wait for the bus to become idle if a write operation was in progress. * Wait for the bus to become idle if a write operation was in progress.
@ -133,9 +133,9 @@ static void sendhdr(BYTE8 cmd, ULONG32 arg) {
sspRW(NULL, buf, 6); sspRW(NULL, buf, 6);
} }
static BYTE8 recvr1(void) { static uint8_t recvr1(void) {
int i; int i;
BYTE8 r1[1]; uint8_t r1[1];
for (i = 0; i < 9; i++) { for (i = 0; i < 9; i++) {
sspRW(r1, NULL, 1); sspRW(r1, NULL, 1);
@ -145,7 +145,7 @@ static BYTE8 recvr1(void) {
return 0xFF; /* Timeout.*/ return 0xFF; /* Timeout.*/
} }
static BOOL getdata(BYTE8 *buf, ULONG32 n) { static t_bool getdata(uint8_t *buf, uint32_t n) {
int i; int i;
for (i = 0; i < MMC_WAIT_DATA; i++) { for (i = 0; i < MMC_WAIT_DATA; i++) {
@ -162,7 +162,7 @@ static BOOL getdata(BYTE8 *buf, ULONG32 n) {
/* /*
* Initializes a card after the power up by selecting the SPI mode. * Initializes a card after the power up by selecting the SPI mode.
*/ */
BOOL mmcInit(void) { t_bool mmcInit(void) {
/* /*
* Starting initialization with slow clock mode. * Starting initialization with slow clock mode.
@ -187,7 +187,7 @@ BOOL mmcInit(void) {
*/ */
i = 0; i = 0;
while (TRUE) { while (TRUE) {
BYTE8 b = mmcSendCommand(CMDINIT, 0); uint8_t b = mmcSendCommand(CMDINIT, 0);
if (b == 0x00) if (b == 0x00)
break; break;
if (b != 0x01) if (b != 0x01)
@ -207,8 +207,8 @@ BOOL mmcInit(void) {
/* /*
* Sends a simple command and returns a R1-type response. * Sends a simple command and returns a R1-type response.
*/ */
BYTE8 mmcSendCommand(BYTE8 cmd, ULONG32 arg) { uint8_t mmcSendCommand(uint8_t cmd, uint32_t arg) {
BYTE8 r1; uint8_t r1;
sspAcquireBus(); sspAcquireBus();
sendhdr(cmd, arg); sendhdr(cmd, arg);
@ -222,8 +222,8 @@ BYTE8 mmcSendCommand(BYTE8 cmd, ULONG32 arg) {
* @param data the pointer to a \p MMCCSD structure * @param data the pointer to a \p MMCCSD structure
* @return \p TRUE if an error happened * @return \p TRUE if an error happened
*/ */
BOOL mmcGetSize(MMCCSD *data) { t_bool mmcGetSize(MMCCSD *data) {
BYTE8 buf[16]; uint8_t buf[16];
sspAcquireBus(); sspAcquireBus();
sendhdr(CMDREADCSD, 0); sendhdr(CMDREADCSD, 0);
@ -250,7 +250,7 @@ BOOL mmcGetSize(MMCCSD *data) {
* @param buf the pointer to the read buffer * @param buf the pointer to the read buffer
* @return \p TRUE if an error happened * @return \p TRUE if an error happened
*/ */
BOOL mmcRead(BYTE8 *buf, ULONG32 blknum) { t_bool mmcRead(uint8_t *buf, uint32_t blknum) {
sspAcquireBus(); sspAcquireBus();
sendhdr(CMDREAD, blknum << 8); sendhdr(CMDREAD, blknum << 8);
@ -273,8 +273,8 @@ BOOL mmcRead(BYTE8 *buf, ULONG32 blknum) {
* @param buf the pointer to the read buffer * @param buf the pointer to the read buffer
* @return \p TRUE if an error happened * @return \p TRUE if an error happened
*/ */
BOOL mmcReadMultiple(BYTE8 *buf, ULONG32 blknum, ULONG32 n) { t_bool mmcReadMultiple(uint8_t *buf, uint32_t blknum, uint32_t n) {
static const BYTE8 stopcmd[] = {0x40 | CMDSTOP, 0, 0, 0, 0, 1, 0xFF}; static const uint8_t stopcmd[] = {0x40 | CMDSTOP, 0, 0, 0, 0, 1, 0xFF};
sspAcquireBus(); sspAcquireBus();
sendhdr(CMDREADMULTIPLE, blknum << 8); sendhdr(CMDREADMULTIPLE, blknum << 8);
@ -290,7 +290,7 @@ BOOL mmcReadMultiple(BYTE8 *buf, ULONG32 blknum, ULONG32 n) {
buf += 512; buf += 512;
n--; n--;
} }
sspRW(NULL, (BYTE8 *)stopcmd, sizeof(stopcmd)); sspRW(NULL, (uint8_t *)stopcmd, sizeof(stopcmd));
if (recvr1() != 0x00) { if (recvr1() != 0x00) {
sspReleaseBus(); sspReleaseBus();
return TRUE; return TRUE;
@ -309,9 +309,9 @@ BOOL mmcReadMultiple(BYTE8 *buf, ULONG32 blknum, ULONG32 n) {
* the card, this allows to not make useless busy waiting. The invoking * the card, this allows to not make useless busy waiting. The invoking
* thread can do other things while the data is being written. * thread can do other things while the data is being written.
*/ */
BOOL mmcWrite(BYTE8 *buf, ULONG32 blknum) { t_bool mmcWrite(uint8_t *buf, uint32_t blknum) {
static const BYTE8 start[] = {0xFF, 0xFE}; static const uint8_t start[] = {0xFF, 0xFE};
BYTE8 b[4]; uint8_t b[4];
sspAcquireBus(); sspAcquireBus();
sendhdr(CMDWRITE, blknum << 8); sendhdr(CMDWRITE, blknum << 8);
@ -319,7 +319,7 @@ BOOL mmcWrite(BYTE8 *buf, ULONG32 blknum) {
sspReleaseBus(); sspReleaseBus();
return TRUE; return TRUE;
} }
sspRW(NULL, (BYTE8 *)start, 2); /* Data prologue.*/ sspRW(NULL, (uint8_t *)start, 2); /* Data prologue.*/
sspRW(NULL, buf, 512); /* Data.*/ sspRW(NULL, buf, 512); /* Data.*/
sspRW(NULL, NULL, 2); /* CRC ignored in this version.*/ sspRW(NULL, NULL, 2); /* CRC ignored in this version.*/
sspRW(b, NULL, 1); sspRW(b, NULL, 1);
@ -340,10 +340,10 @@ BOOL mmcWrite(BYTE8 *buf, ULONG32 blknum) {
* the card, this allows to not make useless busy waiting. The invoking * the card, this allows to not make useless busy waiting. The invoking
* thread can do other things while the data is being written. * thread can do other things while the data is being written.
*/ */
BOOL mmcWriteMultiple(BYTE8 *buf, ULONG32 blknum, ULONG32 n) { t_bool mmcWriteMultiple(uint8_t *buf, uint32_t blknum, uint32_t n) {
static const BYTE8 start[] = {0xFF, 0xFC}, static const uint8_t start[] = {0xFF, 0xFC},
stop[] = {0xFD, 0xFF}; stop[] = {0xFD, 0xFF};
BYTE8 b[4]; uint8_t b[4];
sspAcquireBus(); sspAcquireBus();
sendhdr(CMDWRITEMULTIPLE, blknum << 8); sendhdr(CMDWRITEMULTIPLE, blknum << 8);
@ -352,7 +352,7 @@ BOOL mmcWriteMultiple(BYTE8 *buf, ULONG32 blknum, ULONG32 n) {
return TRUE; return TRUE;
} }
while (n) { while (n) {
sspRW(NULL, (BYTE8 *)start, sizeof(start)); /* Data prologue.*/ sspRW(NULL, (uint8_t *)start, sizeof(start)); /* Data prologue.*/
sspRW(NULL, buf, 512); /* Data.*/ sspRW(NULL, buf, 512); /* Data.*/
sspRW(NULL, NULL, 2); /* CRC ignored in this version.*/ sspRW(NULL, NULL, 2); /* CRC ignored in this version.*/
sspRW(b, NULL, 1); sspRW(b, NULL, 1);
@ -364,7 +364,7 @@ BOOL mmcWriteMultiple(BYTE8 *buf, ULONG32 blknum, ULONG32 n) {
buf += 512; buf += 512;
n--; n--;
} }
sspRW(NULL, (BYTE8 *)stop, sizeof(stop)); /* Stops the transfer.*/ sspRW(NULL, (uint8_t *)stop, sizeof(stop)); /* Stops the transfer.*/
sspReleaseBus(); sspReleaseBus();
return FALSE; return FALSE;
} }
@ -373,7 +373,7 @@ BOOL mmcWriteMultiple(BYTE8 *buf, ULONG32 blknum, ULONG32 n) {
* Makes sure that pending operations are completed before returning. * Makes sure that pending operations are completed before returning.
*/ */
void mmcSynch(void) { void mmcSynch(void) {
BYTE8 buf[4]; uint8_t buf[4];
sspAcquireBus(); sspAcquireBus();
while (TRUE) { while (TRUE) {

View File

@ -37,8 +37,8 @@
#define CMDWRITEMULTIPLE 25 #define CMDWRITEMULTIPLE 25
typedef struct { typedef struct {
ULONG32 csize; uint32_t csize;
ULONG32 rdblklen; uint32_t rdblklen;
} MMCCSD; } MMCCSD;
extern EventSource MMCInsertEventSource, MMCRemoveEventSource; extern EventSource MMCInsertEventSource, MMCRemoveEventSource;
@ -48,16 +48,16 @@ extern EventSource MMCInsertEventSource, MMCRemoveEventSource;
#endif #endif
void InitMMC(void); void InitMMC(void);
BOOL mmcInit(void); t_bool mmcInit(void);
void mmcStartPolling(void); void mmcStartPolling(void);
void mmcStopPolling(void); void mmcStopPolling(void);
BOOL mmcCardInserted (void); t_bool mmcCardInserted (void);
BYTE8 mmcSendCommand(BYTE8 cmd, ULONG32 arg); uint8_t mmcSendCommand(uint8_t cmd, uint32_t arg);
BOOL mmcGetSize(MMCCSD *data); t_bool mmcGetSize(MMCCSD *data);
BOOL mmcRead(BYTE8 *buf, ULONG32 blknum); t_bool mmcRead(uint8_t *buf, uint32_t blknum);
BOOL mmcReadMultiple(BYTE8 *buf, ULONG32 blknum, ULONG32 n); t_bool mmcReadMultiple(uint8_t *buf, uint32_t blknum, uint32_t n);
BOOL mmcWrite(BYTE8 *buf, ULONG32 blknum); t_bool mmcWrite(uint8_t *buf, uint32_t blknum);
BOOL mmcWriteMultiple(BYTE8 *buf, ULONG32 blknum, ULONG32 n); t_bool mmcWriteMultiple(uint8_t *buf, uint32_t blknum, uint32_t n);
void mmcSynch(void); void mmcSynch(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -24,15 +24,15 @@
#include "at91lib/aic.h" #include "at91lib/aic.h"
FullDuplexDriver COM1; FullDuplexDriver COM1;
static BYTE8 ib1[SERIAL_BUFFERS_SIZE]; static uint8_t ib1[SERIAL_BUFFERS_SIZE];
static BYTE8 ob1[SERIAL_BUFFERS_SIZE]; static uint8_t ob1[SERIAL_BUFFERS_SIZE];
FullDuplexDriver COM2; FullDuplexDriver COM2;
static BYTE8 ib2[SERIAL_BUFFERS_SIZE]; static uint8_t ib2[SERIAL_BUFFERS_SIZE];
static BYTE8 ob2[SERIAL_BUFFERS_SIZE]; static uint8_t ob2[SERIAL_BUFFERS_SIZE];
static void SetError(AT91_REG csr, FullDuplexDriver *com) { static void SetError(AT91_REG csr, FullDuplexDriver *com) {
UWORD16 sts = 0; uint16_t sts = 0;
if (csr & AT91C_US_OVRE) if (csr & AT91C_US_OVRE)
sts |= SD_OVERRUN_ERROR; sts |= SD_OVERRUN_ERROR;

View File

@ -25,15 +25,15 @@
#include "board.h" #include "board.h"
FullDuplexDriver COM1; FullDuplexDriver COM1;
BYTE8 ib1[SERIAL_BUFFERS_SIZE]; uint8_t ib1[SERIAL_BUFFERS_SIZE];
BYTE8 ob1[SERIAL_BUFFERS_SIZE]; uint8_t ob1[SERIAL_BUFFERS_SIZE];
FullDuplexDriver COM2; FullDuplexDriver COM2;
BYTE8 ib2[SERIAL_BUFFERS_SIZE]; uint8_t ib2[SERIAL_BUFFERS_SIZE];
BYTE8 ob2[SERIAL_BUFFERS_SIZE]; uint8_t ob2[SERIAL_BUFFERS_SIZE];
static void SetError(IOREG32 err, FullDuplexDriver *com) { static void SetError(IOREG32 err, FullDuplexDriver *com) {
UWORD16 sts = 0; uint16_t sts = 0;
if (err & LSR_OVERRUN) if (err & LSR_OVERRUN)
sts |= SD_OVERRUN_ERROR; sts |= SD_OVERRUN_ERROR;

View File

@ -55,7 +55,7 @@ void sspReleaseBus(void) {
* rest of the system. This kind of peripheral would really need a * rest of the system. This kind of peripheral would really need a
* dedicated DMA channel. * dedicated DMA channel.
*/ */
void sspRW(BYTE8 *in, BYTE8 *out, t_size n) { void sspRW(uint8_t *in, uint8_t *out, t_size n) {
int icnt, ocnt; int icnt, ocnt;
SSP *ssp = SSPBase; SSP *ssp = SSPBase;

View File

@ -34,7 +34,7 @@
void sspAcquireBus(void); void sspAcquireBus(void);
void sspReleaseBus(void); void sspReleaseBus(void);
void sspRW(BYTE8 *in, BYTE8 *out, t_size n); void sspRW(uint8_t *in, uint8_t *out, t_size n);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -64,7 +64,7 @@ typedef struct {
* Platform dependent part of the \p chThdCreate() API. * Platform dependent part of the \p chThdCreate() API.
*/ */
#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \ #define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
tp->p_ctx.r13 = (struct intctx *)((BYTE8 *)workspace + \ tp->p_ctx.r13 = (struct intctx *)((uint8_t *)workspace + \
wsize - \ wsize - \
sizeof(struct intctx)); \ sizeof(struct intctx)); \
tp->p_ctx.r13->r4 = pf; \ tp->p_ctx.r13->r4 = pf; \
@ -91,7 +91,7 @@ extern void chSysUnlock(void);
sizeof(struct extctx) + \ sizeof(struct extctx) + \
(n) + \ (n) + \
INT_REQUIRED_STACK) INT_REQUIRED_STACK)
#define WorkingArea(s, n) ULONG32 s[UserStackSize(n) >> 2]; #define WorkingArea(s, n) uint32_t s[UserStackSize(n) >> 2];
#ifdef THUMB #ifdef THUMB
#define chSysSwitchI chSysSwitchI_thumb #define chSysSwitchI chSysSwitchI_thumb

View File

@ -20,27 +20,21 @@
#ifndef _CHTYPES_H_ #ifndef _CHTYPES_H_
#define _CHTYPES_H_ #define _CHTYPES_H_
/* #if !defined(_STDINT_H) && !defined(__STDINT_H_)
* Generic types often dependant on the compiler. #include <stdint.h>
*/ #endif
#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 int8_t t_bool;
typedef BYTE8 t_tstate; typedef uint8_t t_tmode;
typedef UWORD16 t_tid; typedef uint8_t t_tstate;
typedef ULONG32 t_prio; typedef uint16_t t_tid;
typedef LONG32 t_msg; typedef uint32_t t_prio;
typedef LONG32 t_eventid; typedef int32_t t_msg;
typedef ULONG32 t_eventmask; typedef int32_t t_eventid;
typedef ULONG32 t_time; typedef uint32_t t_eventmask;
typedef LONG32 t_cnt; typedef uint32_t t_time;
typedef ULONG32 t_size; typedef int32_t t_cnt;
typedef uint32_t t_size;
#define INLINE inline #define INLINE inline

View File

@ -24,52 +24,52 @@
* Interrupt saved context. * Interrupt saved context.
*/ */
struct extctx { struct extctx {
BYTE8 _next; uint8_t _next;
BYTE8 r31; uint8_t r31;
BYTE8 r30; uint8_t r30;
BYTE8 r27; uint8_t r27;
BYTE8 r26; uint8_t r26;
BYTE8 r25; uint8_t r25;
BYTE8 r24; uint8_t r24;
BYTE8 r23; uint8_t r23;
BYTE8 r22; uint8_t r22;
BYTE8 r21; uint8_t r21;
BYTE8 r20; uint8_t r20;
BYTE8 r19; uint8_t r19;
BYTE8 r18; uint8_t r18;
BYTE8 sr; uint8_t sr;
BYTE8 r1; uint8_t r1;
BYTE8 r0; uint8_t r0;
UWORD16 pc; uint16_t pc;
}; };
/* /*
* System saved context. * System saved context.
*/ */
struct intctx { struct intctx {
BYTE8 _next; uint8_t _next;
BYTE8 r29; uint8_t r29;
BYTE8 r28; uint8_t r28;
BYTE8 r17; uint8_t r17;
BYTE8 r16; uint8_t r16;
BYTE8 r15; uint8_t r15;
BYTE8 r14; uint8_t r14;
BYTE8 r13; uint8_t r13;
BYTE8 r12; uint8_t r12;
BYTE8 r11; uint8_t r11;
BYTE8 r10; uint8_t r10;
#ifndef CH_CURRP_REGISTER_CACHE #ifndef CH_CURRP_REGISTER_CACHE
BYTE8 r9; uint8_t r9;
BYTE8 r8; uint8_t r8;
#endif #endif
BYTE8 r7; uint8_t r7;
BYTE8 r6; uint8_t r6;
BYTE8 r5; uint8_t r5;
BYTE8 r4; uint8_t r4;
BYTE8 r3; uint8_t r3;
BYTE8 r2; uint8_t r2;
BYTE8 pcl; uint8_t pcl;
BYTE8 pch; uint8_t pch;
}; };
/* /*
@ -84,7 +84,7 @@ typedef struct {
* Platform dependent part of the \p chThdCreate() API. * Platform dependent part of the \p chThdCreate() API.
*/ */
#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \ #define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
tp->p_ctx.sp = (struct intctx*)((BYTE8 *)workspace + wsize - 1 - \ tp->p_ctx.sp = (struct intctx*)((uint8_t *)workspace + wsize - 1 - \
(sizeof(struct intctx) - 1)); \ (sizeof(struct intctx) - 1)); \
tp->p_ctx.sp->r2 = (int)pf; \ tp->p_ctx.sp->r2 = (int)pf; \
tp->p_ctx.sp->r3 = (int)pf >> 8; \ tp->p_ctx.sp->r3 = (int)pf >> 8; \
@ -100,7 +100,7 @@ typedef struct {
(sizeof(struct intctx) - 1) + \ (sizeof(struct intctx) - 1) + \
(sizeof(struct extctx) - 1) + \ (sizeof(struct extctx) - 1) + \
(n) + (INT_REQUIRED_STACK)) (n) + (INT_REQUIRED_STACK))
#define WorkingArea(s, n) BYTE8 s[UserStackSize(n)]; #define WorkingArea(s, n) uint8_t s[UserStackSize(n)];
#define chSysLock() asm volatile ("cli") #define chSysLock() asm volatile ("cli")

View File

@ -20,28 +20,21 @@
#ifndef _CHTYPES_H_ #ifndef _CHTYPES_H_
#define _CHTYPES_H_ #define _CHTYPES_H_
/* #if !defined(_STDINT_H) && !defined(__STDINT_H_)
* Generic types often dependant on the compiler. #include <stdint.h>
*/ #endif
#define BOOL char
#define BYTE8 unsigned char
#define SBYTE8 signed char
#define WORD16 int
#define UWORD16 unsigned int
#define LONG32 long
#define ULONG32 unsigned long
#define PTR_EQ int
typedef BYTE8 t_tmode; typedef int8_t t_bool;
typedef BYTE8 t_tstate; typedef uint8_t t_tmode;
typedef BYTE8 t_tid; typedef uint8_t t_tstate;
typedef BYTE8 t_prio; typedef uint8_t t_tid;
typedef WORD16 t_msg; typedef uint8_t t_prio;
typedef BYTE8 t_eventid; typedef int16_t t_msg;
typedef BYTE8 t_eventmask; typedef uint8_t t_eventid;
typedef UWORD16 t_time; typedef uint8_t t_eventmask;
typedef SBYTE8 t_cnt; typedef uint16_t t_time;
typedef UWORD16 t_size; typedef int8_t t_cnt;
typedef uint16_t t_size;
#define INLINE inline #define INLINE inline

View File

@ -63,6 +63,12 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet, scheduled
*** Releases *** *** Releases ***
***************************************************************************** *****************************************************************************
*** 0.5.6 ***
- Code refactory, all the old sized-integer definitions like LONG32, UWORD16
etc are now replaced by the proper definitions provided by the compiler
into stdint.h. This has an impact on some API prototypes but we can't
help it.
*** 0.5.5 *** *** 0.5.5 ***
- Added an AVRmega128 port. The previous AT90CANx port is still present but - Added an AVRmega128 port. The previous AT90CANx port is still present but
it will be redone after the AVRmega128 port is complete because it will it will be redone after the AVRmega128 port is complete because it will

View File

@ -106,8 +106,8 @@ void chMtxLockS(Mutex *mp) {
* @param mp pointer to the \p Mutex structure * @param mp pointer to the \p Mutex structure
* @return \p TRUE if the mutex was successfully acquired else \p FALSE * @return \p TRUE if the mutex was successfully acquired else \p FALSE
*/ */
BOOL chMtxTryLock(Mutex *mp) { t_bool chMtxTryLock(Mutex *mp) {
BOOL b; t_bool b;
chSysLock(); chSysLock();
@ -126,7 +126,7 @@ BOOL chMtxTryLock(Mutex *mp) {
* @note This function must be called within a \p chSysLock() / \p chSysUnlock() * @note This function must be called within a \p chSysLock() / \p chSysUnlock()
* block. * block.
*/ */
BOOL chMtxTryLockS(Mutex *mp) { t_bool chMtxTryLockS(Mutex *mp) {
if (mp->m_owner != NULL) if (mp->m_owner != NULL)
return FALSE; return FALSE;

View File

@ -35,7 +35,7 @@
* @param inotify pointer to a callback function that is invoked when * @param inotify pointer to a callback function that is invoked when
* some data is read from the Queue. The value can be \p NULL. * some data is read from the Queue. The value can be \p NULL.
*/ */
void chIQInit(Queue *qp, BYTE8 *buffer, t_size size, t_qnotify inotify) { void chIQInit(Queue *qp, uint8_t *buffer, t_size size, t_qnotify inotify) {
qp->q_buffer = qp->q_rdptr = qp->q_wrptr = buffer; qp->q_buffer = qp->q_rdptr = qp->q_wrptr = buffer;
qp->q_top = buffer + size; qp->q_top = buffer + size;
@ -68,7 +68,7 @@ void chIQReset(Queue *qp) {
* @note This function must be called with interrupts disabled or from an * @note This function must be called with interrupts disabled or from an
* interrupt handler. * interrupt handler.
*/ */
t_msg chIQPutI(Queue *qp, BYTE8 b) { t_msg chIQPutI(Queue *qp, uint8_t b) {
if (chIQIsFull(qp)) if (chIQIsFull(qp))
return Q_FULL; return Q_FULL;
@ -87,7 +87,7 @@ t_msg chIQPutI(Queue *qp, BYTE8 b) {
* @return a byte from the queue or \p Q_RESET if the queue was reset * @return a byte from the queue or \p Q_RESET if the queue was reset
*/ */
t_msg chIQGet(Queue *qp) { t_msg chIQGet(Queue *qp) {
BYTE8 b; uint8_t b;
chSysLock(); chSysLock();
@ -120,7 +120,7 @@ t_msg chIQGet(Queue *qp) {
* option is enabled in \p chconf.h. * option is enabled in \p chconf.h.
*/ */
t_msg chIQGetTimeout(Queue *qp, t_time time) { t_msg chIQGetTimeout(Queue *qp, t_time time) {
BYTE8 b; uint8_t b;
t_msg msg; t_msg msg;
chSysLock(); chSysLock();
@ -153,7 +153,7 @@ t_msg chIQGetTimeout(Queue *qp, t_time time) {
* @note The function is not atomic, if you need atomicity it is suggested * @note The function is not atomic, if you need atomicity it is suggested
* to use a semaphore for mutual exclusion. * to use a semaphore for mutual exclusion.
*/ */
t_size chIQRead(Queue *qp, BYTE8 *buffer, t_size n) { t_size chIQRead(Queue *qp, uint8_t *buffer, t_size n) {
t_size r = 0; t_size r = 0;
while (n--) { while (n--) {
@ -193,7 +193,7 @@ t_size chIQRead(Queue *qp, BYTE8 *buffer, t_size n) {
* @param onotify pointer to a callback function that is invoked when * @param onotify pointer to a callback function that is invoked when
* some data is written in the Queue. The value can be \p NULL. * some data is written in the Queue. The value can be \p NULL.
*/ */
void chOQInit(Queue *qp, BYTE8 *buffer, t_size size, t_qnotify onotify) { void chOQInit(Queue *qp, uint8_t *buffer, t_size size, t_qnotify onotify) {
qp->q_buffer = qp->q_rdptr = qp->q_wrptr = buffer; qp->q_buffer = qp->q_rdptr = qp->q_wrptr = buffer;
qp->q_top = buffer + size; qp->q_top = buffer + size;
@ -222,7 +222,7 @@ void chOQReset(Queue *qp) {
* @param qp pointer to a \p Queue structure * @param qp pointer to a \p Queue structure
* @param b the byte value to be written * @param b the byte value to be written
*/ */
void chOQPut(Queue *qp, BYTE8 b) { void chOQPut(Queue *qp, uint8_t b) {
chSysLock(); chSysLock();
@ -246,7 +246,7 @@ void chOQPut(Queue *qp, BYTE8 b) {
* interrupt handler. * interrupt handler.
*/ */
t_msg chOQGetI(Queue *qp) { t_msg chOQGetI(Queue *qp) {
BYTE8 b; uint8_t b;
if (chOQIsEmpty(qp)) if (chOQIsEmpty(qp))
return Q_EMPTY; return Q_EMPTY;
@ -268,7 +268,7 @@ t_msg chOQGetI(Queue *qp) {
* @note The function is not atomic, if you need atomicity it is suggested * @note The function is not atomic, if you need atomicity it is suggested
* to use a semaphore for mutual exclusion. * to use a semaphore for mutual exclusion.
*/ */
t_size chOQWrite(Queue *qp, BYTE8 *buffer, t_size n) { t_size chOQWrite(Queue *qp, uint8_t *buffer, t_size n) {
t_size w = 0; t_size w = 0;
while (n--) { while (n--) {
@ -311,7 +311,7 @@ t_size chOQWrite(Queue *qp, BYTE8 *buffer, t_size n) {
* @param onotify pointer to a callback function that is invoked when * @param onotify pointer to a callback function that is invoked when
* some data is written to the queue. The value can be \p NULL. * some data is written to the queue. The value can be \p NULL.
*/ */
void chHDQInit(HalfDuplexQueue *qp, BYTE8 *buffer, t_size size, void chHDQInit(HalfDuplexQueue *qp, uint8_t *buffer, t_size size,
t_qnotify inotify, t_qnotify onotify) { t_qnotify inotify, t_qnotify onotify) {
qp->hdq_buffer = qp->hdq_rdptr = qp->hdq_wrptr = buffer; qp->hdq_buffer = qp->hdq_rdptr = qp->hdq_wrptr = buffer;
@ -329,7 +329,7 @@ void chHDQInit(HalfDuplexQueue *qp, BYTE8 *buffer, t_size size,
* @return the byte value or \p Q_RESET if the queue was reset * @return the byte value or \p Q_RESET if the queue was reset
*/ */
t_msg chHDQGetReceive(HalfDuplexQueue *qp) { t_msg chHDQGetReceive(HalfDuplexQueue *qp) {
BYTE8 b; uint8_t b;
chSysLock(); chSysLock();
@ -364,7 +364,7 @@ t_msg chHDQGetReceive(HalfDuplexQueue *qp) {
* option is enabled in \p chconf.h. * option is enabled in \p chconf.h.
*/ */
t_msg chHDQGetReceiveTimeout(HalfDuplexQueue *qp, t_time time) { t_msg chHDQGetReceiveTimeout(HalfDuplexQueue *qp, t_time time) {
BYTE8 b; uint8_t b;
t_msg msg; t_msg msg;
chSysLock(); chSysLock();
@ -397,7 +397,7 @@ t_msg chHDQGetReceiveTimeout(HalfDuplexQueue *qp, t_time time) {
* @param qp pointer to a \p HalfDuplexQueue structure * @param qp pointer to a \p HalfDuplexQueue structure
* @param b the byte value to be written * @param b the byte value to be written
*/ */
void chHDQPutTransmit(HalfDuplexQueue *qp, BYTE8 b) { void chHDQPutTransmit(HalfDuplexQueue *qp, uint8_t b) {
chSysLock(); chSysLock();
@ -432,7 +432,7 @@ void chHDQPutTransmit(HalfDuplexQueue *qp, BYTE8 b) {
* interrupt handler. * interrupt handler.
*/ */
t_msg chHDQGetTransmitI(HalfDuplexQueue *qp) { t_msg chHDQGetTransmitI(HalfDuplexQueue *qp) {
BYTE8 b; uint8_t b;
if (!chHDQIsTransmitting(qp)) if (!chHDQIsTransmitting(qp))
return Q_EMPTY; return Q_EMPTY;
@ -454,7 +454,7 @@ t_msg chHDQGetTransmitI(HalfDuplexQueue *qp) {
* @note This function must be called with interrupts disabled or from an * @note This function must be called with interrupts disabled or from an
* interrupt handler. * interrupt handler.
*/ */
t_msg chHDQPutReceiveI(HalfDuplexQueue *qp, BYTE8 b) { t_msg chHDQPutReceiveI(HalfDuplexQueue *qp, uint8_t b) {
if (chHDQIsTransmitting(qp)) if (chHDQIsTransmitting(qp))
return Q_FULL; return Q_FULL;

View File

@ -181,7 +181,7 @@ void chSchRescheduleS(void) {
* @return \p TRUE if there is a thread that should go in running state * @return \p TRUE if there is a thread that should go in running state
* immediatly else \p FALSE. * immediatly else \p FALSE.
*/ */
BOOL chSchRescRequiredI(void) { t_bool chSchRescRequiredI(void) {
if (isempty(&rlist.r_queue)) if (isempty(&rlist.r_queue))
return FALSE; return FALSE;

View File

@ -40,8 +40,8 @@
* some data is written in the Queue. The value can be \p NULL. * some data is written in the Queue. The value can be \p NULL.
*/ */
void chFDDInit(FullDuplexDriver *sd, void chFDDInit(FullDuplexDriver *sd,
BYTE8 *ib, t_size isize, t_qnotify inotify, uint8_t *ib, t_size isize, t_qnotify inotify,
BYTE8 *ob, t_size osize, t_qnotify onotify) { uint8_t *ob, t_size osize, t_qnotify onotify) {
chIQInit(&sd->sd_iqueue, ib, isize, inotify); chIQInit(&sd->sd_iqueue, ib, isize, inotify);
chEvtInit(&sd->sd_ievent); chEvtInit(&sd->sd_ievent);
@ -57,7 +57,7 @@ void chFDDInit(FullDuplexDriver *sd,
* @param sd pointer to a \p FullDuplexDriver structure * @param sd pointer to a \p FullDuplexDriver structure
* @param b the byte to be written in the driver's Input Queue * @param b the byte to be written in the driver's Input Queue
*/ */
void chFDDIncomingDataI(FullDuplexDriver *sd, BYTE8 b) { void chFDDIncomingDataI(FullDuplexDriver *sd, uint8_t b) {
if (chIQPutI(&sd->sd_iqueue, b) < Q_OK) if (chIQPutI(&sd->sd_iqueue, b) < Q_OK)
chFDDAddFlagsI(sd, SD_OVERRUN_ERROR); chFDDAddFlagsI(sd, SD_OVERRUN_ERROR);
@ -122,7 +122,7 @@ t_dflags chFDDGetAndClearFlags(FullDuplexDriver *sd) {
* @param onotify pointer to a callback function that is invoked when * @param onotify pointer to a callback function that is invoked when
* some data is written in the queue. The value can be \p NULL. * some data is written in the queue. The value can be \p NULL.
*/ */
void chHDDInit(HalfDuplexDriver *sd, BYTE8 *b, t_size size, void chHDDInit(HalfDuplexDriver *sd, uint8_t *b, t_size size,
t_qnotify inotify, t_qnotify onotify) { t_qnotify inotify, t_qnotify onotify) {
chHDQInit(&sd->sd_queue, b, size, inotify, onotify); chHDQInit(&sd->sd_queue, b, size, inotify, onotify);
@ -138,7 +138,7 @@ void chHDDInit(HalfDuplexDriver *sd, BYTE8 *b, t_size size,
* @param sd pointer to a \p FullDuplexDriver structure * @param sd pointer to a \p FullDuplexDriver structure
* @param b the byte to be written in the driver's Input Queue * @param b the byte to be written in the driver's Input Queue
*/ */
void chHDDIncomingDataI(HalfDuplexDriver *sd, BYTE8 b) { void chHDDIncomingDataI(HalfDuplexDriver *sd, uint8_t b) {
if (chHDQPutReceiveI(&sd->sd_queue, b) < Q_OK) if (chHDQPutReceiveI(&sd->sd_queue, b) < Q_OK)
chHDDAddFlagsI(sd, SD_OVERRUN_ERROR); chHDDAddFlagsI(sd, SD_OVERRUN_ERROR);

View File

@ -53,7 +53,7 @@ void _InitThread(t_prio prio, t_tmode mode, Thread *tp) {
} }
#ifdef CH_USE_DEBUG #ifdef CH_USE_DEBUG
static void memfill(BYTE8 *p, ULONG32 n, BYTE8 v) { static void memfill(uint8_t *p, uint32_t n, uint8_t v) {
while (n) while (n)
*p++ = v, n--; *p++ = v, n--;

View File

@ -44,8 +44,8 @@ extern "C" {
void chMtxInit(Mutex *mp); void chMtxInit(Mutex *mp);
void chMtxLock(Mutex *mp); void chMtxLock(Mutex *mp);
void chMtxLockS(Mutex *mp); void chMtxLockS(Mutex *mp);
BOOL chMtxTryLock(Mutex *mp); t_bool chMtxTryLock(Mutex *mp);
BOOL chMtxTryLockS(Mutex *mp); t_bool chMtxTryLockS(Mutex *mp);
void chMtxUnlock(void); void chMtxUnlock(void);
void chMtxUnlockS(void); void chMtxUnlockS(void);
void chMtxUnlockAll(void); void chMtxUnlockAll(void);

View File

@ -46,13 +46,13 @@ typedef void (*t_qnotify)(void);
*/ */
typedef struct { typedef struct {
/** Pointer to the queue buffer.*/ /** Pointer to the queue buffer.*/
BYTE8 *q_buffer; uint8_t *q_buffer;
/** Pointer to the first location after the buffer.*/ /** Pointer to the first location after the buffer.*/
BYTE8 *q_top; uint8_t *q_top;
/** Write pointer.*/ /** Write pointer.*/
BYTE8 *q_wrptr; uint8_t *q_wrptr;
/** Read pointer.*/ /** Read pointer.*/
BYTE8 *q_rdptr; uint8_t *q_rdptr;
/** Counter semaphore.*/ /** Counter semaphore.*/
Semaphore q_sem; Semaphore q_sem;
/** Data notification callback.*/ /** Data notification callback.*/
@ -91,11 +91,11 @@ extern "C" {
* Input Queues functions. An Input Queue is usually written into by an * Input Queues functions. An Input Queue is usually written into by an
* interrupt handler and read from a thread. * interrupt handler and read from a thread.
*/ */
void chIQInit(Queue *qp, BYTE8 *buffer, t_size size, t_qnotify inotify); void chIQInit(Queue *qp, uint8_t *buffer, t_size size, t_qnotify inotify);
void chIQReset(Queue *qp); void chIQReset(Queue *qp);
t_msg chIQPutI(Queue *qp, BYTE8 b); t_msg chIQPutI(Queue *qp, uint8_t b);
t_msg chIQGet(Queue *qp); t_msg chIQGet(Queue *qp);
t_size chIQRead(Queue *qp, BYTE8 *buffer, t_size n); t_size chIQRead(Queue *qp, uint8_t *buffer, t_size n);
#ifdef CH_USE_QUEUES_TIMEOUT #ifdef CH_USE_QUEUES_TIMEOUT
t_msg chIQGetTimeout(Queue *qp, t_time time); t_msg chIQGetTimeout(Queue *qp, t_time time);
#endif #endif
@ -104,11 +104,11 @@ extern "C" {
* Output Queues functions. An Output Queue is usually written into by a * Output Queues functions. An Output Queue is usually written into by a
* thread and read from an interrupt handler. * thread and read from an interrupt handler.
*/ */
void chOQInit(Queue *queue, BYTE8 *buffer, t_size size, t_qnotify onotify); void chOQInit(Queue *queue, uint8_t *buffer, t_size size, t_qnotify onotify);
void chOQReset(Queue *queue); void chOQReset(Queue *queue);
void chOQPut(Queue *queue, BYTE8 b); void chOQPut(Queue *queue, uint8_t b);
t_msg chOQGetI(Queue *queue); t_msg chOQGetI(Queue *queue);
t_size chOQWrite(Queue *queue, BYTE8 *buffer, t_size n); t_size chOQWrite(Queue *queue, uint8_t *buffer, t_size n);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
@ -120,13 +120,13 @@ extern "C" {
*/ */
typedef struct { typedef struct {
/** Pointer to the queue buffer.*/ /** Pointer to the queue buffer.*/
BYTE8 *hdq_buffer; uint8_t *hdq_buffer;
/** Pointer to the first location after the buffer.*/ /** Pointer to the first location after the buffer.*/
BYTE8 *hdq_top; uint8_t *hdq_top;
/** Write pointer.*/ /** Write pointer.*/
BYTE8 *hdq_wrptr; uint8_t *hdq_wrptr;
/** Read pointer.*/ /** Read pointer.*/
BYTE8 *hdq_rdptr; uint8_t *hdq_rdptr;
/** Input counter semaphore.*/ /** Input counter semaphore.*/
Semaphore hdq_isem; Semaphore hdq_isem;
/** Output counter semaphore.*/ /** Output counter semaphore.*/
@ -164,12 +164,12 @@ typedef struct {
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void chHDQInit(HalfDuplexQueue *qp, BYTE8 *buffer, t_size size, void chHDQInit(HalfDuplexQueue *qp, uint8_t *buffer, t_size size,
t_qnotify inotify, t_qnotify onotify); t_qnotify inotify, t_qnotify onotify);
t_msg chHDQGetReceive(HalfDuplexQueue *qp); t_msg chHDQGetReceive(HalfDuplexQueue *qp);
void chHDQPutTransmit(HalfDuplexQueue *qp, BYTE8 b); void chHDQPutTransmit(HalfDuplexQueue *qp, uint8_t b);
t_msg chHDQGetTransmitI(HalfDuplexQueue *qp); t_msg chHDQGetTransmitI(HalfDuplexQueue *qp);
t_msg chHDQPutReceiveI(HalfDuplexQueue *qp, BYTE8 b); t_msg chHDQPutReceiveI(HalfDuplexQueue *qp, uint8_t b);
#ifdef CH_USE_QUEUES_TIMEOUT #ifdef CH_USE_QUEUES_TIMEOUT
t_msg chHDQGetReceiveTimeout(HalfDuplexQueue *qp, t_time time); t_msg chHDQGetReceiveTimeout(HalfDuplexQueue *qp, t_time time);
#endif #endif

View File

@ -64,7 +64,7 @@ extern "C" {
void chSchWakeupS(Thread *tp, t_msg msg); void chSchWakeupS(Thread *tp, t_msg msg);
void chSchDoRescheduleI(void); void chSchDoRescheduleI(void);
void chSchRescheduleS(void); void chSchRescheduleS(void);
BOOL chSchRescRequiredI(void); t_bool chSchRescRequiredI(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -41,7 +41,7 @@
#define SD_BREAK_DETECTED 32 #define SD_BREAK_DETECTED 32
/** Serial Driver condition flags type.*/ /** Serial Driver condition flags type.*/
typedef UWORD16 t_dflags; typedef uint16_t t_dflags;
#ifdef CH_USE_SERIAL_FULLDUPLEX #ifdef CH_USE_SERIAL_FULLDUPLEX
@ -76,9 +76,9 @@ typedef struct {
extern "C" { extern "C" {
#endif #endif
void chFDDInit(FullDuplexDriver *sd, void chFDDInit(FullDuplexDriver *sd,
BYTE8 *ib, t_size isize, t_qnotify inotify, uint8_t *ib, t_size isize, t_qnotify inotify,
BYTE8 *ob, t_size osize, t_qnotify onotify); uint8_t *ob, t_size osize, t_qnotify onotify);
void chFDDIncomingDataI(FullDuplexDriver *sd, BYTE8 b); void chFDDIncomingDataI(FullDuplexDriver *sd, uint8_t b);
t_msg chFDDRequestDataI(FullDuplexDriver *sd); t_msg chFDDRequestDataI(FullDuplexDriver *sd);
void chFDDAddFlagsI(FullDuplexDriver *sd, t_dflags mask); void chFDDAddFlagsI(FullDuplexDriver *sd, t_dflags mask);
t_dflags chFDDGetAndClearFlags(FullDuplexDriver *sd); t_dflags chFDDGetAndClearFlags(FullDuplexDriver *sd);
@ -137,9 +137,9 @@ typedef struct {
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void chHDDInit(HalfDuplexDriver *sd, BYTE8 *b, t_size size, void chHDDInit(HalfDuplexDriver *sd, uint8_t *b, t_size size,
t_qnotify inotify, t_qnotify onotify); t_qnotify inotify, t_qnotify onotify);
void chHDDIncomingDataI(HalfDuplexDriver *sd, BYTE8 b); void chHDDIncomingDataI(HalfDuplexDriver *sd, uint8_t b);
t_msg chHDDRequestDataI(HalfDuplexDriver *sd); t_msg chHDDRequestDataI(HalfDuplexDriver *sd);
void chHDDAddFlagsI(HalfDuplexDriver *sd, t_dflags mask); void chHDDAddFlagsI(HalfDuplexDriver *sd, t_dflags mask);
t_dflags chHDDGetAndClearFlags(HalfDuplexDriver *sd); t_dflags chHDDGetAndClearFlags(HalfDuplexDriver *sd);

View File

@ -25,27 +25,21 @@
#ifndef _CHTYPES_H_ #ifndef _CHTYPES_H_
#define _CHTYPES_H_ #define _CHTYPES_H_
/* #if !defined(_STDINT_H) && !defined(__STDINT_H_)
* Generic types often dependant on the compiler. #include <stdint.h>
*/ #endif
#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; /* Thread mode flags, BYTE8 is ok. */ typedef int8_t bool_t;
typedef BYTE8 t_tstate; /* Thread state, BYTE8 is ok. */ typedef uint8_t t_tmode; /* Thread mode flags, BYTE8 is ok. */
typedef UWORD16 t_tid; /* Thread id. */ typedef uint8_t t_tstate; /* Thread state, BYTE8 is ok. */
typedef ULONG32 t_prio; /* Priority, use the fastest unsigned type. */ typedef uint16_t t_tid; /* Thread id. */
typedef LONG32 t_msg; /* Message, use signed pointer equivalent.*/ typedef uint32_t t_prio; /* Priority, use the fastest unsigned type. */
typedef LONG32 t_eventid; /* Event Id, use fastest signed.*/ typedef int32_t t_msg; /* Message, use signed pointer equivalent.*/
typedef ULONG32 t_eventmask;/* Event Mask, recommended fastest unsigned.*/ typedef int32_t t_eventid; /* Event Id, use fastest signed.*/
typedef ULONG32 t_time; /* Time, recommended fastest unsigned.*/ typedef uint32_t t_eventmask;/* Event Mask, recommended fastest unsigned.*/
typedef LONG32 t_cnt; /* Counter, recommended fastest signed.*/ typedef uint32_t t_time; /* Time, recommended fastest unsigned.*/
typedef ULONG32 t_size; /* Size, use unsigned pointer equivalent.*/ typedef int32_t t_cnt; /* Counter, recommended fastest signed.*/
typedef uint32_t t_size; /* Size, use unsigned pointer equivalent.*/
#define INLINE inline #define INLINE inline

View File

@ -103,21 +103,21 @@ t_time wait_tick(void) {
t_msg Thread1(void *p) { t_msg Thread1(void *p) {
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
return 0; return 0;
} }
t_msg Thread2(void *p) { t_msg Thread2(void *p) {
chSemWait(&sem1); chSemWait(&sem1);
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
return 0; return 0;
} }
t_msg Thread3(void *p) { t_msg Thread3(void *p) {
chMtxLock(&m1); chMtxLock(&m1);
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
chMtxUnlock(); chMtxUnlock();
return 0; return 0;
} }
@ -220,7 +220,7 @@ t_msg Thread8(void *p) {
chThdSleep(5); chThdSleep(5);
chMtxLock(&m1); chMtxLock(&m1);
chMtxUnlock(); chMtxUnlock();
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
return 0; return 0;
} }
@ -229,7 +229,7 @@ t_msg Thread9(void *p) {
chMtxLock(&m1); chMtxLock(&m1);
chThdSleep(20); chThdSleep(20);
chMtxUnlock(); chMtxUnlock();
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
return 0; return 0;
} }
@ -237,7 +237,7 @@ t_msg Thread10(void *p) {
chThdSleep(10); chThdSleep(10);
CPU(50); CPU(50);
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
return 0; return 0;
} }
@ -246,7 +246,7 @@ t_msg Thread11(void *p) {
chThdSleep(5); chThdSleep(5);
chSemWait(&sem1); chSemWait(&sem1);
chSemSignal(&sem1); chSemSignal(&sem1);
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
return 0; return 0;
} }
@ -255,7 +255,7 @@ t_msg Thread12(void *p) {
chSemWait(&sem1); chSemWait(&sem1);
chThdSleep(20); chThdSleep(20);
chSemSignal(&sem1); chSemSignal(&sem1);
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
return 0; return 0;
} }
@ -296,7 +296,7 @@ t_msg Thread13(void *p) {
chMtxLock(&m1); chMtxLock(&m1);
CPU(50); CPU(50);
chMtxUnlock(); chMtxUnlock();
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
return 0; return 0;
} }
@ -310,7 +310,7 @@ t_msg Thread14(void *p) {
chMtxUnlock(); chMtxUnlock();
CPU(20); CPU(20);
chMtxUnlock(); chMtxUnlock();
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
return 0; return 0;
} }
@ -320,7 +320,7 @@ t_msg Thread15(void *p) {
chMtxLock(&m2); chMtxLock(&m2);
CPU(50); CPU(50);
chMtxUnlock(); chMtxUnlock();
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
return 0; return 0;
} }
@ -328,7 +328,7 @@ t_msg Thread16(void *p) {
chThdSleep(40); chThdSleep(40);
CPU(200); CPU(200);
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
return 0; return 0;
} }
@ -338,7 +338,7 @@ t_msg Thread17(void *p) {
chMtxLock(&m2); chMtxLock(&m2);
CPU(50); CPU(50);
chMtxUnlock(); chMtxUnlock();
chFDDPut(comp, *(BYTE8 *)p); chFDDPut(comp, *(uint8_t *)p);
return 0; return 0;
} }
@ -480,7 +480,7 @@ void bench4(void) {
__attribute__((noinline)) __attribute__((noinline))
void bench5(void) { void bench5(void) {
static BYTE8 ib[16]; static uint8_t ib[16];
static Queue iq; static Queue iq;
unsigned int i; unsigned int i;
t_time time; t_time time;