git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@349 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
6596113930
commit
077d372e2f
|
@ -52,7 +52,7 @@ static void network_device_send(void) {
|
||||||
for (i = 0; i < SEND_RETRY_MAX; i++) {
|
for (i = 0; i < SEND_RETRY_MAX; i++) {
|
||||||
if ((bdep = EMACGetTransmitBuffer()) != NULL) {
|
if ((bdep = EMACGetTransmitBuffer()) != NULL) {
|
||||||
uint8_t *bp = (uint8_t *)bdep->w1;
|
uint8_t *bp = (uint8_t *)bdep->w1;
|
||||||
|
|
||||||
if(uip_len <= UIP_LLH_LEN + UIP_TCPIP_HLEN)
|
if(uip_len <= UIP_LLH_LEN + UIP_TCPIP_HLEN)
|
||||||
memcpy(bp, &uip_buf[0], uip_len);
|
memcpy(bp, &uip_buf[0], uip_len);
|
||||||
else {
|
else {
|
||||||
|
@ -98,7 +98,7 @@ static void PeriodicTimerHandler(eventid_t id) {
|
||||||
uip_arp_out();
|
uip_arp_out();
|
||||||
network_device_send();
|
network_device_send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -114,7 +114,7 @@ static void ARPTimerHandler(eventid_t id) {
|
||||||
* Ethernet frame received.
|
* Ethernet frame received.
|
||||||
*/
|
*/
|
||||||
static void FrameReceivedHandler(eventid_t id) {
|
static void FrameReceivedHandler(eventid_t id) {
|
||||||
|
|
||||||
while ((uip_len = network_device_read()) > 0) {
|
while ((uip_len = network_device_read()) > 0) {
|
||||||
if (BUF->type == HTONS(UIP_ETHTYPE_IP)) {
|
if (BUF->type == HTONS(UIP_ETHTYPE_IP)) {
|
||||||
uip_arp_ipin();
|
uip_arp_ipin();
|
||||||
|
@ -146,13 +146,13 @@ msg_t WebThread(void *p) {
|
||||||
EvTimer evt1, evt2;
|
EvTimer evt1, evt2;
|
||||||
EventListener el0, el1, el2;
|
EventListener el0, el1, el2;
|
||||||
uip_ipaddr_t ipaddr;
|
uip_ipaddr_t ipaddr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Event sources setup.
|
* Event sources setup.
|
||||||
*/
|
*/
|
||||||
chEvtRegister(&EMACFrameReceived, &el0, FRAME_RECEIVED_ID);
|
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);
|
evtInit(&evt1, CH_FREQUENCY / 2);
|
||||||
evtStart(&evt1);
|
evtStart(&evt1);
|
||||||
chEvtRegister(&evt1.et_es, &el1, PERIODIC_TIMER_ID);
|
chEvtRegister(&evt1.et_es, &el1, PERIODIC_TIMER_ID);
|
||||||
|
|
|
@ -61,7 +61,7 @@ static void stop(void *p) {
|
||||||
TC *tc = T1Base;
|
TC *tc = T1Base;
|
||||||
|
|
||||||
StopCounter(tc);
|
StopCounter(tc);
|
||||||
chEvtSendI(&BuzzerSilentEventSource);
|
chEvtBroadcastI(&BuzzerSilentEventSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaySound(int freq, systime_t duration) {
|
void PlaySound(int freq, systime_t duration) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ void tmrfunc(void *par) {
|
||||||
if (cnt) {
|
if (cnt) {
|
||||||
if (!(IO1PIN & (1 << 25))) {
|
if (!(IO1PIN & (1 << 25))) {
|
||||||
if (!--cnt)
|
if (!--cnt)
|
||||||
chEvtSendI(&MMCInsertEventSource);
|
chEvtBroadcastI(&MMCInsertEventSource);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cnt = POLLING_INTERVAL;
|
cnt = POLLING_INTERVAL;
|
||||||
|
@ -52,7 +52,7 @@ void tmrfunc(void *par) {
|
||||||
else {
|
else {
|
||||||
if (IO1PIN & (1 << 25)) {
|
if (IO1PIN & (1 << 25)) {
|
||||||
cnt = POLLING_INTERVAL;
|
cnt = POLLING_INTERVAL;
|
||||||
chEvtSendI(&MMCRemoveEventSource);
|
chEvtBroadcastI(&MMCRemoveEventSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chVTSetI(&vt, 10, tmrfunc, NULL);
|
chVTSetI(&vt, 10, tmrfunc, NULL);
|
||||||
|
|
|
@ -106,14 +106,14 @@ static void ServeInterrupt(void) {
|
||||||
if ((isr & AT91C_EMAC_RCOMP) || (rsr & RSR_BITS)) {
|
if ((isr & AT91C_EMAC_RCOMP) || (rsr & RSR_BITS)) {
|
||||||
if (rsr & AT91C_EMAC_REC) {
|
if (rsr & AT91C_EMAC_REC) {
|
||||||
// received++;
|
// received++;
|
||||||
chEvtSendI(&EMACFrameReceived);
|
chEvtBroadcastI(&EMACFrameReceived);
|
||||||
}
|
}
|
||||||
AT91C_BASE_EMAC->EMAC_RSR = RSR_BITS;
|
AT91C_BASE_EMAC->EMAC_RSR = RSR_BITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((isr & AT91C_EMAC_TCOMP) || (tsr & TSR_BITS)) {
|
if ((isr & AT91C_EMAC_TCOMP) || (tsr & TSR_BITS)) {
|
||||||
if (tsr & AT91C_EMAC_COMP)
|
if (tsr & AT91C_EMAC_COMP)
|
||||||
chEvtSendI(&EMACFrameTransmitted);
|
chEvtBroadcastI(&EMACFrameTransmitted);
|
||||||
AT91C_BASE_EMAC->EMAC_TSR = TSR_BITS;
|
AT91C_BASE_EMAC->EMAC_TSR = TSR_BITS;
|
||||||
}
|
}
|
||||||
AT91C_BASE_AIC->AIC_EOICR = 0;
|
AT91C_BASE_AIC->AIC_EOICR = 0;
|
||||||
|
@ -307,7 +307,7 @@ BufDescriptorEntry *EMACGetTransmitBuffer(void) {
|
||||||
* Transmits a previously allocated buffer and then releases it.
|
* Transmits a previously allocated buffer and then releases it.
|
||||||
*/
|
*/
|
||||||
void EMACTransmit(BufDescriptorEntry *cptr, size_t size) {
|
void EMACTransmit(BufDescriptorEntry *cptr, size_t size) {
|
||||||
|
|
||||||
chDbgAssert(size <= EMAC_TRANSMIT_BUFFERS_SIZE, "sam7x_emac.c, EMACTransmit");
|
chDbgAssert(size <= EMAC_TRANSMIT_BUFFERS_SIZE, "sam7x_emac.c, EMACTransmit");
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
|
@ -65,7 +65,7 @@ static void ServeInterrupt(UART *u, FullDuplexDriver *com) {
|
||||||
while (u->UART_LSR & LSR_RBR_FULL)
|
while (u->UART_LSR & LSR_RBR_FULL)
|
||||||
if (chIQPutI(&com->sd_iqueue, u->UART_RBR) < Q_OK)
|
if (chIQPutI(&com->sd_iqueue, u->UART_RBR) < Q_OK)
|
||||||
chFDDAddFlagsI(com, SD_OVERRUN_ERROR);
|
chFDDAddFlagsI(com, SD_OVERRUN_ERROR);
|
||||||
chEvtSendI(&com->sd_ievent);
|
chEvtBroadcastI(&com->sd_ievent);
|
||||||
break;
|
break;
|
||||||
case IIR_SRC_TX:
|
case IIR_SRC_TX:
|
||||||
{
|
{
|
||||||
|
@ -75,7 +75,7 @@ static void ServeInterrupt(UART *u, FullDuplexDriver *com) {
|
||||||
msg_t b = chOQGetI(&com->sd_oqueue);
|
msg_t b = chOQGetI(&com->sd_oqueue);
|
||||||
if (b < Q_OK) {
|
if (b < Q_OK) {
|
||||||
u->UART_IER &= ~IER_THRE;
|
u->UART_IER &= ~IER_THRE;
|
||||||
chEvtSendI(&com->sd_oevent);
|
chEvtBroadcastI(&com->sd_oevent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
u->UART_THR = b;
|
u->UART_THR = b;
|
||||||
|
@ -125,7 +125,7 @@ static void preload(UART *u, FullDuplexDriver *com) {
|
||||||
do {
|
do {
|
||||||
msg_t b = chOQGetI(&com->sd_oqueue);
|
msg_t b = chOQGetI(&com->sd_oqueue);
|
||||||
if (b < Q_OK) {
|
if (b < Q_OK) {
|
||||||
chEvtSendI(&com->sd_oevent);
|
chEvtBroadcastI(&com->sd_oevent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
u->UART_THR = b;
|
u->UART_THR = b;
|
||||||
|
|
|
@ -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
|
- 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
|
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.
|
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.
|
- 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 ***
|
*** 0.6.7 ***
|
||||||
- NEW: New chThdCreateFast() API, it is a simplified form of chThdCreate()
|
- NEW: New chThdCreateFast() API, it is a simplified form of chThdCreate()
|
||||||
|
|
|
@ -90,11 +90,11 @@ void chEvtClear(eventmask_t mask) {
|
||||||
* Signals all the Event Listeners registered on the specified Event Source.
|
* Signals all the Event Listeners registered on the specified Event Source.
|
||||||
* @param esp pointer to the \p EventSource structure
|
* @param esp pointer to the \p EventSource structure
|
||||||
*/
|
*/
|
||||||
void chEvtSend(EventSource *esp) {
|
void chEvtBroadcast(EventSource *esp) {
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
chEvtSendI(esp);
|
chEvtBroadcastI(esp);
|
||||||
chSchRescheduleS();
|
chSchRescheduleS();
|
||||||
|
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
|
@ -105,7 +105,7 @@ void chEvtSend(EventSource *esp) {
|
||||||
* @param esp pointer to the \p EventSource structure
|
* @param esp pointer to the \p EventSource structure
|
||||||
* @note This function does not reschedule.
|
* @note This function does not reschedule.
|
||||||
*/
|
*/
|
||||||
void chEvtSendI(EventSource *esp) {
|
void chEvtBroadcastI(EventSource *esp) {
|
||||||
EventListener *elp;
|
EventListener *elp;
|
||||||
|
|
||||||
elp = esp->es_next;
|
elp = esp->es_next;
|
||||||
|
|
|
@ -83,7 +83,7 @@ msg_t chMsgSendWithEvent(Thread *tp, msg_t msg, EventSource *esp) {
|
||||||
#else
|
#else
|
||||||
fifo_insert(currp, &tp->p_msgqueue);
|
fifo_insert(currp, &tp->p_msgqueue);
|
||||||
#endif
|
#endif
|
||||||
chEvtSendI(esp);
|
chEvtBroadcastI(esp);
|
||||||
currp->p_wtthdp = tp;
|
currp->p_wtthdp = tp;
|
||||||
currp->p_msg = msg;
|
currp->p_msg = msg;
|
||||||
chSchGoSleepS(PRSNDMSG);
|
chSchGoSleepS(PRSNDMSG);
|
||||||
|
|
|
@ -62,7 +62,7 @@ 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);
|
||||||
else
|
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);
|
msg_t b = chOQGetI(&sd->sd_oqueue);
|
||||||
if (b < Q_OK)
|
if (b < Q_OK)
|
||||||
chEvtSendI(&sd->sd_oevent);
|
chEvtBroadcastI(&sd->sd_oevent);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ msg_t chFDDRequestDataI(FullDuplexDriver *sd) {
|
||||||
void chFDDAddFlagsI(FullDuplexDriver *sd, dflags_t mask) {
|
void chFDDAddFlagsI(FullDuplexDriver *sd, dflags_t mask) {
|
||||||
|
|
||||||
sd->sd_flags |= 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)
|
if (chHDQPutReceiveI(&sd->sd_queue, b) < Q_OK)
|
||||||
chHDDAddFlagsI(sd, SD_OVERRUN_ERROR);
|
chHDDAddFlagsI(sd, SD_OVERRUN_ERROR);
|
||||||
else
|
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);
|
msg_t b = chHDQGetTransmitI(&sd->sd_queue);
|
||||||
if (b < Q_OK)
|
if (b < Q_OK)
|
||||||
chEvtSendI(&sd->sd_oevent);
|
chEvtBroadcastI(&sd->sd_oevent);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ msg_t chHDDRequestDataI(HalfDuplexDriver *sd) {
|
||||||
void chHDDAddFlagsI(HalfDuplexDriver *sd, dflags_t mask) {
|
void chHDDAddFlagsI(HalfDuplexDriver *sd, dflags_t mask) {
|
||||||
|
|
||||||
sd->sd_flags |= mask;
|
sd->sd_flags |= mask;
|
||||||
chEvtSendI(&sd->sd_sevent);
|
chEvtBroadcastI(&sd->sd_sevent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -253,7 +253,7 @@ void chThdExit(msg_t msg) {
|
||||||
chSchReadyI(list_remove(&currp->p_waiting));
|
chSchReadyI(list_remove(&currp->p_waiting));
|
||||||
#endif
|
#endif
|
||||||
#ifdef CH_USE_EXIT_EVENT
|
#ifdef CH_USE_EXIT_EVENT
|
||||||
chEvtSendI(&currp->p_exitesource);
|
chEvtBroadcastI(&currp->p_exitesource);
|
||||||
#endif
|
#endif
|
||||||
chSchGoSleepS(PREXIT);
|
chSchGoSleepS(PREXIT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,8 @@ extern "C" {
|
||||||
void chEvtRegister(EventSource *esp, EventListener *elp, eventid_t eid);
|
void chEvtRegister(EventSource *esp, EventListener *elp, eventid_t eid);
|
||||||
void chEvtUnregister(EventSource *esp, EventListener *elp);
|
void chEvtUnregister(EventSource *esp, EventListener *elp);
|
||||||
void chEvtClear(eventmask_t mask);
|
void chEvtClear(eventmask_t mask);
|
||||||
void chEvtSend(EventSource *esp);
|
void chEvtBroadcast(EventSource *esp);
|
||||||
void chEvtSendI(EventSource *esp);
|
void chEvtBroadcastI(EventSource *esp);
|
||||||
eventid_t chEvtWait(eventmask_t ewmask,
|
eventid_t chEvtWait(eventmask_t ewmask,
|
||||||
const evhandler_t handlers[]);
|
const evhandler_t handlers[]);
|
||||||
#ifdef CH_USE_EVENTS_TIMEOUT
|
#ifdef CH_USE_EVENTS_TIMEOUT
|
||||||
|
@ -95,6 +95,12 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Old function names, deprecated, will be removed in some next release.
|
||||||
|
*/
|
||||||
|
#define chEvtSend chEvtBroadcast
|
||||||
|
#define chEvtSendI chEvtBroadcastI
|
||||||
|
|
||||||
#endif /* CH_USE_EVENTS */
|
#endif /* CH_USE_EVENTS */
|
||||||
|
|
||||||
#endif /* _EVENTS_H_ */
|
#endif /* _EVENTS_H_ */
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
static void tmrcb(void *p) {
|
static void tmrcb(void *p) {
|
||||||
EvTimer *etp = p;
|
EvTimer *etp = p;
|
||||||
|
|
||||||
chEvtSendI(&etp->et_es);
|
chEvtBroadcastI(&etp->et_es);
|
||||||
chVTSetI(&etp->et_vt, etp->et_interval, tmrcb, etp);
|
chVTSetI(&etp->et_vt, etp->et_interval, tmrcb, etp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue