Browse Source

from bbb port

pull/1/head
Rafael Zurita 6 years ago
parent
commit
981437ae3a
  1. 3
      device/tty/ttyhandle_out.c
  2. 3
      include/spi.h
  3. 6
      include/stdio.h
  4. 6
      include/tty.h
  5. 44
      include/uart.h

3
device/tty/ttyhandle_out.c

@ -40,8 +40,9 @@ void ttyhandle_out(
/* Initialize uspace to the available space in the Tx FIFO */
//uspace = UART_FIFO_SIZE - csrptr->txfifo_lvl;
uspace = UART_FIFO_SIZE;
/* avr specific: just one byte of fifo so far */
uspace = UART_FIFO_SIZE;
/* While onboard FIFO is not full and the echo queue is */
/* nonempty, xmit chars from the echo queue */

3
include/spi.h

@ -1,5 +1,8 @@
/* spi.h - SPI definitions */
/* avr : this port does not use spi yet */
/* values below for another platform-arch */
struct spi_csreg {
volatile uint32 cr1;
volatile uint32 cr2;

6
include/stdio.h

@ -1,5 +1,7 @@
/* stdio.h - definintions and constants for standard I/O functions */
/* avr specific values. Original saved under orig/ folder */
/* Prototypes for formatted input functions */
@ -19,9 +21,7 @@ extern int32 fscanf(int32, char *, int32);
/* Prototypes for formatted output functions */
// RAFA extern int32 fprintf(int, char *, ...);
extern int fprintf(int, char *, ...);
// RAFA extern int32 printf(const char *, ...);
extern int printf(const char *, ...);
extern int32 sprintf(char *, char *, ...);
@ -32,7 +32,5 @@ extern int32 fgetc(int);
extern char *fgets(char *, int32, int32);
extern int32 fputc(int32, int32);
extern int32 fputs(char *, int32);
// RAFA extern int32 putchar(int32 c);
extern int putchar(int c);
// RAFA extern int32 getchar(void);
extern int getchar(void);

6
include/tty.h

@ -1,9 +1,9 @@
/* tty.h */
// RAFA #define TY_OBMINSP 20 /* Min space in buffer before */
/* avr specific values. Original saved under orig/ folder */
#define TY_OBMINSP 1 /* Min space in buffer before */
/* processes awakened to write*/
// RAFA #define TY_EBUFLEN 20 /* Size of echo queue */
#define TY_EBUFLEN 1 /* Size of echo queue */
/* Size constants */
@ -12,11 +12,9 @@
#define Ntty 1 /* Number of serial tty lines */
#endif
#ifndef TY_IBUFLEN
// RAFA #define TY_IBUFLEN 128 /* Num. chars in input queue */
#define TY_IBUFLEN 32 /* Num. chars in input queue */
#endif
#ifndef TY_OBUFLEN
// RAFA #define TY_OBUFLEN 64 /* Num. chars in output queue */
#define TY_OBUFLEN 8 /* Num. chars in output queue */
#endif

44
include/uart.h

@ -1,45 +1,9 @@
/* Xinu for STM32
*
* Original license applies
* Modifications for STM32 by Robin Krens
* Please see LICENSE and AUTHORS
*
* $LOG$
* 2019/11/11 - ROBIN KRENS
* Initial version
*
* $DESCRIPTION$
*
* */
/* avr specific */
/* Control register */
#define UART_EN 13
#define UART_INTR_RX 5
#define UART_INTR_TCIE 6
#define UART_INTR_TX 7
#define UART_TX_EN 3
#define UART_RX_EN 2
#define PARITY 12
/* Status register */
#define UART_RXNE 0x20
#define UART_TC 0x40
#define UART_TC_TXE 0xC0
#define UART_TEST 6
/* Not useful so far */
#define UART_FIFO_SIZE 1
#define UARTBUF 256
#define ECHO 1
struct uart_csreg {
volatile uint32 sr;
volatile uint32 dr;
volatile uint32 brr;
volatile uint32 cr1;
volatile uint32 cr2;
volatile uint32 cr3;
volatile uint32 gtr;
struct uart_csreg { /* avr does not use this so far */
char c;
};

Loading…
Cancel
Save