startup code etc.
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
/* Board devices include file */
|
||||
|
||||
#ifndef BOARD_DEVICES_H
|
||||
#define BOARD_DEVICES_H
|
||||
|
||||
extern const struct driver gpio_c0;
|
||||
extern const struct driver gpio_c1;
|
||||
extern const struct driver gpio_c2;
|
||||
extern const struct driver gpio_c3;
|
||||
extern const struct driver pwm_4;
|
||||
extern const struct driver pwm_3;
|
||||
extern const struct driver pwm_2;
|
||||
extern const struct driver pwm_1;
|
||||
extern const struct driver uart_1;
|
||||
|
||||
#endif /* BOARD_DEVICES_H */
|
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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_
|
||||
|
||||
#define IOCTL_PWM_SET_DUTY_CYCLE 0
|
||||
|
||||
enum driver_type {
|
||||
DRIVER_TYPE_ADC,
|
||||
DRIVER_TYPE_GPIO,
|
||||
DRIVER_TYPE_I2C,
|
||||
DRIVER_TYPE_PWM,
|
||||
DRIVER_TYPE_RTC,
|
||||
DRIVER_TYPE_SPI,
|
||||
DRIVER_TYPE_UART
|
||||
};
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
struct driver {
|
||||
enum driver_type driver_type;
|
||||
const void *device_driver;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
int drv_open(const struct driver *driver);
|
||||
int drv_close(const struct driver *driver);
|
||||
int drv_read(const struct driver *driver, char *buffer, int len);
|
||||
int drv_write(const struct driver *driver, const char *buffer, int len);
|
||||
int drv_ioctl(const struct driver *driver, unsigned int cmd, const void *data);
|
||||
|
||||
#endif /* SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_ */
|
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
};
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
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;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
struct kernel_version {
|
||||
unsigned int kernel_version;
|
||||
unsigned int major_version;
|
||||
unsigned int minor_version;
|
||||
unsigned int build_number;
|
||||
};
|
||||
|
||||
int get_kernel_version(struct kernel_version *version);
|
||||
|
||||
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_ */
|
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
int list_get_len(struct list *head);
|
||||
|
||||
#endif /* SOURCE_FIRMWARE_KERNEL_LIST_H_ */
|
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* 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_ */
|
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* shell.h
|
||||
*
|
||||
* Created on: Aug 1, 2016
|
||||
* Author: tkl
|
||||
*/
|
||||
|
||||
#ifndef SOURCE_FIRMWARE_KERNEL_INTERFACE_SHELL_H_
|
||||
#define SOURCE_FIRMWARE_KERNEL_INTERFACE_SHELL_H_
|
||||
|
||||
typedef void *(*command_callback)(const char*);
|
||||
|
||||
struct command {
|
||||
const char *command;
|
||||
const char *description;
|
||||
const command_callback command_callback;
|
||||
struct list_node item;
|
||||
};
|
||||
|
||||
int shell_init(const struct driver *shell_device);
|
||||
int shell_add_command(struct command *command);
|
||||
|
||||
#endif /* SOURCE_FIRMWARE_KERNEL_INTERFACE_SHELL_H_ */
|
@@ -1,8 +0,0 @@
|
||||
/* Stack include file */
|
||||
|
||||
#ifndef STACK_H
|
||||
#define STACK_H
|
||||
|
||||
typedef uint32_t stack_t;
|
||||
|
||||
#endif /* STACK_H */
|
Binary file not shown.
@@ -1 +0,0 @@
|
||||
libkosmos-arm-stm32f4-discovery-0.1.1-dbg.a
|
Reference in New Issue
Block a user