#if defined(USE_SYSBIOS)
#include <xdc/std.h>
#include <xdc/runtime/Error.h>
#include <ti/sysbios/knl/Clock.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <inttypes.h>
#include <time.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#if (defined(_NET_H_) || defined(_DSKNET_H_) || defined(HAVE_LINK_STATUS))
#endif
#ifdef _UARTIO_H_
char *
printf_uart_str = {
"\r\n please connect a free serial PC port to the RS232 connector \r\n on your D.Base2 and start a terminal program configured to\r\n >>115200 baud, 8 bits, 1 stop bit, no parity<<\r\n to see CPrintf outputs\r\n"};
char UART_Printf_Buffer[512];
#endif
#ifdef INC_TIMER
TIMER_Handle hSystemTimer = INV;
#if defined(USE_SYSBIOS)
Clock_Handle hTimerClock;
#endif
#endif
#ifdef INC_MMCSPIDRIVE
#endif
#ifdef INC_CMD
#ifndef CMDLINE_MAX_LEN
#define CMDLINE_MAX_LEN 79
#endif
static char aCmdLine[CMDLINE_MAX_LEN+1] = { 0 };
{
#ifdef _UARTIO_H_
#else
#endif
aCmdLine,
};
#endif
{
#if (!(defined(USE_DSPBIOS) || defined(USE_SYSBIOS)))
#endif
}
{
CSL_init();
CACHE_enableCaching(CACHE_EMIFA_CE00);
CACHE_enableCaching(CACHE_EMIFA_CE01);
CACHE_enableCaching(CACHE_EMIFA_CE02);
CACHE_enableCaching(CACHE_EMIFA_CE03);
#ifdef USE_SPIDRIVE
ConfigureCardDetect (15);
#endif
}
{
#ifdef INC_TIMER
#endif
_disable_interrupts();
#ifdef _UARTIO_H_
#endif
#ifdef _USBIO_H_
#endif
}
{
#if (!(defined(USE_DSPBIOS) || defined(USE_SYSBIOS)))
#endif
}
{
_enable_interrupts();
IER |= 0x2;
}
{
IER = 0;
ICR = 0xFFFF;
CSR &= ~1;
}
{
}
#if (defined(_NET_H_) || defined(_DSKNET_H_) || defined(HAVE_LINK_STATUS))
{
switch (mode)
{
case 0xff:
if (!((
eth.
ip[0]-
'0')<=9))
{
}
break;
default:
{
}
break;
}
}
{
static uint8_t _link_mode_old = 0xff;
{
if (pLog) pLog ("\n\r Link status changed: ");
{
case 0xff:
if (pLog) pLog ("No Link\r\n");
break;
default:
if (pLog) pLog ("Linked at %d%sMbit %s duplex\r\n",
break;
}
return (1);
}
return (0);
}
{
{
wait_for_ip = 1;
return(ret);
}
if (wait_for_ip)
{
wait_for_ip = 0;
ret = 1;
if (pLog)
{
{
pLog (" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n");
pLog (" !!! warning: no DHCP server available !!!\r\n");
pLog (" !!! assigned IP address is a link-local address !!!\r\n");
pLog (" !!! make sure your host is in the same local !!!\r\n");
pLog (" !!! subnet: 169.254.x.x !!!\r\n");
pLog (" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n");
}
pLog ("\r\n network configuration:");
}
}
return (ret);
}
{
char uid[6];
if (NetInitStatus) return (0);
{
#ifdef EMAC_DETAIL
return (1);
#else
prg_exit (
"\r\nDM2_EmacInit() function failed\r\nEthernet defect");
#endif
}
if (!((
eth.
ip[0]-
'0')<=9))
{
if ( strlen(
eth.
ip) < (30-5) )
{
sprintf (uid,
"-%04X",
htons(buffer[2]));
}
else
{
#ifdef EMAC_DETAIL
return (2);
#else
#endif
}
}
{
#ifdef EMAC_DETAIL
return (3);
#else
#endif
}
if (!((
eth.
ip[0]-
'0')<=9))
{
}
{
#ifdef EMAC_DETAIL
return (4);
#else
#endif
}
NetInitStatus = 1;
return (0);
}
#endif
#ifdef _UARTIO_H_
{
char c=0;
{
}
}
{
}
{
va_list argptr;
int cnt = 0;
#pragma diag_suppress 238
va_start (argptr, format);
#pragma diag_default 238
cnt = vsprintf (UART_Printf_Buffer, format, argptr);
if (cnt > 512)
{
}
va_end(argptr);
return (cnt);
}
{
}
{
}
{
}
#endif
#ifdef _USBIO_H_
int BoardUsbInit ( int epnr, void(* callback)())
{
unsigned int ret;
if (ret == 0)
{
if (ret == 0)
{
return(2);
}
}
if ( epnr & 1 )
{
{
return(1);
}
{
return(1);
}
}
if ( epnr & 2 )
{
{
return(1);
}
{
return(1);
}
}
return(0);
}
{
if (usb_configured)
{
{
usbioevt |= USBIO_INTEVT_EP1TX;
}
{
usbioevt |= USBIO_INTEVT_EP1RX;
}
{
usbioevt |= USBIO_INTEVT_EP2TX;
}
{
usbioevt |= USBIO_INTEVT_EP2RX;
}
return (usbioevt);
}
else
{
return (0);
}
}
{
if (events & USBIO_INTEVT_EP1TX)
{
}
if (events & USBIO_INTEVT_EP1RX)
{
}
if (events & USBIO_INTEVT_EP2TX)
{
}
if (events & USBIO_INTEVT_EP2RX)
{
}
}
#endif
#ifdef INC_TIMER
{
if ( (port >= TIMER_DEVICE_CNT) && (port != -1) )
{
return (1);
}
if ( (utime == 0) || (timer_clock <1000000) )
{
return (1);
}
if (hSystemTimer != INV)
{
TIMER_close (hSystemTimer);
}
if ((hSystemTimer = TIMER_open(port, TIMER_OPEN_RESET)) == INV)
{
return (1);
}
TIMER_configArgs(hSystemTimer, 0x201, (timer_clock/1000000)*utime, 0);
return (0);
}
{
if ( (port >= TIMER_DEVICE_CNT) && (port != -1) )
{
}
if (hSystemTimer == INV)
{
}
IRQ_setVecs((void*)0);
IRQ_nmiEnable();
IRQ_globalEnable();
}
{
if ( (port >= TIMER_DEVICE_CNT) && (port != -1) )
{
}
if (hSystemTimer == INV)
{
}
TIMER_start(hSystemTimer);
}
{
if ( (port >= TIMER_DEVICE_CNT) && (port != -1) )
{
}
if (hSystemTimer == INV)
{
}
TIMER_pause(hSystemTimer);
}
#endif // INC_TIMER
{
}
{
if (ledNum >= 4)
return;
}
void LED_on(
unsigned int ledNum)
{
if (ledNum >= 4)
return;
}
{
unsigned int led_mask = 1 << (ledNum);
if (ledNum >= 4)
return;
else
}
{
}
{
}
{
return 0;
}
#ifdef INC_MMCSPIDRIVE
{
(void)param;
return ( (CARD_STATUS & DC_REG_STAT0) ? 0 : 1);
}
void SpiSelectCard ( void )
{
SELECT_CARD;
}
void SpiDeselectCard ( void )
{
DESELECT_CARD;
}
#endif // #ifdef _MMCSPI_H_