Skip to content

Commit 7b40dec

Browse files
sergiou87zeldin
authored andcommitted
Add osk example
1 parent d828710 commit 7b40dec

5 files changed

Lines changed: 548 additions & 1 deletion

File tree

samples/sys/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
TARGETS := msgdialog threadtest
1+
TARGETS := msgdialog osk threadtest
22

33
all:
44
@for TARGET in $(TARGETS); do $(MAKE) --no-print-directory -C $$TARGET; done

samples/sys/osk/Makefile

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#---------------------------------------------------------------------------------
2+
# Clear the implicit built in rules
3+
#---------------------------------------------------------------------------------
4+
.SUFFIXES:
5+
#---------------------------------------------------------------------------------
6+
ifeq ($(strip $(PSL1GHT)),)
7+
$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>")
8+
endif
9+
10+
include $(PSL1GHT)/ppu_rules
11+
12+
#---------------------------------------------------------------------------------
13+
# TARGET is the name of the output
14+
# BUILD is the directory where object files & intermediate files will be placed
15+
# SOURCES is a list of directories containing source code
16+
# INCLUDES is a list of directories containing extra header files
17+
#---------------------------------------------------------------------------------
18+
TARGET := $(notdir $(CURDIR))
19+
BUILD := build
20+
SOURCES := source
21+
DATA := data
22+
INCLUDES := include
23+
24+
TITLE := Osk sample - PSL1GHT
25+
APPID := OSK000001
26+
CONTENTID := UP0001-$(APPID)_00-0000000000000000
27+
#---------------------------------------------------------------------------------
28+
# options for code generation
29+
#---------------------------------------------------------------------------------
30+
31+
CFLAGS = -O2 -Wall -mcpu=cell $(MACHDEP) $(INCLUDE)
32+
CXXFLAGS = $(CFLAGS)
33+
34+
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map
35+
36+
#---------------------------------------------------------------------------------
37+
# any extra libraries we wish to link with the project
38+
#---------------------------------------------------------------------------------
39+
LIBS := -lrsx -lgcm_sys -lio -lsysutil -lrt -llv2 -lm
40+
41+
#---------------------------------------------------------------------------------
42+
# list of directories containing libraries, this must be the top level containing
43+
# include and lib
44+
#---------------------------------------------------------------------------------
45+
LIBDIRS :=
46+
47+
#---------------------------------------------------------------------------------
48+
# no real need to edit anything past this point unless you need to add additional
49+
# rules for different file extensions
50+
#---------------------------------------------------------------------------------
51+
ifneq ($(BUILD),$(notdir $(CURDIR)))
52+
#---------------------------------------------------------------------------------
53+
54+
export OUTPUT := $(CURDIR)/$(TARGET)
55+
56+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
57+
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
58+
59+
export DEPSDIR := $(CURDIR)/$(BUILD)
60+
61+
export BUILDDIR := $(CURDIR)/$(BUILD)
62+
63+
#---------------------------------------------------------------------------------
64+
# automatically build a list of object files for our project
65+
#---------------------------------------------------------------------------------
66+
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
67+
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
68+
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
69+
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
70+
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
71+
72+
#---------------------------------------------------------------------------------
73+
# use CXX for linking C++ projects, CC for standard C
74+
#---------------------------------------------------------------------------------
75+
ifeq ($(strip $(CPPFILES)),)
76+
export LD := $(CC)
77+
else
78+
export LD := $(CXX)
79+
endif
80+
81+
export OFILES := $(addsuffix .o,$(BINFILES)) \
82+
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
83+
$(sFILES:.s=.o) $(SFILES:.S=.o)
84+
85+
#---------------------------------------------------------------------------------
86+
# build a list of include paths
87+
#---------------------------------------------------------------------------------
88+
export INCLUDE := $(foreach dir,$(INCLUDES), -I$(CURDIR)/$(dir)) \
89+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
90+
$(LIBPSL1GHT_INC) \
91+
-I$(CURDIR)/$(BUILD)
92+
93+
#---------------------------------------------------------------------------------
94+
# build a list of library paths
95+
#---------------------------------------------------------------------------------
96+
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
97+
$(LIBPSL1GHT_LIB)
98+
99+
export OUTPUT := $(CURDIR)/$(TARGET)
100+
.PHONY: $(BUILD) clean
101+
102+
#---------------------------------------------------------------------------------
103+
$(BUILD):
104+
@[ -d $@ ] || mkdir -p $@
105+
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
106+
107+
#---------------------------------------------------------------------------------
108+
clean:
109+
@echo clean ...
110+
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).self
111+
112+
#---------------------------------------------------------------------------------
113+
run:
114+
ps3load $(OUTPUT).self
115+
116+
117+
#---------------------------------------------------------------------------------
118+
else
119+
120+
DEPENDS := $(OFILES:.o=.d)
121+
122+
#---------------------------------------------------------------------------------
123+
# main targets
124+
#---------------------------------------------------------------------------------
125+
$(OUTPUT).self: $(OUTPUT).elf
126+
$(OUTPUT).elf: $(OFILES)
127+
128+
#---------------------------------------------------------------------------------
129+
# This rule links in binary data with the .bin extension
130+
#---------------------------------------------------------------------------------
131+
%.bin.o : %.bin
132+
#---------------------------------------------------------------------------------
133+
@echo $(notdir $<)
134+
@$(bin2o)
135+
136+
-include $(DEPENDS)
137+
138+
#---------------------------------------------------------------------------------
139+
endif
140+
#---------------------------------------------------------------------------------

samples/sys/osk/include/rsxutil.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef __RSXUTIL_H__
2+
#define __RSXUTIL_H__
3+
4+
#include <rsx/rsx.h>
5+
#include <sysutil/video.h>
6+
7+
#define CB_SIZE 0x100000
8+
#define HOST_SIZE (32*1024*1024)
9+
10+
#ifdef __cplusplus
11+
extern "C" {
12+
#endif
13+
14+
extern gcmContextData *context;
15+
extern u32 display_width;
16+
extern u32 display_height;
17+
extern u32 curr_fb;
18+
19+
void set_render_target(u32 index);
20+
void init_screen(void *host_addr,u32 size);
21+
void waitflip();
22+
void flip();
23+
24+
#ifdef __cplusplus
25+
}
26+
#endif
27+
28+
#endif

0 commit comments

Comments
 (0)