nios_compatibility.c

来自「altera epxa1的例子程序」· C语言 代码 · 共 47 行

C
47
字号

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "stripe.h"
#include "serial.h"

// these are for nios s/w compatibility
int nr_uart_txchar(int c,char *uartBase)
{
    putchar(c);
    return 0;
}

int nr_uart_rxchar(int c)
{
    return (kbhit()) ? getchar() : -1;
}

// Starts on first call, hogs timer1.
int nr_timer_milliseconds(void)
{
    return readtimems();
}

// wait for d ms
int nr_delay(int d)
{
    unsigned long t;
    t = readtimems();
    while ((readtimems() - t) < d);
    return 0;
}

void nr_zerorange(char *rangeStart,int rangeByteCount)
{
    while (rangeByteCount--) *rangeStart++ = 0;
}

// bcopy exisits in gnu but not for armcc
void bcopy(char *in, char *out, int n)
{
    memmove((void *)out, (void *)in, n);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?