Some gliches and filenames are changed regarding RS-232C driver.

This commit is contained in:
matsutsuka 2007-09-09 13:41:15 +00:00
parent 2f4970e61c
commit 259c5a00b9
3 changed files with 17 additions and 12 deletions

View file

@ -2,7 +2,7 @@
# Makefile for z80/SDCC # Makefile for z80/SDCC
# @author Takahide Matsutsuka <markn@markn.org> # @author Takahide Matsutsuka <markn@markn.org>
# #
# $Id: Makefile.z80,v 1.3 2007/09/09 12:20:12 matsutsuka Exp $ # $Id: Makefile.z80,v 1.4 2007/09/09 13:41:15 matsutsuka Exp $
# #
### Compiler definitions ### Compiler definitions
@ -21,7 +21,7 @@ AROPTS = -a
CONTIKI_CPU_DIRS = . dev lib CONTIKI_CPU_DIRS = . dev lib
CONTIKI_SOURCEFILES += strcasecmp.c mtarch.c uip_arch.c \ CONTIKI_SOURCEFILES += strcasecmp.c mtarch.c uip_arch.c \
log-conio.c libconio_arch.c rs-232.c libconio_arch.c log-conio.c rs232.c
CONTIKI_ASMFILES += uip_arch-asm.S CONTIKI_ASMFILES += uip_arch-asm.S
contiki-$(TARGET).o: $(CONTIKI_OBJECTFILES) $(PROJECT_OBJECTFILES) $(CONTIKI_ASMOBJECTFILES) contiki-$(TARGET).o: $(CONTIKI_OBJECTFILES) $(PROJECT_OBJECTFILES) $(CONTIKI_ASMOBJECTFILES)

View file

@ -27,7 +27,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: rs-232.c,v 1.1 2007/09/09 12:22:34 matsutsuka Exp $ * $Id: rs232.c,v 1.1 2007/09/09 13:41:15 matsutsuka Exp $
* *
*/ */
/* /*
@ -39,25 +39,30 @@
#include "contiki.h" #include "contiki.h"
#include "serial.h" #include "serial.h"
#include "rs-232.h" #include "rs232.h"
#include "log.h"
PROCESS(rs232_process, "RS323C polling process"); PROCESS(rs232_process, "RS-232C polling process");
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS_THREAD(rs232_process, ev, data) PROCESS_THREAD(rs232_process, ev, data)
{ {
static struct etimer timer;
char ch; char ch;
PROCESS_BEGIN(); PROCESS_BEGIN();
rs232_arch_init(); rs232_arch_init();
etimer_set(&timer, CLOCK_SECOND / 16);
while(1) { while(1) {
etimer_set(&timer, CLOCK_SECOND / 16);
PROCESS_WAIT_EVENT(); PROCESS_WAIT_EVENT();
if(ev == PROCESS_EVENT_TIMER) {
ch = rs232_poll(); if (etimer_expired(&timer)) {
ch = rs232_arch_poll();
if (ch != 0) { if (ch != 0) {
/* We have an input data */
serial_input_byte(ch); serial_input_byte(ch);
} }
etimer_reset(&timer);
} }
} }

View file

@ -27,7 +27,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: rs-232.h,v 1.1 2007/09/09 12:22:34 matsutsuka Exp $ * $Id: rs232.h,v 1.1 2007/09/09 13:41:15 matsutsuka Exp $
* *
*/ */
/* /*
@ -45,18 +45,18 @@
*/ */
/* /*
* RS-232C initialize. * An architecture-depend implementation of RS-232C initialization.
*/ */
void rs232_arch_init(void); void rs232_arch_init(void);
/* /*
* RS-232C polling. * An architecture-depend implementation of RS-232C polling.
* @return character, zero if no input. * @return character, zero if no input.
*/ */
unsigned char rs232_arch_poll(void); unsigned char rs232_arch_poll(void);
/* /*
* RS-232C write a byte. * An architecture-depend implementation of RS-232C writing a byte.
*/ */
void rs232_arch_writeb(u8_t ch); void rs232_arch_writeb(u8_t ch);