OpenCores
URL https://opencores.org/ocsvn/s6soc/s6soc/trunk

Subversion Repositories s6soc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /s6soc/trunk
    from Rev 46 to Rev 47
    Reverse comparison

Rev 46 → Rev 47

/sw/dev/blinky.c
0,0 → 1,96
////////////////////////////////////////////////////////////////////////////////
//
// Filename: blinky.c
//
// Project: CMod S6 System on a Chip, ZipCPU demonstration project
//
// Purpose: To toggle/blink the LEDs in a fashion that will let us know
// 1) that the CPU is running, 2) that the LEDs are working, and
// even better, 3) that the buttons are working.
//
//
// Creator: Dan Gisselquist, Ph.D.
// Gisselquist Technology, LLC
//
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015-2017, Gisselquist Technology, LLC
//
// This program is free software (firmware): you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or (at
// your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program. (It's in the $(ROOT)/doc directory, run make with no
// target there if the PDF file isn't present.) If not, see
// <http://www.gnu.org/licenses/> for a copy.
//
// License: GPL, v3, as defined and found on www.gnu.org,
// http://www.gnu.org/licenses/gpl.html
//
//
////////////////////////////////////////////////////////////////////////////////
//
//
// #include "asmstartup.h"
#include "board.h"
 
void zip_idle(void);
 
asm("\t.section\t.start\n"
"\t.global\t_start\n"
"\t.type\t_start,@function\n"
"_start:\n"
"\tMOV\tkernel_exit(PC),uPC\n"
"\tLDI 104,R0\n"
"\tSW R0,0x41c\n"
"\tLDI 0xff,R0\n"
"\tSW R0,0x414\n"
"\tLDI\t_top_of_stack,SP\n"
"\tJSR\tentry\n"
"\tNEXIT\tR0\n"
"kernel_exit:\n"
"\tBUSY\n"
"\t.section\t.text");
 
void entry(void) {
const char *msg = "Hello, World!\r\n", *ptr = msg;
int count = 0;
 
_sys->io_spio = 0x0fa;
_sys->io_timer = TM_REPEAT | (TM_ONE_SECOND/4);
_sys->io_pic = INT_ENABLEV(INT_TIMER)|INT_CLEAR(INT_TIMER);
 
do {
zip_idle();
int picv = _sys->io_pic;
if (picv & INT_TIMER) {
int ledv = _sys->io_spio;
ledv <<= 1;
ledv = ledv & 0x0f;
if (ledv == 0)
ledv = 1;
_sys->io_spio = ledv | 0x0f0;
 
if (*ptr)
_sys->io_uart = (unsigned)*ptr++;
if (count++ > 4*60) {
count = 0;
ptr = msg;
}
}
 
_sys->io_pic = INT_ENABLEV(INT_TIMER)|INT_CLEAR(INT_TIMER);
} while(1);
}
 
// PPONP16P
// 00120O91
// 00120NM3
// 00120E91 = 1183377 ~= 91029 / char, at 0x208d 8333/baud, 83,330 per char
/sw/dev/txfns.c
0,0 → 1,87
////////////////////////////////////////////////////////////////////////////////
//
// Filename: txfns.c
//
// Project: CMod S6 System on a Chip, ZipCPU demonstration project
//
// Purpose:
//
// Creator: Dan Gisselquist, Ph.D.
// Gisselquist Technology, LLC
//
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015-2017, Gisselquist Technology, LLC
//
// This program is free software (firmware): you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or (at
// your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program. (It's in the $(ROOT)/doc directory, run make with no
// target there if the PDF file isn't present.) If not, see
// <http://www.gnu.org/licenses/> for a copy.
//
// License: GPL, v3, as defined and found on www.gnu.org,
// http://www.gnu.org/licenses/gpl.html
//
//
////////////////////////////////////////////////////////////////////////////////
//
//
#include "board.h"
#include "txfns.h"
 
void txchr(char ch);
void txval(int val);
void txstr(const char *str);
 
void txchr(char val) {
volatile IOSPACE *const sys = _sys;
unsigned v = (unsigned char)val;
 
// To read whether or not the transmitter is ready, you must first
// clear the interrupt bit.
sys->io_pic = INT_UARTTX;
// If the interrupt bit sets itself again immediately, the transmitter
// is ready. Otherwise, wait until the transmitter becomes ready.
while((sys->io_pic&INT_UARTTX)==0)
;
sys->io_uart = (v&0x0ff);
// Give the transmitter a chance to finish, and then to create an
// interrupt when done
sys->io_pic = INT_UARTTX;
}
 
void txstr(const char *str) {
const char *ptr = str;
while(*ptr)
txchr(*ptr++);
}
 
void txval(int val) {
txstr("\r\n0x");
for(int i=28; i>=0; i-=4) {
int ch = ((val>>i)&0x0f)+'0';
if (ch > '9')
ch = ch - '0'+'A'-10;
txchr(ch);
}
}
 
void txhex(int val) {
for(int i=28; i>=0; i-=4) {
int ch = ((val>>i)&0x0f)+'0';
if (ch > '9')
ch = ch - '0'+'A'-10;
txchr(ch);
}
txstr("\r\n");
}
 
/sw/dev/txfns.h
0,0 → 1,46
////////////////////////////////////////////////////////////////////////////////
//
// Filename: txfns.h
//
// Project: CMod S6 System on a Chip, ZipCPU demonstration project
//
// Purpose:
//
// Creator: Dan Gisselquist, Ph.D.
// Gisselquist Technology, LLC
//
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015-2017, Gisselquist Technology, LLC
//
// This program is free software (firmware): you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or (at
// your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program. (It's in the $(ROOT)/doc directory, run make with no
// target there if the PDF file isn't present.) If not, see
// <http://www.gnu.org/licenses/> for a copy.
//
// License: GPL, v3, as defined and found on www.gnu.org,
// http://www.gnu.org/licenses/gpl.html
//
//
////////////////////////////////////////////////////////////////////////////////
//
//
#ifndef TXFNS_H
#define TXFNS_H
 
extern void txchr(char ch);
extern void txval(int val);
extern void txhex(int val);
extern void txstr(const char *str);
 
#endif
sw/dev Property changes : Added: svn:ignore ## -0,0 +1,7 ## +.gitignore +doorbell +doorbell2 +helloworld +kptest +obj-zip +tags

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.