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

master
gdisirio 2008-07-23 10:38:16 +00:00
parent 6596113930
commit 077d372e2f
12 changed files with 41 additions and 30 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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();

View File

@ -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;

View File

@ -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()

View File

@ -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;

View File

@ -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);

View File

@ -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);
}
/**

View File

@ -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);
}

View File

@ -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_ */

View File

@ -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);
}