Adjusted LPC214x serial driver and MinGW demo because the latest changes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@942 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
a7b4044f9e
commit
1f7dd2586a
|
@ -83,7 +83,7 @@ static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) {
|
||||||
char *p = line;
|
char *p = line;
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
short c = chIQGet(&sd->sd_iqueue);
|
short c = chIQGet(&sd->d2.iqueue);
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (c == 4) {
|
if (c == 4) {
|
||||||
|
@ -162,8 +162,10 @@ static msg_t ShellThread(void *arg) {
|
||||||
Thread *tp;
|
Thread *tp;
|
||||||
WORKING_AREA(tarea, 2048);
|
WORKING_AREA(tarea, 2048);
|
||||||
|
|
||||||
chIQReset(&sd->sd_iqueue);
|
chSysLock();
|
||||||
chOQReset(&sd->sd_oqueue);
|
chIQResetI(&sd->d2.iqueue);
|
||||||
|
chOQResetI(&sd->d2.oqueue);
|
||||||
|
chSysUnlock();
|
||||||
PrintLineFDD(sd, "ChibiOS/RT Command Shell\r\n\n");
|
PrintLineFDD(sd, "ChibiOS/RT Command Shell\r\n\n");
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
PrintLineFDD(sd, "ch> ");
|
PrintLineFDD(sd, "ch> ");
|
||||||
|
@ -241,8 +243,11 @@ static void COM1Handler(eventid_t id) {
|
||||||
chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0);
|
chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0);
|
||||||
chThdResume(s1);
|
chThdResume(s1);
|
||||||
}
|
}
|
||||||
if ((flags & SD_DISCONNECTED) && (s1 != NULL))
|
if ((flags & SD_DISCONNECTED) && (s1 != NULL)) {
|
||||||
chIQReset(&COM1.sd_iqueue);
|
chSysLock();
|
||||||
|
chIQResetI(&COM1.d2.iqueue);
|
||||||
|
chSysUnlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static WORKING_AREA(s2area, 4096);
|
static WORKING_AREA(s2area, 4096);
|
||||||
|
@ -264,8 +269,11 @@ static void COM2Handler(eventid_t id) {
|
||||||
chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1);
|
chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1);
|
||||||
chThdResume(s2);
|
chThdResume(s2);
|
||||||
}
|
}
|
||||||
if ((flags & SD_DISCONNECTED) && (s2 != NULL))
|
if ((flags & SD_DISCONNECTED) && (s2 != NULL)) {
|
||||||
chIQReset(&COM2.sd_iqueue);
|
chSysLock();
|
||||||
|
chIQResetI(&COM2.d2.iqueue);
|
||||||
|
chSysUnlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static evhandler_t fhandlers[2] = {
|
static evhandler_t fhandlers[2] = {
|
||||||
|
@ -288,13 +296,13 @@ int main(void) {
|
||||||
cprint("Console service started on COM1, COM2\n");
|
cprint("Console service started on COM1, COM2\n");
|
||||||
cprint(" - Listening for connections on COM1\n");
|
cprint(" - Listening for connections on COM1\n");
|
||||||
chFDDGetAndClearFlags(&COM1);
|
chFDDGetAndClearFlags(&COM1);
|
||||||
chEvtRegister(&COM1.sd_sevent, &c1fel, 0);
|
chEvtRegister(&COM1.d2.sevent, &c1fel, 0);
|
||||||
cprint(" - Listening for connections on COM2\n");
|
cprint(" - Listening for connections on COM2\n");
|
||||||
chFDDGetAndClearFlags(&COM2);
|
chFDDGetAndClearFlags(&COM2);
|
||||||
chEvtRegister(&COM2.sd_sevent, &c2fel, 1);
|
chEvtRegister(&COM2.d2.sevent, &c2fel, 1);
|
||||||
while (!chThdShouldTerminate())
|
while (!chThdShouldTerminate())
|
||||||
chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS));
|
chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS));
|
||||||
chEvtUnregister(&COM2.sd_sevent, &c2fel); // Never invoked but this is an example...
|
chEvtUnregister(&COM2.d2.sevent, &c2fel); // Never invoked but this is an example...
|
||||||
chEvtUnregister(&COM1.sd_sevent, &c1fel); // Never invoked but this is an example...
|
chEvtUnregister(&COM1.d2.sevent, &c1fel); // Never invoked but this is an example...
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,12 +92,12 @@ static void ServeInterrupt(UART *u, FullDuplexDriver *com) {
|
||||||
case IIR_SRC_RX:
|
case IIR_SRC_RX:
|
||||||
while (u->UART_LSR & LSR_RBR_FULL) {
|
while (u->UART_LSR & LSR_RBR_FULL) {
|
||||||
chSysLockFromIsr();
|
chSysLockFromIsr();
|
||||||
if (chIQPutI(&com->sd_iqueue, u->UART_RBR) < Q_OK)
|
if (chIQPutI(&com->d2.iqueue, u->UART_RBR) < Q_OK)
|
||||||
chFDDAddFlagsI(com, SD_OVERRUN_ERROR);
|
chFDDAddFlagsI(com, SD_OVERRUN_ERROR);
|
||||||
chSysUnlockFromIsr();
|
chSysUnlockFromIsr();
|
||||||
}
|
}
|
||||||
chSysLockFromIsr();
|
chSysLockFromIsr();
|
||||||
chEvtBroadcastI(&com->sd_ievent);
|
chEvtBroadcastI(&com->d1.ievent);
|
||||||
chSysUnlockFromIsr();
|
chSysUnlockFromIsr();
|
||||||
break;
|
break;
|
||||||
case IIR_SRC_TX:
|
case IIR_SRC_TX:
|
||||||
|
@ -106,12 +106,12 @@ static void ServeInterrupt(UART *u, FullDuplexDriver *com) {
|
||||||
int i = UART_FIFO_PRELOAD;
|
int i = UART_FIFO_PRELOAD;
|
||||||
do {
|
do {
|
||||||
chSysLockFromIsr();
|
chSysLockFromIsr();
|
||||||
msg_t b = chOQGetI(&com->sd_oqueue);
|
msg_t b = chOQGetI(&com->d2.oqueue);
|
||||||
chSysUnlockFromIsr();
|
chSysUnlockFromIsr();
|
||||||
if (b < Q_OK) {
|
if (b < Q_OK) {
|
||||||
u->UART_IER &= ~IER_THRE;
|
u->UART_IER &= ~IER_THRE;
|
||||||
chSysLockFromIsr();
|
chSysLockFromIsr();
|
||||||
chEvtBroadcastI(&com->sd_oevent);
|
chEvtBroadcastI(&com->d1.oevent);
|
||||||
chSysUnlockFromIsr();
|
chSysUnlockFromIsr();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -141,11 +141,11 @@ static void preload(UART *u, FullDuplexDriver *com) {
|
||||||
int i = UART_FIFO_PRELOAD;
|
int i = UART_FIFO_PRELOAD;
|
||||||
do {
|
do {
|
||||||
chSysLockFromIsr();
|
chSysLockFromIsr();
|
||||||
msg_t b = chOQGetI(&com->sd_oqueue);
|
msg_t b = chOQGetI(&com->d2.oqueue);
|
||||||
chSysUnlockFromIsr();
|
chSysUnlockFromIsr();
|
||||||
if (b < Q_OK) {
|
if (b < Q_OK) {
|
||||||
chSysLockFromIsr();
|
chSysLockFromIsr();
|
||||||
chEvtBroadcastI(&com->sd_oevent);
|
chEvtBroadcastI(&com->d1.oevent);
|
||||||
chSysUnlockFromIsr();
|
chSysUnlockFromIsr();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
4
todo.txt
4
todo.txt
|
@ -7,8 +7,8 @@ X = In progress, some work done.
|
||||||
After 1.2.0:
|
After 1.2.0:
|
||||||
- Remove any instance of unnamed structures/unions.
|
- Remove any instance of unnamed structures/unions.
|
||||||
- Dedicated syscalls.c support for newlib users.
|
- Dedicated syscalls.c support for newlib users.
|
||||||
X Abstract I/O channels rather than just serial ports.
|
* Abstract I/O channels rather than just serial ports.
|
||||||
- Move the serial drivers implementations in library. Better keep the core
|
? Move the serial drivers implementations in library. Better keep the core
|
||||||
as compact as possible.
|
as compact as possible.
|
||||||
- Threads Pools manager in the library.
|
- Threads Pools manager in the library.
|
||||||
- New chThdCreate() that takes just two parameters, a pointer to a thread
|
- New chThdCreate() that takes just two parameters, a pointer to a thread
|
||||||
|
|
Loading…
Reference in New Issue