From: aleph Date: Fri, 14 Jan 2005 00:48:33 +0000 (+0000) Subject: Rename callbacks; SerialHardwareVT.txSending: New callback. X-Git-Tag: 1.0.0~902 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=24cde7d279418c3de27dabf5ec147476a211bca7;p=bertos.git Rename callbacks; SerialHardwareVT.txSending: New callback. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@339 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/drv/ser_dsp56k.c b/drv/ser_dsp56k.c index 901362d8..8085f9e2 100755 --- a/drv/ser_dsp56k.c +++ b/drv/ser_dsp56k.c @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.10 2005/01/14 00:48:33 aleph + *#* Rename callbacks; SerialHardwareVT.txSending: New callback. + *#* *#* Revision 1.9 2004/12/08 09:42:55 bernie *#* Add support for multiplexed serial ports. *#* @@ -138,6 +141,14 @@ static inline void enable_rx_irq(struct SerialHardware* _hw) enable_rx_irq_bare(regs); } +static inline bool tx_irq_enabled(struct SerialHardware* _hw) +{ + struct SCI* hw = (struct SCI*)_hw; + volatile struct REG_SCI_STRUCT* regs = hw->regs; + + return (regs->CR & REG_SCI_CR_TEIE); +} + static void tx_isr(const struct SCI *hw) { #pragma interrupt warn @@ -218,16 +229,12 @@ static void cleanup(struct SerialHardware* _hw) { struct SCI* hw = (struct SCI*)_hw; - // Wait until we finish sending everything - ser_drain(hw->serial); - ser_purge(hw->serial); - // Uninstall the ISRs disable_rx_irq(_hw); disable_tx_irq(_hw); irq_uninstall(hw->irq_tx); irq_uninstall(hw->irq_rx); -} +} static void setbaudrate(struct SerialHardware* _hw, unsigned long rate) { @@ -295,9 +302,10 @@ static const struct SerialHardwareVT SCI_VT = { .init = init, .cleanup = cleanup, - .setbaudrate = setbaudrate, - .setparity = setparity, - .enabletxirq = enable_tx_irq, + .setBaudrate = setbaudrate, + .setParity = setparity, + .txStart = enable_tx_irq, + .txSending = tx_irq_enabled, }; #if CONFIG_SER_MULTI @@ -305,9 +313,10 @@ static const struct SerialHardwareVT SCI_MULTI_VT = { .init = init_lock, .cleanup = cleanup_unlock, - .setbaudrate = setbaudrate, - .setparity = setparity, - .enabletxirq = enable_tx_irq, + .setBaudrate = setbaudrate, + .setParity = setparity, + .txStart = enable_tx_irq, + .txSending = tx_irq_enabled, }; #endif /* CONFIG_SER_MULTI */ diff --git a/drv/ser_p.h b/drv/ser_p.h index ed5ef1dd..6ae71a69 100755 --- a/drv/ser_p.h +++ b/drv/ser_p.h @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.7 2005/01/14 00:47:56 aleph + *#* Rename callbacks; SerialHardwareVT.txSending: New callback. + *#* *#* Revision 1.6 2004/12/08 08:56:58 bernie *#* Reformat. *#* @@ -42,9 +45,10 @@ struct SerialHardwareVT { void (*init)(struct SerialHardware *ctx, struct Serial *ser); void (*cleanup)(struct SerialHardware *ctx); - void (*setbaudrate)(struct SerialHardware *ctx, unsigned long rate); - void (*setparity)(struct SerialHardware *ctx, int parity); - void (*enabletxirq)(struct SerialHardware *ctx); + void (*setBaudrate)(struct SerialHardware *ctx, unsigned long rate); + void (*setParity)(struct SerialHardware *ctx, int parity); + void (*txStart)(struct SerialHardware *ctx); + bool (*txSending)(struct SerialHardware *ctx); }; struct SerialHardware