Commit b7839ae1 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Channel installer infrastructure defined

parent e9a20472
......@@ -90,7 +90,10 @@ static void parse_config_dir_at(
static int install_config(struct moberg *moberg)
{
return 1;
struct moberg_install_channels install = {
.context=moberg
};
return moberg_config_install_channels(moberg->config, &install);
}
struct moberg *moberg_new(
......
......@@ -2,12 +2,14 @@
#define __MOBERG_H__
#include <stdio.h>
#include <moberg_config.h>
struct moberg;
struct moberg_config;
enum moberg_status { moberg_OK };
struct moberg *moberg_new(struct moberg_config *config);
void moberg_free(struct moberg *moberg);
/* Input/output functions */
......
......@@ -30,6 +30,7 @@ struct moberg_config
struct device_entry *next;
struct moberg_device *device;
} *device;
#if 0
struct {
int capacity;
struct analog_in_entry {
......@@ -65,6 +66,7 @@ struct moberg_config
struct moberg_device_encoder_in *channel;
} *value;
} encoder_in;
#endif
};
struct moberg_config *moberg_config_new()
......@@ -73,6 +75,7 @@ struct moberg_config *moberg_config_new()
if (result) {
result->device = NULL;
#if 0
result->analog_in.capacity = 0;
result->analog_in.value = NULL;
result->analog_out.capacity = 0;
......@@ -83,6 +86,7 @@ struct moberg_config *moberg_config_new()
result->digital_out.value = NULL;
result->encoder_in.capacity = 0;
result->encoder_in.value = NULL;
#endif
}
return result;
......@@ -97,11 +101,13 @@ void moberg_config_free(struct moberg_config *config)
moberg_device_free(tmp->device);
free(tmp);
}
#if 0
free(config->analog_in.value);
free(config->analog_out.value);
free(config->digital_in.value);
free(config->digital_out.value);
free(config->encoder_in.value);
#endif
free(config);
}
......@@ -130,6 +136,14 @@ int moberg_config_add_device(struct moberg_config *config,
return 1;
}
int moberg_config_install_channels(struct moberg_config *config,
struct moberg_install_channels *install)
{
return moberg_device_install_channels(config->device->device, install);
}
#if 0
int moberg_config_add_analog_in(struct moberg_config *config,
int index,
struct moberg_device* device,
......@@ -190,3 +204,4 @@ err:
return 0;
}
#endif
#ifndef __MOBERG_CONFIG_H__
#define __MOBERG_CONFIG_H__
#include <moberg.h>
#include <moberg_device.h>
struct moberg_config;
struct moberg_config *moberg_config_new();
void moberg_config_free(struct moberg_config *config);
......@@ -15,6 +14,10 @@ int moberg_config_join(struct moberg_config *dest,
int moberg_config_add_device(struct moberg_config *config,
struct moberg_device *device);
int moberg_config_install_channels(struct moberg_config *config,
struct moberg_install_channels *install);
#if 0
int moberg_config_add_analog_in(struct moberg_config *config,
int index,
struct moberg_device* device,
......@@ -39,7 +42,6 @@ int moberg_config_add_encoder_in(struct moberg_config *config,
int index,
struct moberg_device* device,
struct moberg_device_encoder_in *channel);
# endif
#endif
......@@ -214,4 +214,11 @@ int moberg_device_add_encoder_in(struct moberg_device* device,
}
return result;
}
int moberg_device_install_channels(struct moberg_device *device,
struct moberg_install_channels *install)
{
printf("INSTALL\n");
return 1;
}
#ifndef __MOBERG_DEVICE_H__
#define __MOBERG_DEVICE_H__
#include <moberg.h>
#include <moberg_config.h>
#include <moberg_parser.h>
......@@ -47,6 +48,15 @@ struct moberg_device_encoder_in {
int (*read)(struct moberg_device_encoder_in_context *, long *value);
};
struct moberg_install_channels {
struct moberg *context;
int (*analog_in)(int index, struct moberg_device_analog_in *channel);
int (*analog_out)(int index, struct moberg_device_analog_out *channel);
int (*digital_in)(int index, struct moberg_device_digital_in *channel);
int (*digital_out)(int index, struct moberg_device_digital_in *channel);
int (*encoder_in)(int index, struct moberg_device_encoder_in *channel);
};
struct moberg_parser_context;
struct moberg_device;
struct moberg_device_config;
......@@ -97,4 +107,8 @@ int moberg_device_add_digital_out(struct moberg_device* device,
int moberg_device_add_encoder_in(struct moberg_device* device,
struct moberg_device_encoder_in *channel);
int moberg_device_install_channels(struct moberg_device *device,
struct moberg_install_channels *install);
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment