From 077d372e2ffc959be1f13d23ee14d00a53589b4a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 23 Jul 2008 10:38:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@349 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARM7-AT91SAM7X-WEB-GCC/web/webthread.c | 12 ++++++------ demos/ARM7-LPC214x-GCC/buzzer.c | 2 +- demos/ARM7-LPC214x-GCC/mmcsd.c | 4 ++-- ports/ARM7-AT91SAM7X/sam7x_emac.c | 6 +++--- ports/ARM7-LPC214x/lpc214x_serial.c | 6 +++--- readme.txt | 7 ++++++- src/chevents.c | 6 +++--- src/chmsg.c | 2 +- src/chserial.c | 12 ++++++------ src/chthreads.c | 2 +- src/include/events.h | 10 ++++++++-- src/lib/evtimer.c | 2 +- 12 files changed, 41 insertions(+), 30 deletions(-) diff --git a/demos/ARM7-AT91SAM7X-WEB-GCC/web/webthread.c b/demos/ARM7-AT91SAM7X-WEB-GCC/web/webthread.c index 727cd3dc1..547437047 100644 --- a/demos/ARM7-AT91SAM7X-WEB-GCC/web/webthread.c +++ b/demos/ARM7-AT91SAM7X-WEB-GCC/web/webthread.c @@ -52,7 +52,7 @@ static void network_device_send(void) { for (i = 0; i < SEND_RETRY_MAX; i++) { if ((bdep = EMACGetTransmitBuffer()) != NULL) { uint8_t *bp = (uint8_t *)bdep->w1; - + if(uip_len <= UIP_LLH_LEN + UIP_TCPIP_HLEN) memcpy(bp, &uip_buf[0], uip_len); else { @@ -98,7 +98,7 @@ static void PeriodicTimerHandler(eventid_t id) { uip_arp_out(); network_device_send(); } - } + } } /* @@ -114,7 +114,7 @@ static void ARPTimerHandler(eventid_t id) { * Ethernet frame received. */ static void FrameReceivedHandler(eventid_t id) { - + while ((uip_len = network_device_read()) > 0) { if (BUF->type == HTONS(UIP_ETHTYPE_IP)) { uip_arp_ipin(); @@ -146,13 +146,13 @@ msg_t WebThread(void *p) { EvTimer evt1, evt2; EventListener el0, el1, el2; uip_ipaddr_t ipaddr; - + /* * Event sources setup. */ chEvtRegister(&EMACFrameReceived, &el0, FRAME_RECEIVED_ID); - chEvtSend(&EMACFrameReceived); /* In case some frames are already buffered */ - + chEvtBroadcast(&EMACFrameReceived); /* In case some frames are already buffered */ + evtInit(&evt1, CH_FREQUENCY / 2); evtStart(&evt1); chEvtRegister(&evt1.et_es, &el1, PERIODIC_TIMER_ID); diff --git a/demos/ARM7-LPC214x-GCC/buzzer.c b/demos/ARM7-LPC214x-GCC/buzzer.c index 249b1542b..25be0e2d9 100644 --- a/demos/ARM7-LPC214x-GCC/buzzer.c +++ b/demos/ARM7-LPC214x-GCC/buzzer.c @@ -61,7 +61,7 @@ static void stop(void *p) { TC *tc = T1Base; StopCounter(tc); - chEvtSendI(&BuzzerSilentEventSource); + chEvtBroadcastI(&BuzzerSilentEventSource); } void PlaySound(int freq, systime_t duration) { diff --git a/demos/ARM7-LPC214x-GCC/mmcsd.c b/demos/ARM7-LPC214x-GCC/mmcsd.c index 98d377406..bd1997fce 100644 --- a/demos/ARM7-LPC214x-GCC/mmcsd.c +++ b/demos/ARM7-LPC214x-GCC/mmcsd.c @@ -44,7 +44,7 @@ void tmrfunc(void *par) { if (cnt) { if (!(IO1PIN & (1 << 25))) { if (!--cnt) - chEvtSendI(&MMCInsertEventSource); + chEvtBroadcastI(&MMCInsertEventSource); } else cnt = POLLING_INTERVAL; @@ -52,7 +52,7 @@ void tmrfunc(void *par) { else { if (IO1PIN & (1 << 25)) { cnt = POLLING_INTERVAL; - chEvtSendI(&MMCRemoveEventSource); + chEvtBroadcastI(&MMCRemoveEventSource); } } chVTSetI(&vt, 10, tmrfunc, NULL); diff --git a/ports/ARM7-AT91SAM7X/sam7x_emac.c b/ports/ARM7-AT91SAM7X/sam7x_emac.c index e651c411e..9acfe530b 100644 --- a/ports/ARM7-AT91SAM7X/sam7x_emac.c +++ b/ports/ARM7-AT91SAM7X/sam7x_emac.c @@ -106,14 +106,14 @@ static void ServeInterrupt(void) { if ((isr & AT91C_EMAC_RCOMP) || (rsr & RSR_BITS)) { if (rsr & AT91C_EMAC_REC) { // received++; - chEvtSendI(&EMACFrameReceived); + chEvtBroadcastI(&EMACFrameReceived); } AT91C_BASE_EMAC->EMAC_RSR = RSR_BITS; } if ((isr & AT91C_EMAC_TCOMP) || (tsr & TSR_BITS)) { if (tsr & AT91C_EMAC_COMP) - chEvtSendI(&EMACFrameTransmitted); + chEvtBroadcastI(&EMACFrameTransmitted); AT91C_BASE_EMAC->EMAC_TSR = TSR_BITS; } AT91C_BASE_AIC->AIC_EOICR = 0; @@ -307,7 +307,7 @@ BufDescriptorEntry *EMACGetTransmitBuffer(void) { * Transmits a previously allocated buffer and then releases it. */ void EMACTransmit(BufDescriptorEntry *cptr, size_t size) { - + chDbgAssert(size <= EMAC_TRANSMIT_BUFFERS_SIZE, "sam7x_emac.c, EMACTransmit"); chSysLock(); diff --git a/ports/ARM7-LPC214x/lpc214x_serial.c b/ports/ARM7-LPC214x/lpc214x_serial.c index 76f706ccb..88a142ed0 100644 --- a/ports/ARM7-LPC214x/lpc214x_serial.c +++ b/ports/ARM7-LPC214x/lpc214x_serial.c @@ -65,7 +65,7 @@ static void ServeInterrupt(UART *u, FullDuplexDriver *com) { while (u->UART_LSR & LSR_RBR_FULL) if (chIQPutI(&com->sd_iqueue, u->UART_RBR) < Q_OK) chFDDAddFlagsI(com, SD_OVERRUN_ERROR); - chEvtSendI(&com->sd_ievent); + chEvtBroadcastI(&com->sd_ievent); break; case IIR_SRC_TX: { @@ -75,7 +75,7 @@ static void ServeInterrupt(UART *u, FullDuplexDriver *com) { msg_t b = chOQGetI(&com->sd_oqueue); if (b < Q_OK) { u->UART_IER &= ~IER_THRE; - chEvtSendI(&com->sd_oevent); + chEvtBroadcastI(&com->sd_oevent); break; } u->UART_THR = b; @@ -125,7 +125,7 @@ static void preload(UART *u, FullDuplexDriver *com) { do { msg_t b = chOQGetI(&com->sd_oqueue); if (b < Q_OK) { - chEvtSendI(&com->sd_oevent); + chEvtBroadcastI(&com->sd_oevent); return; } u->UART_THR = b; diff --git a/readme.txt b/readme.txt index 3040e095a..dd1dd166c 100644 --- a/readme.txt +++ b/readme.txt @@ -78,8 +78,13 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process, - FIX: Fixed a bug in the priority inheritance mechanism, the bug was only a problems when the CH_USE_MESSAGES_PRIORITY was enabled, this option is disabled by default in ChibiOS/RT so it should not affect any user. -- Merged the documentation fixes submitted by Leon Woestenberg (thank you). +- CHANGE: The function chEvtSend() and chEvtSendI() are now renamed in + chEvtBroadcast() and chEvtBroadcastI(), the old names are still available + but are deprecated. - Made the default BASEPRI levels (CM3 port) configurable into chcore.h. +- Many improvements to the documentation. +- All the fixes and changes in this release were suggested/submitted by + Leon Woestenberg (thank you). *** 0.6.7 *** - NEW: New chThdCreateFast() API, it is a simplified form of chThdCreate() diff --git a/src/chevents.c b/src/chevents.c index 93f28f0ec..87ba7ca95 100644 --- a/src/chevents.c +++ b/src/chevents.c @@ -90,11 +90,11 @@ void chEvtClear(eventmask_t mask) { * Signals all the Event Listeners registered on the specified Event Source. * @param esp pointer to the \p EventSource structure */ -void chEvtSend(EventSource *esp) { +void chEvtBroadcast(EventSource *esp) { chSysLock(); - chEvtSendI(esp); + chEvtBroadcastI(esp); chSchRescheduleS(); chSysUnlock(); @@ -105,7 +105,7 @@ void chEvtSend(EventSource *esp) { * @param esp pointer to the \p EventSource structure * @note This function does not reschedule. */ -void chEvtSendI(EventSource *esp) { +void chEvtBroadcastI(EventSource *esp) { EventListener *elp; elp = esp->es_next; diff --git a/src/chmsg.c b/src/chmsg.c index 8c6fa779f..bcc7117e2 100644 --- a/src/chmsg.c +++ b/src/chmsg.c @@ -83,7 +83,7 @@ msg_t chMsgSendWithEvent(Thread *tp, msg_t msg, EventSource *esp) { #else fifo_insert(currp, &tp->p_msgqueue); #endif - chEvtSendI(esp); + chEvtBroadcastI(esp); currp->p_wtthdp = tp; currp->p_msg = msg; chSchGoSleepS(PRSNDMSG); diff --git a/src/chserial.c b/src/chserial.c index b57dc96a4..f185c91fc 100644 --- a/src/chserial.c +++ b/src/chserial.c @@ -62,7 +62,7 @@ void chFDDIncomingDataI(FullDuplexDriver *sd, uint8_t b) { if (chIQPutI(&sd->sd_iqueue, b) < Q_OK) chFDDAddFlagsI(sd, SD_OVERRUN_ERROR); else - chEvtSendI(&sd->sd_ievent); + chEvtBroadcastI(&sd->sd_ievent); } /** @@ -78,7 +78,7 @@ msg_t chFDDRequestDataI(FullDuplexDriver *sd) { msg_t b = chOQGetI(&sd->sd_oqueue); if (b < Q_OK) - chEvtSendI(&sd->sd_oevent); + chEvtBroadcastI(&sd->sd_oevent); return b; } @@ -91,7 +91,7 @@ msg_t chFDDRequestDataI(FullDuplexDriver *sd) { void chFDDAddFlagsI(FullDuplexDriver *sd, dflags_t mask) { sd->sd_flags |= mask; - chEvtSendI(&sd->sd_sevent); + chEvtBroadcastI(&sd->sd_sevent); } /** @@ -143,7 +143,7 @@ void chHDDIncomingDataI(HalfDuplexDriver *sd, uint8_t b) { if (chHDQPutReceiveI(&sd->sd_queue, b) < Q_OK) chHDDAddFlagsI(sd, SD_OVERRUN_ERROR); else - chEvtSendI(&sd->sd_ievent); + chEvtBroadcastI(&sd->sd_ievent); } /** @@ -159,7 +159,7 @@ msg_t chHDDRequestDataI(HalfDuplexDriver *sd) { msg_t b = chHDQGetTransmitI(&sd->sd_queue); if (b < Q_OK) - chEvtSendI(&sd->sd_oevent); + chEvtBroadcastI(&sd->sd_oevent); return b; } @@ -172,7 +172,7 @@ msg_t chHDDRequestDataI(HalfDuplexDriver *sd) { void chHDDAddFlagsI(HalfDuplexDriver *sd, dflags_t mask) { sd->sd_flags |= mask; - chEvtSendI(&sd->sd_sevent); + chEvtBroadcastI(&sd->sd_sevent); } /** diff --git a/src/chthreads.c b/src/chthreads.c index 990b9bdba..02c2a7044 100644 --- a/src/chthreads.c +++ b/src/chthreads.c @@ -253,7 +253,7 @@ void chThdExit(msg_t msg) { chSchReadyI(list_remove(&currp->p_waiting)); #endif #ifdef CH_USE_EXIT_EVENT - chEvtSendI(&currp->p_exitesource); + chEvtBroadcastI(&currp->p_exitesource); #endif chSchGoSleepS(PREXIT); } diff --git a/src/include/events.h b/src/include/events.h index 30fa50ccb..28134d483 100644 --- a/src/include/events.h +++ b/src/include/events.h @@ -82,8 +82,8 @@ extern "C" { void chEvtRegister(EventSource *esp, EventListener *elp, eventid_t eid); void chEvtUnregister(EventSource *esp, EventListener *elp); void chEvtClear(eventmask_t mask); - void chEvtSend(EventSource *esp); - void chEvtSendI(EventSource *esp); + void chEvtBroadcast(EventSource *esp); + void chEvtBroadcastI(EventSource *esp); eventid_t chEvtWait(eventmask_t ewmask, const evhandler_t handlers[]); #ifdef CH_USE_EVENTS_TIMEOUT @@ -95,6 +95,12 @@ extern "C" { } #endif +/* + * Old function names, deprecated, will be removed in some next release. + */ +#define chEvtSend chEvtBroadcast +#define chEvtSendI chEvtBroadcastI + #endif /* CH_USE_EVENTS */ #endif /* _EVENTS_H_ */ diff --git a/src/lib/evtimer.c b/src/lib/evtimer.c index b273e1fd3..f9bd7449b 100644 --- a/src/lib/evtimer.c +++ b/src/lib/evtimer.c @@ -32,7 +32,7 @@ static void tmrcb(void *p) { EvTimer *etp = p; - chEvtSendI(&etp->et_es); + chEvtBroadcastI(&etp->et_es); chVTSetI(&etp->et_vt, etp->et_interval, tmrcb, etp); } -- cgit v1.2.3