📄 syslib.c
字号:
/* Set port B -> RTS1 = *TENA */
/* */
*PBPAR( vxImmrGet() ) &= ~(0x1000);
}
/****************************************************************************/
/* */
/* Function : sysCpmEnetIntDisable( int unit ) */
/* */
/* Purpose. : Disabls the Ethernet interface interrupt */
/* */
/* Returns. : None */
/* */
/* Notes... : None */
/* */
/****************************************************************************/
void sysCpmEnetIntDisable
(
int unit /* not used - only slave SCC1 is wired to port */
)
{
*CIMR( vxImmrGet() ) &= ~CIMR_SCC1;
}
/****************************************************************************/
/* */
/* Function : sysCpmEnetEnable( int unit ) */
/* */
/* Purpose. : Enables the ethernet controller. */
/* */
/* Returns. : OK */
/* */
/* Notes... : None */
/* */
/****************************************************************************/
#ifdef INCLUDE_CPM
STATUS sysCpmEnetEnable
(
int unit /* not used - only slave SCC1 is wired to port */
)
{
/* */
/* Get the location of the IMMR register. */
/* */
int immrVal = vxImmrGet();
/* */
/* Set up ports */
/* */
*PCPAR( immrVal ) &= ~(0x0030);
*PCDIR( immrVal ) &= ~(0x0030);
*PCSO ( immrVal ) |= (0x0030);
/* */
/* Connect SCC1 clocks and enable NMSI mode. */
/* */
#if SCC1_TCLK_CLK4
/* CLK2:RCLK, CLK4:TCLK */
*PAPAR( immrVal ) |= (0x0a03);
*PADIR( immrVal ) &= ~(0x0a03);
*SICR( immrVal ) |= (0x0000002f);
*SICR( immrVal ) &= ~(0x00000040);
#endif
#if SCC1_TCLK_CLK1
/* CLK2:RCLK, CLK1:TCLK */
*PAPAR( immrVal ) |= (0x0303);
*PADIR( immrVal ) &= ~(0x0303);
*SICR( immrVal ) |= (0x0000002c);
*SICR( immrVal ) &= ~(0x00000040);
#endif
/* */
/* Set port B -> *RTS1 = TENA */
/* */
*PBPAR( immrVal ) |= 0x00001000;
*PBDIR( immrVal ) |= 0x00001000;
return( OK ) ;
}
#endif /* INCLUDE_CPM */
/****************************************************************************/
/* */
/* Function : sysCpmEnetAddrGet( int unit , UINT8 * addr ) */
/* */
/* Purpose. : Gets the 6 byte ethernet address used by the ethernet device. */
/* */
/* Returns. : OK */
/* */
/* Notes... : None */
/* */
/****************************************************************************/
#ifdef INCLUDE_CPM
STATUS sysCpmEnetAddrGet
(
int unit , /* not used - only slave SCC1 is wired to port */
UINT8 * addr /* LOcation address is returned in */
)
{
/* */
/* Just copy the address from the locally stored data space */
/* */
bcopy ((char *) sysCpmEnetAddr, (char *) addr, sizeof (sysCpmEnetAddr));
return( OK ) ;
}
#endif /* INCLUDE_CPM */
/****************************************************************************/
/* */
/* Function : sysCpmEnetCommand( int unit , UINT16 command ) */
/* */
/* Purpose. : Issues a command code to the ethernet controller. */
/* */
/* Returns. : OK */
/* */
/* Notes... : None */
/* */
/****************************************************************************/
#ifdef INCLUDE_CPM
STATUS sysCpmEnetCommand
(
int unit, /* not used - only slave SCC1 is wired to port */
UINT16 command /* Command to be issued */
)
{
/* */
/* Get the location of the IMMR register. */
/* */
int immrVal = vxImmrGet();
/* */
/* Actually issue the command. */
/* */
while ( *CPCR( immrVal ) & CPM_CR_FLG ) ;
*CPCR( immrVal ) = CPM_CR_CHANNEL_SCC1 | command | CPM_CR_FLG;
/* */
/* See if the command has been accepted. */
/* */
while ( *CPCR( immrVal ) & CPM_CR_FLG )
{}
return( OK );
}
#endif /* INCLUDE_CPM */
/****************************************************************************/
/* */
/* Function : sysCpmEnetIntEnable( int unit ) */
/* */
/* Purpose. : Enables the ethernet interface interrupt. */
/* */
/* Returns. : None */
/* */
/* Notes... : None */
/* */
/****************************************************************************/
#ifdef INCLUDE_CPM
void sysCpmEnetIntEnable
(
int unit /* not used - only slave SCC1 is wired to port */
)
{
*CIMR( vxImmrGet() ) |= CIMR_SCC1;
}
#endif /* INCLUDE_CPM */
/****************************************************************************/
/* */
/* Function : sysCpmEnetIntClear( int unit ) */
/* */
/* Purpose. : Clears the interrupt for the given ethernet interface. */
/* */
/* Returns. : None */
/* */
/* Notes... : None */
/* */
/****************************************************************************/
#ifdef INCLUDE_CPM
void sysCpmEnetIntClear
(
int unit /* not used - only slave SCC1 is wired to port */
)
{
*CISR( vxImmrGet() ) = CISR_SCC1;
}
#endif /* INCLUDE_CPM */
/*
static unsigned char dataTestW[NV_RAM_SIZE];
static unsigned char dataTestR[NV_RAM_SIZE];
void nvRamTest(void)
{
int x;
for(x = 0; x < NV_RAM_SIZE; x++)
dataTestW[x] = x;
sysNvRamSet( dataTestW, NV_RAM_SIZE, 0);
sysNvRamGet( dataTestR, NV_RAM_SIZE, 0);
for(x = 0; x < NV_RAM_SIZE; x++)
if( dataTestW[x] != dataTestR[x] )
printf("\n %d != %d", dataTestW[x], dataTestR[x]);
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -