diff --git a/source/os/release/include/board_devices.h b/source/os/release/include/board_devices.h new file mode 100644 index 0000000..16ace5b --- /dev/null +++ b/source/os/release/include/board_devices.h @@ -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 */ diff --git a/source/os/release/include/driver.h b/source/os/release/include/driver.h new file mode 100644 index 0000000..ee82abf --- /dev/null +++ b/source/os/release/include/driver.h @@ -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_ */ diff --git a/source/os/release/include/kernel.h b/source/os/release/include/kernel.h new file mode 100644 index 0000000..b9d4520 --- /dev/null +++ b/source/os/release/include/kernel.h @@ -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_ */ diff --git a/source/os/release/include/queue.h b/source/os/release/include/queue.h new file mode 100644 index 0000000..996ef90 --- /dev/null +++ b/source/os/release/include/queue.h @@ -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_ */ diff --git a/source/os/release/include/stack.h b/source/os/release/include/stack.h new file mode 100644 index 0000000..b792758 --- /dev/null +++ b/source/os/release/include/stack.h @@ -0,0 +1,8 @@ +/* Stack include file */ + +#ifndef STACK_H +#define STACK_H + +typedef uint32_t stack_t; + +#endif /* STACK_H */ diff --git a/source/os/release/libkosmos-arm-stm32f4-discovery.a b/source/os/release/libkosmos-arm-stm32f4-discovery.a new file mode 100644 index 0000000..52bfe59 Binary files /dev/null and b/source/os/release/libkosmos-arm-stm32f4-discovery.a differ