Skip to content

Commit

Permalink
Minor fixes and updates by Carl Troein and Matthew Sheets
Browse files Browse the repository at this point in the history
Fixes/updates initiated by Carl were taken from the non-PowerFunctions updates posted to https://sourceforge.net/p/brickos/patches/27/
  • Loading branch information
mesheets committed Mar 5, 2020
1 parent 5c4414d commit 87bcd85
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 31 deletions.
34 changes: 32 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*.la
*.lo

# Shared objects (inc. Windows DLLs)
# Shared Objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
Expand All @@ -36,7 +36,7 @@
*.x86_64
*.hex

# Debug files
# Debug Files
*.dSYM/
*.su
*.idb
Expand All @@ -50,3 +50,33 @@ modules.order
Module.symvers
Mkfile.old
dkms.conf

# Makefile Configuration File
Makefile.config

# BrickOS / Bibo RCX Outputs
*.lx
kernel/bibo.srec

# BrickOS / Bibo Host Outputs
util/dll
util/firmdl
util/fontdesign
util/genlds
util/host/mkimg
util/ir-server
util/lnpmsg
util/makelx
xs/lisp/xsout-rcx
xs/xs
xs/xs-host
xs/xs-ir
xs/xs-rcx

# BrickOS / Bibo Intermediate Files
kernel/bibo.coff
kernel/bibo.lds
util/host/fastdl_*.h
util/include/


4 changes: 2 additions & 2 deletions Makefile.user
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ DLDFLAGS = -T $(DYNAMIC_LDS) -relax -L$(LIBDIR)
BASE1_DEFAULT = 0xb000
BASE2_DEFAULT = 0xb210

BASE1 = 0xb000
BASE2 = 0xb210
BASE1 = 0xabc0
BASE2 = 0xadd0

# Use precedence ordering for obtaining BASE1 and BASE2 values:
# $(BASEx) value from $(DYNAMIC_LDS) file, $(BASEx), and then $(BASEx)_DEFAULT
Expand Down
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Bibo is an alternative Lego MindStorms RCX operating system and firmware that
is a brickOS clone. The kernel was written from scratch to give better
performance, but to the average brickOS programmer, not much should change.
There is a lot of code borrowed from brickOS, and numerous patches originally
A lot of code was borrowed from brickOS, and numerous patches originally
targeted for brickOS have been conceptually incorporated. While this project
is based on bibo, as brickOS still seems to be the more recognizable name, it
has been retained as part of the name.
Expand Down Expand Up @@ -48,7 +48,7 @@ In case anyone is wondering, dll is short for dynamic linker and loader.

For more documentation, see in docs on the web at

http://hoenicke.ath.cx/rcx/bibo.html
https://jochen-hoenicke.de/rcx/bibo.html

or send me an email (you can find my address on the web page).

Expand Down
10 changes: 6 additions & 4 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@
//#define CONF_DSENSOR_VELOCITY //!< rotation sensor velocity
//#define CONF_DSENSOR_MUX //!< sensor multiplexor
//#define CONF_DSENSOR_SWMUX //!< techno-stuff swmux sensor
//#define CONF_DSENSOR_EDGECOUNT //!< edge counting for touch/light sensors
#define CONF_DSENSOR_EDGECOUNT //!< edge counting for touch/light sensors
//#define CONF_POWERFUNCTIONS //!< act as power functions remote control


// dependencies
//
#if defined(CONF_ASCII) && !defined(CONF_CONIO)
#error "Ascii needs console IO"
#error "ASCII needs console IO."
#endif

#if defined(CONF_DKEY) && !defined(CONF_TIME)
Expand Down Expand Up @@ -123,11 +125,11 @@
#endif

#if defined(CONF_LR_HANDLER) && !defined(CONF_TM)
#error "Remote support needs task managment"
#error "Remote support needs task managment."
#endif

#if defined(CONF_PROGRAM) && (!defined(CONF_TM) || !defined(CONF_LNP) || !defined(CONF_DKEY) || !defined(CONF_CONIO))
#error "Program support needs task management, networking, key debouncing, and ASCII."
#error "Program support needs task management, networking, key debouncing, and console IO."
#endif

