diff --git a/source/os/debug/include/board_devices.h b/source/os/debug/include/board_devices.h index 16ace5b..78fc2e8 100644 --- a/source/os/debug/include/board_devices.h +++ b/source/os/debug/include/board_devices.h @@ -3,10 +3,14 @@ #ifndef BOARD_DEVICES_H #define BOARD_DEVICES_H +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; -extern const struct driver led_3; -extern const struct driver led_4; -extern const struct driver led_5; -extern const struct driver led_6; +extern const struct driver gpio_c0; +extern const struct driver gpio_c1; +extern const struct driver gpio_c2; +extern const struct driver gpio_c3; #endif /* BOARD_DEVICES_H */ diff --git a/source/os/debug/include/driver.h b/source/os/debug/include/driver.h index ee82abf..14923d9 100644 --- a/source/os/debug/include/driver.h +++ b/source/os/debug/include/driver.h @@ -8,10 +8,13 @@ #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 @@ -26,5 +29,6 @@ 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); +int ioctl(const struct driver *driver, unsigned int cmd, const void *data); #endif /* SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_ */ diff --git a/source/os/debug/include/list.h b/source/os/debug/include/list.h new file mode 100644 index 0000000..b87e3be --- /dev/null +++ b/source/os/debug/include/list.h @@ -0,0 +1,24 @@ +/* + * 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); + +#endif /* SOURCE_FIRMWARE_KERNEL_LIST_H_ */ diff --git a/source/os/debug/include/shell.h b/source/os/debug/include/shell.h new file mode 100644 index 0000000..81fd032 --- /dev/null +++ b/source/os/debug/include/shell.h @@ -0,0 +1,22 @@ +/* + * 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 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_ */ diff --git a/source/os/debug/libkosmos-arm-stm32f4-discovery-dbg.a b/source/os/debug/libkosmos-arm-stm32f4-discovery-dbg.a index d285e6a..a8c73f0 100644 Binary files a/source/os/debug/libkosmos-arm-stm32f4-discovery-dbg.a and b/source/os/debug/libkosmos-arm-stm32f4-discovery-dbg.a differ diff --git a/source/os/release/include/board_devices.h b/source/os/release/include/board_devices.h index 16ace5b..78fc2e8 100644 --- a/source/os/release/include/board_devices.h +++ b/source/os/release/include/board_devices.h @@ -3,10 +3,14 @@ #ifndef BOARD_DEVICES_H #define BOARD_DEVICES_H +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; -extern const struct driver led_3; -extern const struct driver led_4; -extern const struct driver led_5; -extern const struct driver led_6; +extern const struct driver gpio_c0; +extern const struct driver gpio_c1; +extern const struct driver gpio_c2; +extern const struct driver gpio_c3; #endif /* BOARD_DEVICES_H */ diff --git a/source/os/release/include/driver.h b/source/os/release/include/driver.h index ee82abf..14923d9 100644 --- a/source/os/release/include/driver.h +++ b/source/os/release/include/driver.h @@ -8,10 +8,13 @@ #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 @@ -26,5 +29,6 @@ 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); +int ioctl(const struct driver *driver, unsigned int cmd, const void *data); #endif /* SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_ */ diff --git a/source/os/release/libkosmos-arm-stm32f4-discovery.a b/source/os/release/libkosmos-arm-stm32f4-discovery.a index 8455371..a8ef8be 100644 Binary files a/source/os/release/libkosmos-arm-stm32f4-discovery.a and b/source/os/release/libkosmos-arm-stm32f4-discovery.a differ