aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Kconfig180
-rw-r--r--examples/blink/blink.c14
-rw-r--r--include/jobs.h8
-rw-r--r--include/sys/mutex.h32
-rw-r--r--include/sys/semaphore.h31
-rw-r--r--include/tasks.h56
6 files changed, 66 insertions, 255 deletions
diff --git a/Kconfig b/Kconfig
index ebafb5b..83080bb 100644
--- a/Kconfig
+++ b/Kconfig
@@ -1,125 +1,117 @@
mainmenu "AVR-IOE configuration"
config IOEROOT
- string
- option env="IOEROOT"
+ string
+ option env="IOEROOT"
source "$IOEROOT/include/mcu/Kconfig"
config F_CPU
- int "CPU frequency in kHz (F_CPU)"
- default 16000
+ int "CPU frequency in kHz (F_CPU)"
+ default 16000
# Toolchain #####################################################################
menu "Compilation options"
config GNUTOOLCHAIN_PREFIX
- string "GNU Toolchain prefix"
- default "avr-"
+ string "GNU Toolchain prefix"
+ default "avr-"
config CONFCFLAGS
- string "Compilation CFlags"
- default "-Os -ffunction-sections -fdata-sections -fshort-enums -Wall"
+ string "Compilation CFlags"
+ default "-Os -ffunction-sections -fdata-sections -fshort-enums -Wall"
endmenu
-# Tracing and error handling ####################################################
-
-menu "Tracing and error handling"
+# Error handling ################################################################
config CONFIG_ERRORS
- bool "Errors support"
+ bool "Errors support"
+ default y
if CONFIG_ERRORS
menu "Errors handling"
config CONFIG_EH_RESTART
- bool "Restart MCU on error detection"
+ bool "Restart MCU on error detection"
+ default y
config CONFIG_EH_MEMORY
- bool "TODO: Write error code and possible stack trase to EEPROM"
+ bool "(TODO) Write error code and possible stack trase to EEPROM"
+ default n
config CONFIG_EH_LED
- bool "Signal error detection by LED"
- depends on CONFIG_IOPORTS
+ bool "Signal error detection by LED"
+ depends on CONFIG_IOPORTS
+ default n
config CONFIG_EH_LED_IOPIN
- string "Error detection led output pin"
- depends on CONFIG_EH_LED
- default "IO_B0"
- ---help---
- Specifies IO pin which will be pulled up on error detection.
- This string should be valid IO port (for example "IO_B0") or pair of group
- mask divided by comma (for example "IO_B, _BV(0)").
+ string "Error detection led output pin"
+ depends on CONFIG_EH_LED
+ default "IO_B0"
+ ---help---
+ Specifies IO pin which will be pulled up on error detection.
+ This string should be valid IO port (for example "IO_B0") or pair of group
+ mask divided by comma (for example "IO_B, _BV(0)").
config CONFIG_EH_USART
- bool "Send error informations by UART"
- depends on CONFIG_USART && CONFIG_USART_OUTPUT_BUFFER
+ bool "Send error informations by UART"
+ depends on CONFIG_USART && CONFIG_USART_OUTPUT_BUFFER
+ default n
endmenu
config CONFIG_CHECK_ARGUMENTS
- bool "Check arguments for all functions in library"
-
-endif
-
-config CONFIG_TRACING
- bool "TODO: Tracing support"
-
-if CONFIG_TRACING
-
-config CONFIG_TRACE_FUNCTIONCALL
- bool "TODO: Trace all function calls in library"
+ bool "Check arguments for all functions in library"
+ default n
endif
-endmenu
-
# IO Ports ######################################################################
config MCUSUPPORT_IOPORTS
- bool
- default n
+ bool
+ default n
config CONFIG_IOPORTS
- bool "Input/Output ports"
- default y
- depends on MCUSUPPORT_IOPORTS
+ bool "Input/Output ports"
+ default y
+ depends on MCUSUPPORT_IOPORTS
config MCUSUPPORT_PCINT0
- bool
- default n
+ bool
+ default n
config MCUSUPPORT_PCINT1
- bool
- default n
+ bool
+ default n
config MCUSUPPORT_PCINT2
- bool
- default n
+ bool
+ default n
config CONFIG_IOPORTS_PCINT
- bool "Input/Output ports change interrupts"
+ bool "Input/Output ports change interrupts"
depends on CONFIG_IOPORTS
- depends on MCUSUPPORT_PCINT0 || MCUSUPPORT_PCINT1 || MCUSUPPORT_PCINT2
+ depends on MCUSUPPORT_PCINT0 || MCUSUPPORT_PCINT1 || MCUSUPPORT_PCINT2
# SPI ###########################################################################
config MCUSUPPORT_SPI
- bool
- default n
+ bool
+ default n
config CONFIG_SPI
- bool "Serial peripheral interface"
- depends on MCUSUPPORT_SPI
+ bool "SPI (Serial peripheral interface)"
+ depends on MCUSUPPORT_SPI
# USART #########################################################################
config MCUSUPPORT_USART
- bool
- default n
+ bool
+ default n
menuconfig CONFIG_USART
- bool "Universal synchronous/asynchronous transceiver"
- depends on MCUSUPPORT_USART
+ bool "USART (Universal synchronous/asynchronous transceiver)"
+ depends on MCUSUPPORT_USART
if CONFIG_USART
@@ -145,7 +137,7 @@ config CONFIG_USART_PARITY
config CONFIG_USART_DATABITS
int "Data bits"
default 8
- range 5 8
+ range 5 8
choice USART_STOPBIT_C
prompt "Stop bit"
@@ -166,7 +158,7 @@ config CONFIG_USART_OUTPUT_BUFFER
config CONFIG_USART_OUTBUFFER_SIZE
int "Output buffer size in bytes." if CONFIG_USART_OUTPUT_BUFFER
default 0 if ! CONFIG_USART_OUTPUT_BUFFER
- range 1 512000 if CONFIG_USART_OUTPUT_BUFFER
+ range 1 512000 if CONFIG_USART_OUTPUT_BUFFER
default 32
choice USART_OUTBUFFER_MODE_C
@@ -190,7 +182,7 @@ config CONFIG_USART_INPUT_BUFFER
config CONFIG_USART_INBUFFER_SIZE
int "Input buffer size in bytes." if CONFIG_USART_INPUT_BUFFER
default 0 if ! CONFIG_USART_INPUT_BUFFER
- range 1 512000 if CONFIG_USART_INPUT_BUFFER
+ range 1 512000 if CONFIG_USART_INPUT_BUFFER
default 32
choice USART_INBUFFER_MODE_C
@@ -209,70 +201,16 @@ config CONFIG_USART_INBUFFER_MODE
default 0
config CONFIG_USART_OUTFILE
- bool "STD FILE support for output"
- depends on CONFIG_USART_OUTPUT_BUFFER
+ bool "STD FILE support for output"
+ depends on CONFIG_USART_OUTPUT_BUFFER
config CONFIG_USART_INFILE
- bool "STD FILE support for input"
- depends on CONFIG_USART_INPUT_BUFFER
+ bool "STD FILE support for input"
+ depends on CONFIG_USART_INPUT_BUFFER
endif
# Timers ########################################################################
config CONFIG_TIMERS
- bool "Timers"
-
-# Tasks #########################################################################
-
-menuconfig CONFIG_TASKS
- bool "Taks support"
- depends on CONFIG_TIMERS
-
-if CONFIG_TASKS
-
-config CONFIG_TASKS_TIME
- bool "Measure approximate real time"
-
-choice TASKS_TIMER
- prompt "Timer used for tasks planning and interrupts"
- default TASKS_TIMER_2
-
-config TASKS_TIMER_0
- bool "Timer0 (8-bit)"
-
-config TASKS_TIMER_1
- bool "Timer1 (16-bit)"
-
-config TASKS_TIMER_2
- bool "Timer2 (8-bit asynchronous)"
-
-endchoice
-
-endif
-
-# Jobs ##########################################################################
-
-menuconfig CONFIG_JOBS
- bool "Jobs support"
- ---help---
- Job support allows you to plan and execute functions periodically. This is
- designed for realtime control.
-
-if CONFIG_JOBS
-
-choice JOBS_DURATION
- prompt "Jobs duration source"
-
-config JOBS_DURATION_CONSTANT
- bool "Predefined constants"
-
-config JOBS_DURATION_PREV
- bool "Previous execution time"
-
-config JOBS_DURATION_MAX
- bool "Maximum previous time"
-
-endchoice
-
-endif
+ bool "Timers"
diff --git a/examples/blink/blink.c b/examples/blink/blink.c
index 6a81aee..912ce80 100644
--- a/examples/blink/blink.c
+++ b/examples/blink/blink.c
@@ -3,12 +3,12 @@
#include <ioport.h>
int main() {
- io_setout(IO_B0);
+ io_setout(IO_B0);
- while (1) {
- io_hight(IO_B0);
- _delay_ms(500);
- io_low(IO_B0);
- _delay_ms(500);
- }
+ while (1) {
+ io_hight(IO_B0);
+ _delay_ms(500);
+ io_low(IO_B0);
+ _delay_ms(500);
+ }
}
diff --git a/include/jobs.h b/include/jobs.h
deleted file mode 100644
index d2abbdc..0000000
--- a/include/jobs.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <stdint.h>
-
-#ifndef _IOE_JOBS_H_
-#define _IOE_JOBS_H_
-
-
-
-#endif /* _IOE_JOBS_H_ */
diff --git a/include/sys/mutex.h b/include/sys/mutex.h
deleted file mode 100644
index f682e02..0000000
--- a/include/sys/mutex.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <avr/io.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "../tasks.h"
-
-#ifndef _IOE_SYS_MUTEX_H_
-#define _IOE_SYS_MUTEX_H_
-#ifdef CONFIG_IOE_MUTEX
-
-#define MUTEX_F_TIMED (1<<0)
-#define MUTEX_F_TAKEN (1<<7)
-#define mutex_t volatile struct Mutex
-struct Mutex {
- uint8_t flags;
- Task *_task_took;
-};
-int8_t mutex_init(struct Mutex * mtx);
-int8_t mutex_free(struct Mutex * mtx);
-int8_t mutex_take(struct Mutex * mtx, uint16_t timeout);
-int8_t mutex_give(struct Mutex * mtx);
-
-#else /* CONFIG_IOE_MUTEX */
-
-#define mutex_t struct { }
-#define mutex_init(MTX, FLAGS)
-#define mutex_free(MTX)
-#define mutex_take(MTX, TIMEOUT)
-#define mutex_give(MTX);
-
-#endif /* CONFIG_IOE_MUTEX */
-#endif /* _IOE_SYS_MUTEX_H_ */
diff --git a/include/sys/semaphore.h b/include/sys/semaphore.h
deleted file mode 100644
index 0a25af3..0000000
--- a/include/sys/semaphore.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <avr/io.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifndef _IOE_SYS_SEMAPHORE_H_
-#define _IOE_SYS_SEMAPHORE_H_
-#ifdef CONFIG_IOE_SEMAPHORE
-
-#define semaphore_t volatile struct Semaphore
-struct Semaphore {
- uint8_t flags;
- uint8_t _count;
- Task **_tasks;
- uint8_t _tasks_len;
-};
-int8_t semaphore_init(struct Semaphore * sem, uint8_t count);
-int8_t semaphore_free(struct Semaphore * sem);
-int8_t semaphore_take(struct Semaphore * sem, uint16_t timeout);
-int8_t semaphore_give(Semaphore * sem);
-
-#else /* CONFIG_IOE_SEMAPHORE */
-
-#define semaphore_t struct { }
-// TODO implement for single processor
-#define semaphore_init(SEM, FLAGS, COUNT)
-#define semaphore_free(SEM)
-#define semaphore_take(SEM, TIMEOUT)
-#define semaphore_give(SEM)
-
-#endif /* CONFIG_IOE_SEMAPHORE */
-#endif /* _IOE_SYS_SEMAPHORE_H_ */
diff --git a/include/tasks.h b/include/tasks.h
deleted file mode 100644
index b62b093..0000000
--- a/include/tasks.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <avr/io.h>
-#include <util/delay.h>
-#include <avr/interrupt.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "mcu/mcu_def.h"
-#include "timer.h"
-
-#ifndef _IOE_TASKS_H_
-#define _IOE_TASKS_H_
-
-#ifdef CONFIG_IOE_TASKS
-
-#ifndef CONFIG_IOE_TIMERS
-#error "To use tasks you must enable timers (CONFIG_IOE_TIMERS)."
-#endif
-
-int8_t tasks_run(void);
-
-union StackPointer {
- uint8_t lh8[2];
- uint16_t lh16;
-};
-
-struct Task {
- uint8_t flags;
- void (*func) (void *data);
- void *data;
- uint8_t _rflags;
- uint8_t _stack_size;
- union StackPointer _sp;
-};
-typedef task_t volatile struct Task;
-
-int8_t task_spawn(struct Task * t, uint8_t stack_size);
-Task *tasks_self(void);
-void taks_exit(void);
-int8_t task_kill(struct Task * t);
-int8_t task_safe(void);
-int8_t task_unsafe(void);
-
-int8_t task_delay(uint16_t cycles);
-int8_t task_delay_ms(uint16_t ms);
-int8_t task_delay_till(volatile int8_t * boolean, uint16_t ms);
-
-#else /* CONFIG_IOE_TASKS */
-
-#define task_safe()
-#define task_unsafe()
-#define task_delay(CC) _delay_us(CC) // TODO this should be cycles
-#define task_delay_ms(MS) _delay_ms(MS)
-int8_t task_delay_till(volatile int8_t * boolean, uint16_t ms);
-
-#endif /* CONFIG_IOE_TASKS */
-#endif /* _IOE_TASKS_H_ */