#if defined(CONF_DCC) && !defined(CONF_DMOTOR)
Expand Down
7 changes: 7 additions & 0 deletions include/lnp-logical.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ extern inline void lnp_logical_range(int far) {
extern inline int lnp_logical_range_is_far(void) {
return !(*((char*)&PORT4)&1);
}

//! disable IR carrier frequency.
extern inline void carrier_shutdown(void);

//! enable IR carrier frequency.
extern void carrier_init(void);

#endif // ! CONF_HOST

//! Write buffer to IR port
Expand Down
2 changes: 1 addition & 1 deletion kernel/conio.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const char ascii_display_codes[] =
CHAR_u, // 117 u v w
CHAR_v, // 118 v
CHAR_w, // 119 w
CHAR_x // 120 X
CHAR_x, // 120 X
CHAR_y, // 121 Y
CHAR_z, // 122 Z

Expand Down
9 changes: 8 additions & 1 deletion kernel/kmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ void kmain(void)
#endif

dkey_multi = KEY_ONOFF;
#if defined(CONF_DSOUND) && defined(CONF_ON_OFF_SOUND)
show_on_off(on_text, on_sound);
#else
show_on_off(on_text, NULL);
#endif

cls();
#ifndef CONF_PROGRAM
Expand All @@ -164,8 +168,11 @@ void kmain(void)
#endif

// ON/OFF + VIEW -> erase firmware
#if defined(CONF_DSOUND) && defined(CONF_ON_OFF_SOUND)
reset_after_shutdown = show_on_off(off_text, off_sound);

#else
reset_after_shutdown = show_on_off(off_text, NULL);
#endif

#ifdef CONF_PROGRAM
program_shutdown();
Expand Down
2 changes: 1 addition & 1 deletion kernel/lnp-logical.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static timer_t allow_tx_timer = {
static waitqueue_t *lnp_waitqueue; //!< wait queue for transmitter

#ifdef CONF_TM
static sem_t tx_sem; //!< transmitter access semaphore
sem_t tx_sem; //!< transmitter access semaphore
#endif

///////////////////////////////////////////////////////////////////////////////
Expand Down
12 changes: 8 additions & 4 deletions util/host/firmdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ int main (int argc, char **argv)
if (usage || argc - optind != 1) {
char *usage_string =
RCX_COMM_OPTIONS
" -s , --standard standard mode download (2400 buad only)\n"
" -s , --standard standard mode download (2400 baud only)\n"
"\n"
RCX_COMM_OPTIONS_INFO
"\n"
Expand Down Expand Up @@ -361,11 +361,15 @@ int main (int argc, char **argv)

int currently_uses_complements;
int i = 0;
int max_mode = (tty_t_usb == tty.type ? 1 : sizeof(baud_modes)/sizeof(int));
int found_rcx = FALSE;

fprintf(stdout, "Attempting to determine current baud rate...\n");
if(max_mode > 1) {
fprintf(stdout, "Attempting to determine current baud rate...\n");
}

// Loop through the baud modes to try to find the current baud rate
for (i = 0; i < sizeof(baud_modes); i++) {
for (i = 0; i < max_mode; i++) {
fprintf(stdout, " ...checking %d baud\n", baud_modes[i]);
rcx_init(&tty, tty_name, baud_modes[i], timeout, FALSE);
if (BADFILE == tty.fd) {
Expand Down Expand Up @@ -407,7 +411,7 @@ int main (int argc, char **argv)
}

if (use_complements && baud_modes[i] != 2400) {
fprintf(stderr, "%s: reset the rcx to use standared mode\n", progname);
fprintf(stderr, "%s: reset the rcx to use standard mode\n", progname);
exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion util/host/rcx_comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ int rcx_wakeup_tower (tty_t *tty, int timeout, int wakeup_timeout)

do {
if (__comm_debug) {
printf("wakeup tower writelen = %u\n", sizeof(msg));
printf("wakeup tower writelen = %u\n", (unsigned)sizeof(msg));
rcx_hexdump("WTW", msg, sizeof(msg), FALSE);
}
// We are looking for the echo, so we use lnp_logical_write_host
Expand Down
26 changes: 16 additions & 10 deletions xs/lisp/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
* Contributor(s): Taiichi Yuasa <[email protected]>
*/

#ifdef RCX
#include <config.h>
// Due to the size of XS, we will allow building without CONF_ASCII and instead just limit character and string functionality
#if defined(RCX) && !defined(CONF_ASCII)
#ifndef CONF_ASCII
#warning CONF_ASCII is disabled, so string and character functions will only output preset characters on the RCX
#endif
#endif

#ifndef RCX
#include <stdio.h>
Expand Down Expand Up @@ -1352,15 +1355,17 @@ object eval(object e) {
break;

case Lputs: {
#if (defined(RCX) && defined(CONF_ASCII)) || (!defined(RCX))
int i;
for (i = 4, e = base[0]; i >=0 && PAIRP(e); i--, e = CDR(e))
for (i = 4, e = base[0]; i >=0 && PAIRP(e); i--, e = CDR(e)) {
#if ((defined(RCX) && defined(CONF_ASCII)) || (!defined(RCX))
cputc(INTval(CAR(e)), i);
#else
// ASCII is not enabled on the RCX, so we cannot display the string
// Display a default text message instead
cputc_native_user(CHAR_A, CHAR_S, CHAR_C, CHAR_PARALLEL); // ASCII
#elif (defined(RCX) && defined(CONF_CONIO))
// ASCII is not enabled on the RCX, so we cannot display the string
// Display a default text message instead: "-ASCII"
cputc_native_5(CHAR_DASH);
cputc_native_user(CHAR_A, CHAR_S, CHAR_C, CHAR_PARALLEL); // ASCII
#endif
}
#ifndef RCX
show_lcd();
#endif
Expand All @@ -1369,11 +1374,12 @@ object eval(object e) {
case Lputc:
if (check_int_args(base)) goto LERROR;
// the second arg is between 0 (right-most) and 4 (left-most)
#if (defined(RCX) && defined(CONF_ASCII)) || (!defined(RCX))
#if ((defined(RCX) && defined(CONF_ASCII)) || (!defined(RCX))
cputc(INTval(e = base[0]), INTval(base[1]));
#else
// ASCII is not enabled on the RCX, so we cannot display the string
#elif (defined(RCX) && defined(CONF_CONIO))
// ASCII is not enabled on the RCX, so we cannot display the ASCII character
// Display a generic '-' in the requested position instead
e = base[0];
cputc_native(CHAR_DASH, INTval(base[1]));
#endif
#ifndef RCX
Expand Down
10 changes: 7 additions & 3 deletions xs/lisp/front.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,9 +828,11 @@ Object sharpSignMacroReader(FILE *in) {
case '\\':
c = inRead(in);
readToken(in);
if (tokenBuffer[0] == '\0')
if (tokenBuffer[0] == '\0') {
// NOTE: Processing of character literals happens here
// TODO: Convert ASCII characters to CONIO predefined characters for non-ASCII RCX
return newInteger(c);
else if (c == 's') {
} else if (c == 's') {
if (strcmp(tokenBuffer, "pace") == 0) return newInteger(' ');
} else if (c == 'n') {
if (strcmp(tokenBuffer, "ewline") == 0) return newInteger('\n');
Expand Down Expand Up @@ -930,8 +932,10 @@ Object charMacroReader(char c, FILE *in, int tokenAllowed) {
case '"':
openTokenBuffer();
while ((c = inRead(in)) != '"') {
if (cat(c) == CAsingleEscape)
if (cat(c) == CAsingleEscape) {
c = inRead(in);
}
// TODO: Convert ASCII character string to a string of CONIO predefined characters for non-ASCII RCX
addToToken(c);
}
closeTokenBuffer();
Expand Down

0 comments on commit 87bcd85

Please sign in to comment.