initial commit

This commit is contained in:
tkl
2016-07-28 21:02:54 +02:00
commit 8b47a2b3e6
424 changed files with 175707 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
/*
* ctx.h
*
* Created on: Feb 20, 2015
* Author: tkl
*/
#ifndef CTX_H_
#define CTX_H_
#ifdef ARCH_MSP430
#include "msp430_ctx.h"
#endif
#ifdef ARCH_STM32F4XX
#include "stm32f4xx_ctx.h"
#endif
#endif /* CTX_H_ */

View File

@@ -0,0 +1,17 @@
/*
* irq.h
*
* Created on: Sep 25, 2015
* Author: tkl
*/
#ifndef IRQ_H_
#define IRQ_H_
#ifdef ARCH_MSP430
#include "msp430_irq.h"
#endif
#ifdef ARCH_STM32F4XX
#include "stm32f4xx_irq.h"
#endif
#endif /* IRQ_H_ */

View File

@@ -0,0 +1,15 @@
/*
* isr.h
*
* Created on: Sep 25, 2015
* Author: tkl
*/
#ifndef ISR_H_
#define ISR_H_
#ifdef ARCH_MSP430
#include "msp430_isr.h"
#endif
#endif /* ISR_H_ */

View File

@@ -0,0 +1,24 @@
/*
* list.h
*
* Created on: Jul 27, 2016
* Author: tkl
*/
#ifndef SOURCE_FIRMWARE_KERNEL_LIST_H_
#define SOURCE_FIRMWARE_KERNEL_LIST_H_
struct list_node {
struct list_node *next;
unsigned int data;
};
struct list {
struct list_node *front;
struct list_node *rear;
};
int list_init(struct list *head);
int list_add(struct list *head, struct list_node *node);
#endif /* SOURCE_FIRMWARE_KERNEL_LIST_H_ */

View File

@@ -0,0 +1,18 @@
/*
* low_power.h
*
* Created on: Feb 17, 2015
* Author: tkl
*/
#ifndef LOW_POWER_H_
#define LOW_POWER_H_
#ifdef ARCH_MSP430
#include "msp430_low_power.h"
#endif
#ifdef ARCH_STM32F4XX
#include "stm32f4xx_low_power.h"
#endif
#endif /* LOW_POWER_H_ */

View File

@@ -0,0 +1,49 @@
/*
* ringbuffer.h
*
* Created on: Jul 24, 2012
* Author: tkl
*/
#ifndef RINGBUFFER_H_
#define RINGBUFFER_H_
//-----------------------------------------------------------------------------
//! \brief A ring buffer object.
struct ringbuffer {
char *buffer; //!< The buffer.
char *read; //!< Read access.
char *write; //!< Write access.
int size; //!< Buffer size.
int used; //!< Buffer in use.
};
//-----------------------------------------------------------------------------
//! \brief Read out n characters from ring buffer.
//! \param this The ring buffer to read from.
//! \param buffer to read to.
//! \param size The maximum number of characters to read.
//! \retval -1 in error case, otherwise the number of read characters.
int ringbuffer_read(struct ringbuffer *this, char *buffer, int size);
//-----------------------------------------------------------------------------
//! \brief Write n characters to ring buffer.
//! \param this The ring buffer to write to.
//! \param buffer to write.
//! \param size The number of characters to write.
//! \retval -1 in error case, otherwise the number of written characters.
int ringbuffer_write(struct ringbuffer *this, const char *buffer, int size);
//-----------------------------------------------------------------------------
//! \brief Check if ring buffer is full.
//! \param this The ring buffer to check.
//! \retval -1 in error case, otherwise 1 (true) / 0 (false).
int ringbuffer_is_full(const struct ringbuffer *this);
//-----------------------------------------------------------------------------
//! \brief Check if ring buffer is empty.
//! \param this The ring buffer to check.
//! \retval -1 in error case, otherwise 1 (true) / 0 (false).
int ringbuffer_is_empty(const struct ringbuffer *this);
#endif /* RINGBUFFER_H_ */

View File

@@ -0,0 +1,20 @@
/*
* schedule.h
*
* Created on: Feb 20, 2015
* Author: tkl
*/
#ifndef SCHEDULE_H_
#define SCHEDULE_H_
#ifdef ARCH_MSP430
#include "msp430_schedule.h"
#endif
#ifdef ARCH_STM32F4XX
#include "stm32f4xx_ctx.h"
#endif
#define schedule() arch_schedule()
#endif /* SCHEDULE_H_ */

View File

@@ -0,0 +1,20 @@
/*
* semaphore.h
*
* Created on: Oct 25, 2015
* Author: tkl
*/
#ifndef SEMAPHORE_H_
#define SEMAPHORE_H_
struct semaphore {
int cnt;
struct queue queue;
};
int semaphore_init(struct semaphore *sem, int value);
int semaphore_wait(struct semaphore *sem);
int semaphore_post(struct semaphore *sem);
#endif /* SEMAPHORE_H_ */

View File

@@ -0,0 +1,18 @@
/*
* stack.h
*
* Created on: Sep 27, 2015
* Author: tkl
*/
#ifndef STACK_H_
#define STACK_H_
#ifdef ARCH_MSP430
#include "msp430_stack.h"
#endif
#ifdef ARCH_STM32F4XX
#include "stm32f4xx_stack.h"
#endif
#endif /* STACK_H_ */

View File

@@ -0,0 +1,13 @@
/*
* sys_tick.h
*
* Created on: Sep 25, 2015
* Author: tkl
*/
#ifndef SYS_TICK_H_
#define SYS_TICK_H_
void sys_tick_init(const struct loki_timer *hw_timer);
#endif /* SYS_TICK_H_ */

View File

@@ -0,0 +1,22 @@
/*
* thread.h
*
* Created on: Apr 13, 2015
* Author: tkl
*/
#ifndef THREAD_H_
#define THREAD_H_
#define MAX_THREAD_COUNT 32
struct thread_list {
unsigned int count; //<! Number of elements in list
struct thread_context *list[MAX_THREAD_COUNT];
};
void thread_init(void);
void thread_switch_context(void);
void blocking_read_wakeup(const void *src);
#endif /* THREAD_H_ */