# PROJECT: Build New MicroBlaze
# ----------------------------------------------------------------------
#
# Copyright (C) 2011-2012 H.Ishihara, http://www.aquaxis.com/
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# For further information please contact.
# http://www.aquaxis.com/
# info(at)aquaxis.com or hidemi(at)sweetcafe.jp
TARGET=Atlys_LED_test.elf
SRCDIR=./
OBJDIR=./
SRCS= $(SRCDIR)Atlys_LED_test.c
OBJS= $(OBJDIR)Atlys_LED_test.o
CC=mb-gcc
CFLAGS=-O2 -mlittle-endian -Wl,-Map=Atlys_LED_test.map
LDFLAGS1=-Wl,-s
$(TARGET) : $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS1) $(OBJS) -o $(OBJDIR)$(TARGET) $(LDFLAGS2)
$(OBJDIR)Atlys_LED_test.o: $(SRCDIR)Atlys_LED_test.c $(INCS)
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f Atlys_LED_test.elf $(OBJDIR)*.o Atlys_LED_test.map
//
// Atlys_LED_test.c
//
// AltysボードのLEDを1秒ごとに+1するソフトウェア
// 初めは割り込みを使わないで実行する
//
#define GPO1_ADDR 0x80000010
#define GPI1_ADDR 0x80000020
#define PIT1_PRELOAD_ADDR 0x80000040
#define PIT1_COUNTER_ADDR 0x80000044
#define PIT1_CONTROL_ADDR 0x80000048
#define COUNT_VALUE 100
int main()
{
unsigned int b_GPI1 = 0;
unsigned int c_GPI1 = 0;
unsigned int led = 0x55;
*(volatile unsigned int *)(PIT1_PRELOAD_ADDR) = COUNT_VALUE; // 100MHzで1秒
*(volatile unsigned int *)(PIT1_CONTROL_ADDR) = 0x3; // Timer Enable, Auto Reload
*(volatile unsigned int *)(GPO1_ADDR) = led;
while(1){
c_GPI1 = 0x2 & (*(volatile unsigned int *)(GPI1_ADDR));
if (c_GPI1 != b_GPI1){
*(volatile unsigned int *)(GPO1_ADDR) = led++;
}
b_GPI1 = c_GPI1;
}
}
日 | 月 | 火 | 水 | 木 | 金 | 土 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | - | - | - | - |