release os lob added
This commit is contained in:
parent
7fef99b756
commit
ccc25a3c9f
12
source/os/release/include/board_devices.h
Normal file
12
source/os/release/include/board_devices.h
Normal 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 */
|
30
source/os/release/include/driver.h
Normal file
30
source/os/release/include/driver.h
Normal 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_ */
|
51
source/os/release/include/kernel.h
Normal file
51
source/os/release/include/kernel.h
Normal 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_ */
|
26
source/os/release/include/queue.h
Normal file
26
source/os/release/include/queue.h
Normal 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_ */
|
8
source/os/release/include/stack.h
Normal file
8
source/os/release/include/stack.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/* Stack include file */
|
||||||
|
|
||||||
|
#ifndef STACK_H
|
||||||
|
#define STACK_H
|
||||||
|
|
||||||
|
typedef uint32_t stack_t;
|
||||||
|
|
||||||
|
#endif /* STACK_H */
|
BIN
source/os/release/libkosmos-arm-stm32f4-discovery.a
Normal file
BIN
source/os/release/libkosmos-arm-stm32f4-discovery.a
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user