new kosmos version - 0.1.0

This commit is contained in:
tkl 2016-08-18 14:25:30 +02:00
parent 859adc5d35
commit 2afb41faa7
10 changed files with 45 additions and 11 deletions

View File

@ -3,6 +3,7 @@
#ifndef BOARD_DEVICES_H #ifndef BOARD_DEVICES_H
#define BOARD_DEVICES_H #define BOARD_DEVICES_H
extern const struct driver gpio_d12;
extern const struct driver pwm_4; extern const struct driver pwm_4;
extern const struct driver pwm_3; extern const struct driver pwm_3;
extern const struct driver pwm_2; extern const struct driver pwm_2;

View File

@ -20,15 +20,18 @@ enum driver_type {
DRIVER_TYPE_UART DRIVER_TYPE_UART
}; };
#pragma pack(push)
#pragma pack(1)
struct driver { struct driver {
enum driver_type driver_type; enum driver_type driver_type;
const void *device_driver; const void *device_driver;
}; };
#pragma pack(pop)
int open(const struct driver *driver); int drv_open(const struct driver *driver);
int close(const struct driver *driver); int drv_close(const struct driver *driver);
int read(const struct driver *driver, char *buffer, int len); int drv_read(const struct driver *driver, char *buffer, int len);
int write(const struct driver *driver, const char *buffer, int len); int drv_write(const struct driver *driver, const char *buffer, int len);
int ioctl(const struct driver *driver, unsigned int cmd, const void *data); int drv_ioctl(const struct driver *driver, unsigned int cmd, const void *data);
#endif /* SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_ */ #endif /* SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_ */

View File

@ -25,6 +25,8 @@ enum thread_status {
THREAD_STATUS_BLOCKING THREAD_STATUS_BLOCKING
}; };
#pragma pack(push)
#pragma pack(1)
struct thread_context { struct thread_context {
stack_t *sp; /**< thread's stack pointer */ stack_t *sp; /**< thread's stack pointer */
stack_t *stack; /**< thread's stack start address */ stack_t *stack; /**< thread's stack start address */
@ -36,6 +38,16 @@ struct thread_context {
void *wakeup_blocking_source; void *wakeup_blocking_source;
struct queue_node sem_queue_node; 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_create(
struct thread_context *thread, struct thread_context *thread,
@ -45,6 +57,7 @@ struct thread_context *thread_create(
void *arg, void *arg,
enum thread_priority priority); enum thread_priority priority);
void thread_exit(void); void thread_exit(void);
void sleep_ms(unsigned int ms); void sleep_ms(unsigned int ms);

View File

@ -3,6 +3,7 @@
#ifndef BOARD_DEVICES_H #ifndef BOARD_DEVICES_H
#define BOARD_DEVICES_H #define BOARD_DEVICES_H
extern const struct driver gpio_d12;
extern const struct driver pwm_4; extern const struct driver pwm_4;
extern const struct driver pwm_3; extern const struct driver pwm_3;
extern const struct driver pwm_2; extern const struct driver pwm_2;

View File

@ -20,15 +20,18 @@ enum driver_type {
DRIVER_TYPE_UART DRIVER_TYPE_UART
}; };
#pragma pack(push)
#pragma pack(1)
struct driver { struct driver {
enum driver_type driver_type; enum driver_type driver_type;
const void *device_driver; const void *device_driver;
}; };
#pragma pack(pop)
int open(const struct driver *driver); int drv_open(const struct driver *driver);
int close(const struct driver *driver); int drv_close(const struct driver *driver);
int read(const struct driver *driver, char *buffer, int len); int drv_read(const struct driver *driver, char *buffer, int len);
int write(const struct driver *driver, const char *buffer, int len); int drv_write(const struct driver *driver, const char *buffer, int len);
int ioctl(const struct driver *driver, unsigned int cmd, const void *data); int drv_ioctl(const struct driver *driver, unsigned int cmd, const void *data);
#endif /* SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_ */ #endif /* SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_ */

View File

@ -25,6 +25,8 @@ enum thread_status {
THREAD_STATUS_BLOCKING THREAD_STATUS_BLOCKING
}; };
#pragma pack(push)
#pragma pack(1)
struct thread_context { struct thread_context {
stack_t *sp; /**< thread's stack pointer */ stack_t *sp; /**< thread's stack pointer */
stack_t *stack; /**< thread's stack start address */ stack_t *stack; /**< thread's stack start address */
@ -36,6 +38,16 @@ struct thread_context {
void *wakeup_blocking_source; void *wakeup_blocking_source;
struct queue_node sem_queue_node; 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_create(
struct thread_context *thread, struct thread_context *thread,
@ -45,6 +57,7 @@ struct thread_context *thread_create(
void *arg, void *arg,
enum thread_priority priority); enum thread_priority priority);
void thread_exit(void); void thread_exit(void);
void sleep_ms(unsigned int ms); void sleep_ms(unsigned int ms);

View File

@ -1 +1 @@
libkosmos-arm-stm32f4-discovery-0.0.5.a libkosmos-arm-stm32f4-discovery-0.1.0.a