which allows us to put the TTY buffer in high memory.
} h;
} ticks_t;
+#define __read_hidata(p) \
+ ({ \
+ uint8_t r; \
+ asm ("movx.b 0x10000(%1), %0" \
+ : "=g" (r) \
+ : "r" (p)); \
+ r; \
+ })
+
+#define __write_hidata(p, v) \
+ ({ \
+ asm volatile ("movx.b %0, 0x10000(%1)" \
+ : \
+ : "g" (v), "r" (p)); \
+ })
+
#define used(x)
#define cpu_to_le16(x) (x)
if (q->q_count == q->q_size)
r = false; // no space left :(
else {
- *(q->q_tail) = c;
+ PUTQ(q->q_tail, c);
++q->q_count;
if (++q->q_tail >= q->q_base + q->q_size)
q->q_tail = q->q_base;
if (!q->q_count)
r = false;
else {
- *cp = *(q->q_head);
+ *cp = GETQ(q->q_head);
--q->q_count;
if (++q->q_head >= q->q_base + q->q_size)
q->q_head = q->q_base;
--q->q_count;
if (--q->q_tail < q->q_base)
q->q_tail = q->q_base + q->q_size - 1;
- *cp = *(q->q_tail);
+ *cp = GETQ(q->q_tail);
r = true;
}
irqrestore(irq);
#define __FUZIX__KERNEL_DOT_H__
#include <stdbool.h>
+#include <stdint.h>
#include "config.h"
#include "cpu.h"
#define NO_FILE (0xFF)
typedef struct s_queue {
- unsigned char *q_base; /* Pointer to data */
- unsigned char *q_head; /* Pointer to addr of next char to read. */
- unsigned char *q_tail; /* Pointer to where next char to insert goes. */
+ #if defined CONFIG_INDIRECT_QUEUES
+ queueptr_t q_base; /* Pointer to data */
+ queueptr_t q_head; /* Pointer to addr of next char to read. */
+ queueptr_t q_tail; /* Pointer to where next char to insert goes. */
+ #else
+ unsigned char *q_base; /* Pointer to data */
+ unsigned char *q_head; /* Pointer to addr of next char to read. */
+ unsigned char *q_tail; /* Pointer to where next char to insert goes. */
+ #endif
int q_size; /* Max size of queue */
int q_count; /* How many characters presently in queue */
int q_wakeup; /* Threshold for waking up processes waiting on queue */
} queue_t;
+#if !defined CONFIG_INDIRECT_QUEUES
+ #define GETQ(p) (*(p))
+ #define PUTQ(p, v) (*(p) = (v))
+#endif
+
struct tms {
clock_t tms_utime;
clock_t tms_stime;
/* Video terminal, not a serial tty */
#undef CONFIG_VT
+/* To save space, queues go in high memory. */
+#define CONFIG_INDIRECT_QUEUES
+typedef uint16_t queueptr_t;
+#define GETQ(p) __read_hidata(p)
+#define PUTQ(p, v) __write_hidata((p), (v))
+
extern int __user_base;
extern int __user_top;
#define NDEVS 1 /* Devices 0..NDEVS-1 are capable of being mounted */
/* (add new mountable devices to beginning area.) */
#define TTYDEV BOOT_TTY /* Device used by kernel for messages, panics */
-#define TTYSIZ 80 /* Size of serial buffer */
#define NBUFS 4 /* Number of block buffers */
#define NMOUNTS 1 /* Number of mounts at a time */
#define UFTSIZE 15 /* Number of user files */
#include <tty.h>
#include "msp430fr5969.h"
-uint8_t tbuf1[TTYSIZ];
+__attribute__ ((section (".hidata"))) uint8_t ttybuf[TTYSIZ];
+#define ttybuf_hi (queueptr_t)ttybuf
struct s_queue ttyinq[NUM_DEV_TTY+1] = { /* ttyinq[0] is never used */
- { NULL, NULL, NULL, 0, 0, 0 },
- { tbuf1, tbuf1, tbuf1, TTYSIZ, 0, TTYSIZ/2 },
+ { 0, 0, 0, 0, 0, 0 },
+ { ttybuf_hi, ttybuf_hi, ttybuf_hi, TTYSIZ, 0, TTYSIZ/2 },
};
/* Output for the system console (kprintf etc) */
*(COMMON)
} > SRAM AT> HIROM
+ .hidata : {
+ . = ALIGN(2);
+ *(.hidata .hidata.*)
+ } > HIROM
+
/* Note that crt0 assumes this is a multiple of two; all the
start/stop symbols are also assumed word-aligned. */
PROVIDE(__romdata_start = LOADADDR(.data));