Build and install libm.a library.

Print a number of configured channels for adc and pwm drivers.
This commit is contained in:
Serge Vakulenko
2015-09-27 13:59:50 -07:00
parent dc75784799
commit 4f7baefbf0
5 changed files with 33 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
TOPSRC = $(shell cd ..; pwd) TOPSRC = $(shell cd ..; pwd)
SUBDIR = startup libc libcurses libtermlib libwiznet libreadline SUBDIR = startup libc libm libcurses libtermlib libwiznet libreadline
PROG = ar as aout ld nm ranlib size strip PROG = ar as aout ld nm ranlib size strip
CFLAGS += -std=gnu89 -fno-builtin -g -Werror -Wall -DCROSS -I. \ CFLAGS += -std=gnu89 -fno-builtin -g -Werror -Wall -DCROSS -I. \

18
lib/libm/Makefile Normal file
View File

@@ -0,0 +1,18 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
vpath %.c $(TOPSRC)/src/libm
CFLAGS += -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
OBJS = asin.o atan.o exp.o erf.o floor.o fmod.o hypot.o j0.o j1.o \
jn.o log.o pow.o sin.o sinh.o sqrt.o tan.o tanh.o
all: ../libm.a
../libm.a: ../ar ../ranlib $(OBJS)
../ar rc $@ $(OBJS)
../ranlib $@
clean:
rm -f *~ *.o a.out *.a

View File

@@ -874,6 +874,7 @@ target sys/syslog.h
# #
file /lib/crt0.o file /lib/crt0.o
file /lib/libc.a file /lib/libc.a
file /lib/libm.a
file /lib/libcurses.a file /lib/libcurses.a
file /lib/libreadline.a file /lib/libreadline.a
file /lib/libtermlib.a file /lib/libtermlib.a

View File

@@ -40,13 +40,13 @@ int adc_open(dev_t dev, int flag, int mode)
int channel; int channel;
channel = minor(dev); channel = minor(dev);
if(channel>ADCMAX) if (channel > ADCMAX)
return ENODEV; return ENODEV;
DEBUG1("adc%2: opened\n",channel); DEBUG1("adc%2: opened\n",channel);
AD1PCFG &= ~(1<<channel); AD1PCFG &= ~(1<<channel);
if(adcactive==0) if (adcactive == 0)
{ {
// Enable and configure the ADC here // Enable and configure the ADC here
AD1CSSL = 0xFFFF; AD1CSSL = 0xFFFF;
@@ -65,12 +65,12 @@ int adc_close(dev_t dev, int flag, int mode)
int channel; int channel;
channel = minor(dev); channel = minor(dev);
if(channel>ADCMAX) if (channel > ADCMAX)
return ENODEV; return ENODEV;
AD1PCFG |= (1<<channel); AD1PCFG |= (1<<channel);
adcactive &= ~(1<<channel); adcactive &= ~(1<<channel);
if(adcactive==0) if (adcactive == 0)
{ {
// Switch off the ADC here. // Switch off the ADC here.
AD1CSSL = 0x0000; AD1CSSL = 0x0000;
@@ -91,25 +91,25 @@ int adc_read(dev_t dev, struct uio *uio, int flag)
int tv; int tv;
channel = minor(dev); channel = minor(dev);
if(channel>ADCMAX) if (channel > ADCMAX)
return ENODEV; return ENODEV;
lr = *(&ADC1BUF0+(channel<<2)); lr = *(&ADC1BUF0+(channel<<2));
c=0; c=0;
if(lr >= 1000) if (lr >= 1000)
{ {
tv = lr/1000; tv = lr/1000;
temp[c++] = '0' + tv; temp[c++] = '0' + tv;
lr = lr - (tv*1000); lr = lr - (tv*1000);
} }
if((lr >= 100) || (c>0)) if (lr >= 100 || c > 0)
{ {
tv = lr/100; tv = lr/100;
temp[c++] = '0' + tv; temp[c++] = '0' + tv;
lr = lr - (tv*100); lr = lr - (tv*100);
} }
if((lr >= 10) || (c>0)) if (lr >= 10 || c>0)
{ {
tv = lr/10; tv = lr/10;
temp[c++] = '0' + tv; temp[c++] = '0' + tv;
@@ -131,12 +131,10 @@ int adc_write(dev_t dev, struct uio *uio, int flag)
int adc_ioctl(dev_t dev, register u_int cmd, caddr_t addr, int flag) int adc_ioctl(dev_t dev, register u_int cmd, caddr_t addr, int flag)
{ {
switch(cmd) switch (cmd) {
{ default:
default: return EINVAL;
return EINVAL;
} }
return 0; return 0;
} }
@@ -148,9 +146,7 @@ static int
adcprobe(config) adcprobe(config)
struct conf_device *config; struct conf_device *config;
{ {
int flags = config->dev_flags; printf("adc: %u channels\n", ADCMAX);
printf("adc: flags %#x\n", flags);
return 1; return 1;
} }

View File

@@ -205,9 +205,7 @@ static int
pwmprobe(config) pwmprobe(config)
struct conf_device *config; struct conf_device *config;
{ {
int flags = config->dev_flags; printf("pwm: %u channels\n", PWM_MAX_DEV);
printf("pwm: flags %#x\n", flags);
return 1; return 1;
} }