# Tasks
OBJS += task_audio.o ipc_audio.o
-OBJS += task_display.o
+OBJS += task_display.o ipc_display.o
OBJS += task_fileio.o
OBJS += task_menu.o
OBJS += task_input.o
--- /dev/null
+
+#include "kozos.h"
+#include "ipc_display.h"
+#include "lib.h"
+
+void ipc_display_led_write(int target, int state)
+{
+ char *p;
+ p = kz_kmalloc(2);
+ p[0] = state ? DISPLAY_CMD_LED_ON : DISPLAY_CMD_LED_OFF;
+ p[1] = '0' + target;
+ kz_send(MSGBOX_ID_DISPLAY, 2, p);
+}
+
+void ipc_display_led_toggle(int target)
+{
+ char *p;
+ p = kz_kmalloc(2);
+ p[0] = DISPLAY_CMD_LED_TOGGLE;
+ p[1] = '0' + target;
+ kz_send(MSGBOX_ID_DISPLAY, 2, p);
+}
+
+void ipc_display_clear(void)
+{
+ char *p;
+ p = kz_kmalloc(1);
+ p[0] = DISPLAY_CMD_LCD_CLEAR;
+ kz_send(MSGBOX_ID_DISPLAY, 1, p);
+}
+
+void ipc_display_draw_box(int x1, int y1, int x2, int y2, int on)
+{
+ char *p;
+ p = kz_kmalloc(6);
+ p[0] = DISPLAY_CMD_LCD_DRAW_BOX;
+ p[1] = x1;
+ p[2] = y1;
+ p[3] = x2;
+ p[4] = y2;
+ p[5] = !on;
+ kz_send(MSGBOX_ID_DISPLAY, 6, p);
+}
+
+void ipc_display_draw_logo(int x, int y, int size)
+{
+ char *p;
+ p = kz_kmalloc(4);
+ p[0] = DISPLAY_CMD_LCD_DRAW_LOGO;
+ p[1] = x;
+ p[2] = y;
+ p[3] = size;
+ kz_send(MSGBOX_ID_DISPLAY, 4, p);
+}
+
+void ipc_display_draw_text(int x, int y, char *str)
+{
+ char *p;
+ int len;
+ len = strlen(str);
+ p = kz_kmalloc(3 + len + 1);
+ p[0] = DISPLAY_CMD_LCD_DRAW_TEXT;
+ p[1] = x;
+ p[2] = y;
+ memcpy(&p[3], str, len);
+ p[3 + len] = '\0';
+ kz_send(MSGBOX_ID_DISPLAY, 3 + len + 1, p);
+}
+
+void ipc_display_draw_progressbar(
+ int x1, int y1, int x2, int y2,
+ int min, int max, int value)
+{
+ char *p;
+ p = kz_kmalloc(8);
+ p[0] = DISPLAY_CMD_LCD_DRAW_PBAR;
+ p[1] = x1;
+ p[2] = y1;
+ p[3] = x2;
+ p[4] = y2;
+ p[5] = min;
+ p[6] = max;
+ p[7] = value;
+ kz_send(MSGBOX_ID_DISPLAY, 8, p);
+}
+
--- /dev/null
+
+#ifndef IPC_DISPLAY_H
+#define IPC_DISPLAY_H
+
+#define DISPLAY_CMD_LCD_CLEAR 'c' /* LCD\e$B$N>C5n\e(B */
+#define DISPLAY_CMD_LCD_DRAW_BOX 'b' /* BOX\e$BIA2h%3%^%s%I\e(B */
+#define DISPLAY_CMD_LCD_DRAW_LOGO 'l' /* LOGO\e$BIA2h%3%^%s%I\e(B */
+#define DISPLAY_CMD_LCD_DRAW_TEXT 't' /* TEXT\e$BIA2h%3%^%s%I\e(B */
+#define DISPLAY_CMD_LCD_DRAW_PBAR 'p' /* PBAR\e$BIA2h%3%^%s%I\e(B */
+#define DISPLAY_CMD_LED_ON '1' /* LED\e$B$NE@Et\e(B */
+#define DISPLAY_CMD_LED_OFF '0' /* LED\e$B$N>CEt\e(B */
+#define DISPLAY_CMD_LED_TOGGLE 'a' /* LED\e$B$N%H%0%k\e(B */
+
+void ipc_display_led_write(int target, int state);
+void ipc_display_led_toggle(int target);
+void ipc_display_clear(void);
+void ipc_display_draw_box(int x1, int y1, int x2, int y2, int on);
+void ipc_display_draw_logo(int x, int y, int size);
+void ipc_display_draw_text(int x, int y, char *str);
+void ipc_display_draw_progressbar(
+ int x1, int y1, int x2, int y2,
+ int min, int max, int value);
+
+#endif
+
#!/bin/sh
#
-# KOZOS IPC Call Graph Visualization Tool (Version 0.0.1)
+# KOZOS IPC Relationship Visualization Tool (Version 0.0.1)
# Copyright(C) 2012 Shinichiro Nakamura (CuBeatSystems)
#
#
# バナー
#
-echo "// Generated by KOZOS IPC Call Graph Visualization Tool " >> $DOTFILE
-echo "// Copyright(C) 2012 Shinichiro Nakamura (CuBeatSystems)" >> $DOTFILE
+echo "// Generated by KOZOS IPC Relationship Visualization Tool" >> $DOTFILE
+echo "// Copyright(C) 2012 Shinichiro Nakamura (CuBeatSystems) " >> $DOTFILE
echo "" >> $DOTFILE
#
#include "kozos.h"
#include "lib.h"
#include "driver_console.h"
-#include "task_display.h"
+#include "ipc_display.h"
int task_command(int argc, char *argv[])
{
console_write(p + 4); /* echo¤Ë³¤¯Ê¸»úÎó¤ò½ÐÎϤ¹¤ë */
console_write("\n");
} else if (!strncmp(p, "led1", 4)) {
- display_led_toggle(0);
+ ipc_display_led_toggle(0);
} else if (!strncmp(p, "led2", 4)) {
- display_led_toggle(1);
+ ipc_display_led_toggle(1);
} else if (!strncmp(p, "ledg", 4)) {
- display_led_toggle(2);
+ ipc_display_led_toggle(2);
} else if (!strncmp(p, "ledr", 4)) {
- display_led_toggle(3);
+ ipc_display_led_toggle(3);
} else {
console_write("unknown.\n");
}
#include "task_display.h"
+#include "ipc_display.h"
#include "sg12232c.h"
#include "kozos.h"
#include "lib.h"
#include "led.h"
-#define DISPLAY_CMD_LCD_CLEAR 'c' /* LCD\e$B$N>C5n\e(B */
-#define DISPLAY_CMD_LCD_DRAW_BOX 'b' /* BOX\e$BIA2h%3%^%s%I\e(B */
-#define DISPLAY_CMD_LCD_DRAW_LOGO 'l' /* LOGO\e$BIA2h%3%^%s%I\e(B */
-#define DISPLAY_CMD_LCD_DRAW_TEXT 't' /* TEXT\e$BIA2h%3%^%s%I\e(B */
-#define DISPLAY_CMD_LCD_DRAW_PBAR 'p' /* PBAR\e$BIA2h%3%^%s%I\e(B */
-#define DISPLAY_CMD_LED_ON '1' /* LED\e$B$NE@Et\e(B */
-#define DISPLAY_CMD_LED_OFF '0' /* LED\e$B$N>CEt\e(B */
-#define DISPLAY_CMD_LED_TOGGLE 'a' /* LED\e$B$N%H%0%k\e(B */
-
-void display_led_write(int target, int state)
-{
- char *p;
- p = kz_kmalloc(2);
- p[0] = state ? DISPLAY_CMD_LED_ON : DISPLAY_CMD_LED_OFF;
- p[1] = '0' + target;
- kz_send(MSGBOX_ID_DISPLAY, 2, p);
-}
-
-void display_led_toggle(int target)
-{
- char *p;
- p = kz_kmalloc(2);
- p[0] = DISPLAY_CMD_LED_TOGGLE;
- p[1] = '0' + target;
- kz_send(MSGBOX_ID_DISPLAY, 2, p);
-}
-
-void display_clear(void)
-{
- char *p;
- p = kz_kmalloc(1);
- p[0] = DISPLAY_CMD_LCD_CLEAR;
- kz_send(MSGBOX_ID_DISPLAY, 1, p);
-}
-
-void display_draw_box(int x1, int y1, int x2, int y2, int on)
-{
- char *p;
- p = kz_kmalloc(6);
- p[0] = DISPLAY_CMD_LCD_DRAW_BOX;
- p[1] = x1;
- p[2] = y1;
- p[3] = x2;
- p[4] = y2;
- p[5] = !on;
- kz_send(MSGBOX_ID_DISPLAY, 6, p);
-}
-
-void display_draw_logo(int x, int y, int size)
-{
- char *p;
- p = kz_kmalloc(4);
- p[0] = DISPLAY_CMD_LCD_DRAW_LOGO;
- p[1] = x;
- p[2] = y;
- p[3] = size;
- kz_send(MSGBOX_ID_DISPLAY, 4, p);
-}
-
-void display_draw_text(int x, int y, char *str)
-{
- char *p;
- int len;
- len = strlen(str);
- p = kz_kmalloc(3 + len + 1);
- p[0] = DISPLAY_CMD_LCD_DRAW_TEXT;
- p[1] = x;
- p[2] = y;
- memcpy(&p[3], str, len);
- p[3 + len] = '\0';
- kz_send(MSGBOX_ID_DISPLAY, 3 + len + 1, p);
-}
-
-void display_draw_progressbar(
- int x1, int y1, int x2, int y2,
- int min, int max, int value)
-{
- char *p;
- p = kz_kmalloc(8);
- p[0] = DISPLAY_CMD_LCD_DRAW_PBAR;
- p[1] = x1;
- p[2] = y1;
- p[3] = x2;
- p[4] = y2;
- p[5] = min;
- p[6] = max;
- p[7] = value;
- kz_send(MSGBOX_ID_DISPLAY, 8, p);
-}
-
static void draw_logo(const int ofsx, const int ofsy, const int size)
{
static const uint8 logo_40x32[] = {
#ifndef DISPLAY_H
#define DISPLAY_H
-void display_led_write(int target, int state);
-void display_led_toggle(int target);
-void display_clear(void);
-void display_draw_box(int x1, int y1, int x2, int y2, int on);
-void display_draw_logo(int x, int y, int size);
-void display_draw_text(int x, int y, char *str);
-void display_draw_progressbar(
- int x1, int y1, int x2, int y2,
- int min, int max, int value);
-
int task_display(int argc, char *argv[]);
#endif
#include "lib.h"
#include "kozos.h"
#include "task_menu.h"
-#include "task_display.h"
+#include "ipc_display.h"
#define MENU_CMD_FILENAME 'F'
#define MENU_CMD_LOCATION 'L'
#define LED_LEFT() \
do { \
- display_led_write(1, 0); \
- display_led_toggle(0); \
+ ipc_display_led_write(1, 0); \
+ ipc_display_led_toggle(0); \
} while (0)
#define LED_RIGHT() \
do { \
- display_led_write(0, 0); \
- display_led_toggle(1); \
+ ipc_display_led_write(0, 0); \
+ ipc_display_led_toggle(1); \
} while (0)
#define LED_GREEN() \
do { \
- display_led_toggle(2); \
+ ipc_display_led_toggle(2); \
} while (0)
#define LED_RED() \
do { \
- display_led_toggle(3); \
+ ipc_display_led_toggle(3); \
} while (0)
#define DISP_VOLUME(N) \
- display_draw_progressbar(107, 3, 118, 7, VOL_MIN, VOL_MAX, N)
+ ipc_display_draw_progressbar(107, 3, 118, 7, VOL_MIN, VOL_MAX, N)
#define DISP_LOCATION(N) \
- display_draw_progressbar(24, 13, 83, 17, 0, 100, N)
+ ipc_display_draw_progressbar(24, 13, 83, 17, 0, 100, N)
static int _volume = VOL_DEF;
static int _control = 0;
int cmd = p[0];
switch (cmd) {
case MENU_CMD_FILENAME:
- display_draw_text(24, 3, &p[1]);
+ ipc_display_draw_text(24, 3, &p[1]);
break;
case MENU_CMD_LOCATION:
DISP_LOCATION(p[1]);
int task_menu(int argc, char *argv[])
{
- display_clear();
- display_draw_box(0, 0, 121, 31, 1);
- display_draw_logo(2, 2, 0);
+ ipc_display_clear();
+ ipc_display_draw_box(0, 0, 121, 31, 1);
+ ipc_display_draw_logo(2, 2, 0);
DISP_VOLUME(_volume);
while (1) {