release os lob added

This commit is contained in:
tkl 2016-07-29 06:51:20 +02:00
parent 7fef99b756
commit ccc25a3c9f
6 changed files with 127 additions and 0 deletions

View File

@ -0,0 +1,12 @@
/* Board devices include file */
#ifndef BOARD_DEVICES_H
#define BOARD_DEVICES_H
extern const struct driver uart_1;
extern const struct driver led_3;
extern const struct driver led_4;
extern const struct driver led_5;
extern const struct driver led_6;
#endif /* BOARD_DEVICES_H */

View File

@ -0,0 +1,30 @@
/*
* driver.h
*
* Created on: Jul 27, 2016
* Author: tkl
*/
#ifndef SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_
#define SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_
enum driver_type {
DRIVER_TYPE_ADC,
DRIVER_TYPE_GPIO,
DRIVER_TYPE_I2C,
DRIVER_TYPE_RTC,
DRIVER_TYPE_SPI,
DRIVER_TYPE_UART
};
struct driver {
enum driver_type driver_type;
const void *device_driver;
};
int open(const struct driver *driver);
int close(const struct driver *driver);
int read(const struct driver *driver, char *buffer, int len);
int write(const struct driver *driver, const char *buffer, int len);
#endif /* SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_ */

View File

@ -0,0 +1,51 @@
/*
* kernel.h
*
* Created on: Jul 28, 2016
* Author: tkl
*/
#ifndef SOURCE_FIRMWARE_KERNEL_INTERFACE_KERNEL_H_
#define SOURCE_FIRMWARE_KERNEL_INTERFACE_KERNEL_H_
void schedule_start(void);
enum thread_priority {
THREAD_PRIO_IDLE = 0,
THREAD_PRIO_LOW,
THREAD_PRIO_MEDIUM,
THREAD_PRIO_HIGH
};
enum thread_status {
THREAD_STATUS_INIT = 0,
THREAD_STATUS_EXECUTING,
THREAD_STATUS_WAITING,
THREAD_STATUS_SLEEPING,
THREAD_STATUS_BLOCKING
};
struct thread_context {
stack_t *sp; /**< thread's stack pointer */
stack_t *stack; /**< thread's stack start address */
unsigned int stack_size; /**< thread's stack size */
unsigned int pid; /**< thread's process id */
enum thread_priority priority; /**< thread's priority */
enum thread_status status; /**< thread's status */
unsigned long next_executing_time;
void *wakeup_blocking_source;
struct queue_node sem_queue_node;
};
struct thread_context *thread_create(
struct thread_context *thread,
stack_t *stack,
unsigned int stack_size,
void (*thread_func)(void *),
void *arg,
enum thread_priority priority);
void thread_exit(void);
void sleep_ms(unsigned int ms);
#endif /* SOURCE_FIRMWARE_KERNEL_INTERFACE_KERNEL_H_ */

View File

@ -0,0 +1,26 @@
/*
* queue.h
*
* Created on: Oct 25, 2015
* Author: tkl
*/
#ifndef QUEUE_H_
#define QUEUE_H_
struct queue_node {
struct queue_node *next;
unsigned int data;
};
struct queue {
struct queue_node *front;
struct queue_node *rear;
};
int queue_init(struct queue *head);
int queue_push(struct queue *head, struct queue_node *node);
int queue_pop(struct queue *head, struct queue_node *node);
bool queue_is_empty(struct queue *head);
#endif /* QUEUE_H_ */

View File

@ -0,0 +1,8 @@
/* Stack include file */
#ifndef STACK_H
#define STACK_H
typedef uint32_t stack_t;
#endif /* STACK_H */

Binary file not shown.