diff options
| author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-03-05 10:59:11 +0000 | 
|---|---|---|
| committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-03-05 10:59:11 +0000 | 
| commit | 5e64a9fec2e17d008b9488faa027d2beaa130a88 (patch) | |
| tree | 3ab9255111b62d78d755bc51d9e650e63b07be25 /demos | |
| parent | 0778745ee12a4f14c001bd205e05728cc01e9633 (diff) | |
| download | ChibiOS-5e64a9fec2e17d008b9488faa027d2beaa130a88.tar.gz ChibiOS-5e64a9fec2e17d008b9488faa027d2beaa130a88.tar.bz2 ChibiOS-5e64a9fec2e17d008b9488faa027d2beaa130a88.zip  | |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@215 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
| -rw-r--r-- | demos/ARM7-AT91SAM7X-GCC/main.c | 4 | ||||
| -rw-r--r-- | demos/ARM7-LPC214x-GCC-minimal/main.c | 4 | ||||
| -rw-r--r-- | demos/ARM7-LPC214x-GCC/buzzer.c | 4 | ||||
| -rw-r--r-- | demos/ARM7-LPC214x-GCC/buzzer.h | 4 | ||||
| -rw-r--r-- | demos/ARM7-LPC214x-GCC/main.c | 14 | ||||
| -rw-r--r-- | demos/ARM7-LPC214x-GCC/mmcsd.c | 16 | ||||
| -rw-r--r-- | demos/ARM7-LPC214x-GCC/mmcsd.h | 14 | ||||
| -rw-r--r-- | demos/AVR-ATmega128-GCC/main.c | 2 | ||||
| -rw-r--r-- | demos/Win32-MinGW/chcore.c | 2 | ||||
| -rw-r--r-- | demos/Win32-MinGW/chcore.h | 2 | ||||
| -rw-r--r-- | demos/Win32-MinGW/chtypes.h | 25 | ||||
| -rw-r--r-- | demos/Win32-MinGW/demo.c | 30 | 
12 files changed, 62 insertions, 59 deletions
diff --git a/demos/ARM7-AT91SAM7X-GCC/main.c b/demos/ARM7-AT91SAM7X-GCC/main.c index f2a3f3737..a255c9939 100644 --- a/demos/ARM7-AT91SAM7X-GCC/main.c +++ b/demos/ARM7-AT91SAM7X-GCC/main.c @@ -23,7 +23,7 @@  #include "sam7x_serial.h"
  static WorkingArea(waThread1, 64);
 -static t_msg Thread1(void *arg) {
 +static msg_t Thread1(void *arg) {
    while (TRUE) {
      AT91C_BASE_PIOB->PIO_SODR = PIOB_LCD_BL;            // LCD on.
 @@ -38,7 +38,7 @@ static t_msg Thread1(void *arg) {   * Entry point, the interrupts are disabled on entry.
   */
  int main(int argc, char **argv) {
 -  t_msg TestThread(void *p);
 +  msg_t TestThread(void *p);
    /*
     * The main() function becomes a thread here then the interrupts are
 diff --git a/demos/ARM7-LPC214x-GCC-minimal/main.c b/demos/ARM7-LPC214x-GCC-minimal/main.c index 18017f0b5..87d59dce0 100644 --- a/demos/ARM7-LPC214x-GCC-minimal/main.c +++ b/demos/ARM7-LPC214x-GCC-minimal/main.c @@ -25,7 +25,7 @@   * Red LEDs blinker thread, times are in milliseconds.
   */
  static WorkingArea(waThread1, 64);
 -static t_msg Thread1(void *arg) {
 +static msg_t Thread1(void *arg) {
    while (TRUE) {
      IO0CLR = 0x00000800;
 @@ -44,7 +44,7 @@ static t_msg Thread1(void *arg) {   * Yellow LED blinker thread, times are in milliseconds.
   */
  static WorkingArea(waThread2, 64);
 -static t_msg Thread2(void *arg) {
 +static msg_t Thread2(void *arg) {
    while (TRUE) {
      IO0CLR = 0x80000000;
 diff --git a/demos/ARM7-LPC214x-GCC/buzzer.c b/demos/ARM7-LPC214x-GCC/buzzer.c index 9ee122fe1..249b1542b 100644 --- a/demos/ARM7-LPC214x-GCC/buzzer.c +++ b/demos/ARM7-LPC214x-GCC/buzzer.c @@ -64,7 +64,7 @@ static void stop(void *p) {    chEvtSendI(&BuzzerSilentEventSource);
  }
 -void PlaySound(int freq, t_time duration) {
 +void PlaySound(int freq, systime_t duration) {
    static VirtualTimer bvt;
    TC *tc = T1Base;
 @@ -82,7 +82,7 @@ void PlaySound(int freq, t_time duration) {    chSysUnlock();
  }
 -void PlaySoundWait(int freq, t_time duration) {
 +void PlaySoundWait(int freq, systime_t duration) {
    TC *tc = T1Base;
    StopCounter(tc);
 diff --git a/demos/ARM7-LPC214x-GCC/buzzer.h b/demos/ARM7-LPC214x-GCC/buzzer.h index 464e081d8..734cb1a44 100644 --- a/demos/ARM7-LPC214x-GCC/buzzer.h +++ b/demos/ARM7-LPC214x-GCC/buzzer.h @@ -24,8 +24,8 @@  extern "C" {
  #endif
    void InitBuzzer(void);
 -  void PlaySound(int freq, t_time duration);
 -  void PlaySoundWait(int freq, t_time duration);
 +  void PlaySound(int freq, systime_t duration);
 +  void PlaySoundWait(int freq, systime_t duration);
  #ifdef __cplusplus
  }
  #endif
 diff --git a/demos/ARM7-LPC214x-GCC/main.c b/demos/ARM7-LPC214x-GCC/main.c index fe0b9342c..ad2ab2700 100644 --- a/demos/ARM7-LPC214x-GCC/main.c +++ b/demos/ARM7-LPC214x-GCC/main.c @@ -29,7 +29,7 @@   * Red LEDs blinker thread, times are in milliseconds.
   */
  static WorkingArea(waThread1, 64);
 -static t_msg Thread1(void *arg) {
 +static msg_t Thread1(void *arg) {
    while (TRUE) {
      IO0CLR = 0x00000800;
 @@ -48,7 +48,7 @@ static t_msg Thread1(void *arg) {   * Yellow LED blinker thread, times are in milliseconds.
   */
  static WorkingArea(waThread2, 64);
 -static t_msg Thread2(void *arg) {
 +static msg_t Thread2(void *arg) {
    while (TRUE) {
      IO0CLR = 0x80000000;
 @@ -62,8 +62,8 @@ static t_msg Thread2(void *arg) {  /*
   * Executed as event handler at 500mS intervals.
   */
 -static void TimerHandler(t_eventid id) {
 -  t_msg TestThread(void *p);
 +static void TimerHandler(eventid_t id) {
 +  msg_t TestThread(void *p);
    if (!(IO0PIN & 0x00018000)) { // Both buttons
      TestThread(&COM1);
 @@ -83,7 +83,7 @@ static void TimerHandler(t_eventid id) {   * Plays sounds when a MMC/SD card is inserted, then initializes the MMC
   * driver and reads a sector.
   */
 -static void InsertHandler(t_eventid id) {
 +static void InsertHandler(eventid_t id) {
    static uint8_t rwbuf[512];
    MMCCSD data;
 @@ -102,7 +102,7 @@ static void InsertHandler(t_eventid id) {  /*
   * Plays sounds when a MMC/SD card is removed.
   */
 -static void RemoveHandler(t_eventid id) {
 +static void RemoveHandler(eventid_t id) {
    PlaySoundWait(2000, 100);
    PlaySoundWait(1000, 100);
 @@ -112,7 +112,7 @@ static void RemoveHandler(t_eventid id) {   * Entry point, the interrupts are disabled on entry.
   */
  int main(int argc, char **argv) {
 -  static const t_evhandler evhndl[] = {
 +  static const evhandler_t evhndl[] = {
      TimerHandler,
      InsertHandler,
      RemoveHandler
 diff --git a/demos/ARM7-LPC214x-GCC/mmcsd.c b/demos/ARM7-LPC214x-GCC/mmcsd.c index febfca237..c06123f88 100644 --- a/demos/ARM7-LPC214x-GCC/mmcsd.c +++ b/demos/ARM7-LPC214x-GCC/mmcsd.c @@ -91,7 +91,7 @@ void mmcStopPolling(void) {  /*
   * Returns TRUE if the card is safely inserted in the reader.
   */
 -t_bool mmcCardInserted (void) {
 +bool_t mmcCardInserted (void) {
    return cnt == 0;
  }
 @@ -145,7 +145,7 @@ static uint8_t recvr1(void) {    return 0xFF;                  /* Timeout.*/
  }
 -static t_bool getdata(uint8_t *buf, uint32_t n) {
 +static bool_t getdata(uint8_t *buf, uint32_t n) {
    int i;
    for (i = 0; i < MMC_WAIT_DATA; i++) {
 @@ -162,7 +162,7 @@ static t_bool getdata(uint8_t *buf, uint32_t n) {  /*
   * Initializes a card after the power up by selecting the SPI mode.
   */
 -t_bool mmcInit(void) {
 +bool_t mmcInit(void) {
    /*
     * Starting initialization with slow clock mode.
 @@ -222,7 +222,7 @@ uint8_t mmcSendCommand(uint8_t cmd, uint32_t arg) {   * @param data the pointer to a \p MMCCSD structure
   * @return \p TRUE if an error happened
   */
 -t_bool mmcGetSize(MMCCSD *data) {
 +bool_t mmcGetSize(MMCCSD *data) {
    uint8_t buf[16];
    sspAcquireBus();
 @@ -250,7 +250,7 @@ t_bool mmcGetSize(MMCCSD *data) {   * @param buf the pointer to the read buffer
   * @return \p TRUE if an error happened
   */
 -t_bool mmcRead(uint8_t *buf, uint32_t blknum) {
 +bool_t mmcRead(uint8_t *buf, uint32_t blknum) {
    sspAcquireBus();
    sendhdr(CMDREAD, blknum << 8);
 @@ -273,7 +273,7 @@ t_bool mmcRead(uint8_t *buf, uint32_t blknum) {   * @param buf the pointer to the read buffer
   * @return \p TRUE if an error happened
   */
 -t_bool mmcReadMultiple(uint8_t *buf, uint32_t blknum, uint32_t n) {
 +bool_t mmcReadMultiple(uint8_t *buf, uint32_t blknum, uint32_t n) {
    static const uint8_t stopcmd[] = {0x40 | CMDSTOP, 0, 0, 0, 0, 1, 0xFF};
    sspAcquireBus();
 @@ -309,7 +309,7 @@ t_bool mmcReadMultiple(uint8_t *buf, uint32_t blknum, uint32_t n) {   *       the card, this allows to not make useless busy waiting. The invoking
   *       thread can do other things while the data is being written.
   */
 -t_bool mmcWrite(uint8_t *buf, uint32_t blknum) {
 +bool_t mmcWrite(uint8_t *buf, uint32_t blknum) {
    static const uint8_t start[] = {0xFF, 0xFE};
    uint8_t b[4];
 @@ -340,7 +340,7 @@ t_bool mmcWrite(uint8_t *buf, uint32_t blknum) {   *       the card, this allows to not make useless busy waiting. The invoking
   *       thread can do other things while the data is being written.
   */
 -t_bool mmcWriteMultiple(uint8_t *buf, uint32_t blknum, uint32_t n) {
 +bool_t mmcWriteMultiple(uint8_t *buf, uint32_t blknum, uint32_t n) {
    static const uint8_t start[] = {0xFF, 0xFC},
                       stop[] = {0xFD, 0xFF};
    uint8_t b[4];
 diff --git a/demos/ARM7-LPC214x-GCC/mmcsd.h b/demos/ARM7-LPC214x-GCC/mmcsd.h index 60396dafb..d7ab4b348 100644 --- a/demos/ARM7-LPC214x-GCC/mmcsd.h +++ b/demos/ARM7-LPC214x-GCC/mmcsd.h @@ -48,16 +48,16 @@ extern EventSource MMCInsertEventSource, MMCRemoveEventSource;  #endif
    void InitMMC(void);
 -  t_bool mmcInit(void);
 +  bool_t mmcInit(void);
    void mmcStartPolling(void);
    void mmcStopPolling(void);
 -  t_bool mmcCardInserted (void);
 +  bool_t mmcCardInserted (void);
    uint8_t mmcSendCommand(uint8_t cmd, uint32_t arg);
 -  t_bool mmcGetSize(MMCCSD *data);
 -  t_bool mmcRead(uint8_t *buf, uint32_t blknum);
 -  t_bool mmcReadMultiple(uint8_t *buf, uint32_t blknum, uint32_t n);
 -  t_bool mmcWrite(uint8_t *buf, uint32_t blknum);
 -  t_bool mmcWriteMultiple(uint8_t *buf, uint32_t blknum, uint32_t n);
 +  bool_t mmcGetSize(MMCCSD *data);
 +  bool_t mmcRead(uint8_t *buf, uint32_t blknum);
 +  bool_t mmcReadMultiple(uint8_t *buf, uint32_t blknum, uint32_t n);
 +  bool_t mmcWrite(uint8_t *buf, uint32_t blknum);
 +  bool_t mmcWriteMultiple(uint8_t *buf, uint32_t blknum, uint32_t n);
    void mmcSynch(void);
  #ifdef __cplusplus
  }
 diff --git a/demos/AVR-ATmega128-GCC/main.c b/demos/AVR-ATmega128-GCC/main.c index b5103521e..48b263f3c 100644 --- a/demos/AVR-ATmega128-GCC/main.c +++ b/demos/AVR-ATmega128-GCC/main.c @@ -26,7 +26,7 @@  void hwinit(void);
  static WorkingArea(waThread1, 32);
 -static t_msg Thread1(void *arg) {
 +static msg_t Thread1(void *arg) {
    while (TRUE) {
      PORTA ^= PORTA_RELAY;
 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 <stddef.h>
 +
  #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;
 +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
  };
  | 
