mirror of
https://github.com/vivier/EMILE.git
synced 2025-08-15 07:27:41 +00:00
Manage stopbits for serial, put parameters on a line alone, not inside kernel property
This commit is contained in:
@@ -43,7 +43,7 @@ static char *read_word(char *line, char **next)
|
|||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *decode_serial(char* s, int *baudrate, int *parity, int *datasize)
|
static char *decode_serial(char* s, int *baudrate, int *parity, int *datasize, int *stopbits)
|
||||||
{
|
{
|
||||||
*baudrate = strtol(s, &s, 0);
|
*baudrate = strtol(s, &s, 0);
|
||||||
switch(*s)
|
switch(*s)
|
||||||
@@ -66,11 +66,38 @@ static char *decode_serial(char* s, int *baudrate, int *parity, int *datasize)
|
|||||||
}
|
}
|
||||||
s++;
|
s++;
|
||||||
*datasize = strtol(s, &s, 0);
|
*datasize = strtol(s, &s, 0);
|
||||||
|
if (*s != '+')
|
||||||
|
return s;
|
||||||
|
s++;
|
||||||
|
*stopbits = strtol(s, &s, 0);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
int read_config_modem(char *conf, int *bitrate, int *parity, int *datasize)
|
int read_config_vga(char *conf)
|
||||||
|
{
|
||||||
|
char *next_word, *next_line, *name, *property;
|
||||||
|
int name_len;
|
||||||
|
|
||||||
|
next_line = conf;
|
||||||
|
|
||||||
|
while (*next_line)
|
||||||
|
{
|
||||||
|
next_word = next_line;
|
||||||
|
next_line = read_line(next_line);
|
||||||
|
name = read_word(next_word, &next_word);
|
||||||
|
name_len = next_word - name;
|
||||||
|
property = read_word(next_word, &next_word);
|
||||||
|
|
||||||
|
if (strncmp(name, "vga", name_len) == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int read_config_modem(char *conf, int *bitrate, int *parity, int *datasize, int *stopbits)
|
||||||
{
|
{
|
||||||
char *next_word, *next_line, *name, *property;
|
char *next_word, *next_line, *name, *property;
|
||||||
int name_len;
|
int name_len;
|
||||||
@@ -87,14 +114,14 @@ int read_config_modem(char *conf, int *bitrate, int *parity, int *datasize)
|
|||||||
|
|
||||||
if (strncmp(name, "modem", name_len) == 0)
|
if (strncmp(name, "modem", name_len) == 0)
|
||||||
{
|
{
|
||||||
decode_serial(property, bitrate, parity, datasize);
|
decode_serial(property, bitrate, parity, datasize, stopbits);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int read_config_printer(char *conf, int *bitrate, int *parity, int *datasize)
|
int read_config_printer(char *conf, int *bitrate, int *parity, int *datasize, int *stopbits)
|
||||||
{
|
{
|
||||||
char *next_word, *next_line, *name, *property;
|
char *next_word, *next_line, *name, *property;
|
||||||
int name_len;
|
int name_len;
|
||||||
@@ -110,7 +137,7 @@ int read_config_printer(char *conf, int *bitrate, int *parity, int *datasize)
|
|||||||
|
|
||||||
if (strncmp(name, "printer", name_len) == 0)
|
if (strncmp(name, "printer", name_len) == 0)
|
||||||
{
|
{
|
||||||
decode_serial(property, bitrate, parity, datasize);
|
decode_serial(property, bitrate, parity, datasize, stopbits);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,20 +170,17 @@ int read_config(emile_l2_header_t* info,
|
|||||||
*next_word++ = 0;
|
*next_word++ = 0;
|
||||||
|
|
||||||
property = read_word(next_word, &next_word);
|
property = read_word(next_word, &next_word);
|
||||||
*next_word++ = 0;
|
|
||||||
|
|
||||||
if (strcmp(name, "kernel") == 0)
|
if (strcmp(name, "kernel") == 0)
|
||||||
{
|
{
|
||||||
*kernel_path = property;
|
*kernel_path = property;
|
||||||
|
} else if (strcmp(name, "parameters") == 0) {
|
||||||
#if defined(USE_CLI) && defined(__LINUX__)
|
#if defined(USE_CLI) && defined(__LINUX__)
|
||||||
*command_line = parameters;
|
*command_line = parameters;
|
||||||
if (next_word != next_line)
|
strncpy(parameters, property, COMMAND_LINE_LENGTH);
|
||||||
strncpy(parameters, next_word, COMMAND_LINE_LENGTH);
|
|
||||||
else
|
|
||||||
parameters[0] = 0;
|
|
||||||
#else
|
#else
|
||||||
if (next_word != next_line)
|
if (next_word != next_line)
|
||||||
*command_line = next_word;
|
*command_line = property;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (strcmp(name, "initrd") == 0)
|
else if (strcmp(name, "initrd") == 0)
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
#include "head.h"
|
#include "head.h"
|
||||||
|
|
||||||
extern int read_config(emile_l2_header_t* info, char **kernel_path, char **command_line, char **ramdisk_path);
|
extern int read_config(emile_l2_header_t* info, char **kernel_path, char **command_line, char **ramdisk_path);
|
||||||
extern int read_config_modem(char *conf, int *bitrate, int *parity, int *datasize);
|
extern int read_config_vga(char *conf);
|
||||||
extern int read_config_printer(char *conf, int *bitrate, int *parity, int *datasize);
|
extern int read_config_modem(char *conf, int *bitrate, int *parity, int *datasize, int *stopbits);
|
||||||
|
extern int read_config_printer(char *conf, int *bitrate, int *parity, int *datasize, int *stopbits);
|
||||||
|
@@ -36,10 +36,12 @@ struct emile_l2_header {
|
|||||||
* gestaltID <digit>
|
* gestaltID <digit>
|
||||||
* modem <bitrate><parity><bits> parity is n/o/e
|
* modem <bitrate><parity><bits> parity is n/o/e
|
||||||
* printer <bitrate><parity><bits>
|
* printer <bitrate><parity><bits>
|
||||||
* kernel <protocol>:<unit>/<path> <parameters>
|
* kernel <protocol>:<unit>/<path>
|
||||||
* <protocol> is "iso9660", "container", "block" ...
|
* <protocol> is "iso9660", "container", "block" ...
|
||||||
* <unit> is "(fd0)", "(sd3)", "(sd0,4)",...
|
* <unit> is "(fd0)", "(sd3)", "(sd0,4)",...
|
||||||
* <path> is "boot/vmlinuz-2.2.25", "install/mac/vmlinuz-2.2.25", "59904", "673280,654848",...
|
* <path> is "boot/vmlinuz-2.2.25", "/install/mac/vmlinuz-2.2.25",
|
||||||
|
* "59904", "673280,654848",...
|
||||||
|
* parameters <kernel parameters>
|
||||||
* initrd <protocol>:<unit>/<path>
|
* initrd <protocol>:<unit>/<path>
|
||||||
* configuration <protocol>:<unit>/<path>
|
* configuration <protocol>:<unit>/<path>
|
||||||
*/
|
*/
|
||||||
|
@@ -237,10 +237,8 @@ void serial_init(emile_l2_header_t* info)
|
|||||||
int res;
|
int res;
|
||||||
int bitrate, parity, datasize, stopbits;
|
int bitrate, parity, datasize, stopbits;
|
||||||
|
|
||||||
stopbits = 1;
|
|
||||||
|
|
||||||
res = read_config_modem(info->configuration,
|
res = read_config_modem(info->configuration,
|
||||||
&bitrate, &parity, &datasize);
|
&bitrate, &parity, &datasize, &stopbits);
|
||||||
if (res != -1)
|
if (res != -1)
|
||||||
{
|
{
|
||||||
res = OpenDriver(c2pstring(".AOut"), &out_refnum0);
|
res = OpenDriver(c2pstring(".AOut"), &out_refnum0);
|
||||||
@@ -278,7 +276,7 @@ void serial_init(emile_l2_header_t* info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
res = read_config_printer(info->configuration,
|
res = read_config_printer(info->configuration,
|
||||||
&bitrate, &parity, &datasize);
|
&bitrate, &parity, &datasize, &stopbits);
|
||||||
if (res != -1) {
|
if (res != -1) {
|
||||||
res = OpenDriver(c2pstring(".BOut"), &out_refnum1);
|
res = OpenDriver(c2pstring(".BOut"), &out_refnum1);
|
||||||
if (res != noErr) {
|
if (res != noErr) {
|
||||||
|
Reference in New Issue
Block a user