linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Typo in drivers/char/Config.in?
@ 2001-11-30 15:45 Kent Borg
  2001-11-30 18:35 ` Printing out message to a console in MBX860?? Okehee Goh
  0 siblings, 1 reply; 3+ messages in thread
From: Kent Borg @ 2001-11-30 15:45 UTC (permalink / raw)
  To: linuxppc-embedded


In drivers/char/Config/in, line 194, there seems to be a typo.


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Typo in drivers/char/Config.in?
@ 2001-11-30 15:48 Kent Borg
  0 siblings, 0 replies; 3+ messages in thread
From: Kent Borg @ 2001-11-30 15:48 UTC (permalink / raw)
  To: linuxppc-embedded


Sorry about doing a send before I was through writing that last e-mail.

As I was saying, I think there is a typo in drivers/char/Config.in.


-kb



--- linuxppc_2_4_devel/drivers/char/Config.in	Thu Nov 29 11:07:32 2001
+++ linuxppc_2_4_devel/drivers/char/Config.in.fixed	Fri Nov 30 10:44:33 2001
@@ -191,7 +191,7 @@

 dep_tristate 'Intel i8x0 Random Number Generator support' CONFIG_INTEL_RNG $CONFIG_PCI
 tristate '/dev/nvram support' CONFIG_NVRAM
-if [ "$CONFIG_PPC_ISERIES" != "y"  -a "$CONFIG_PPC_PSERIES" != y ]; then
+if [ "$CONFIG_PPC_ISERIES" != "y"  -a "$CONFIG_PPC_PSERIES" != "y" ]; then
    tristate 'Enhanced Real Time Clock Support' CONFIG_RTC
 fi
 if [ "$CONFIG_IA64" = "y" ]; then

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Printing out message to a console in MBX860??
  2001-11-30 15:45 Typo in drivers/char/Config.in? Kent Borg
@ 2001-11-30 18:35 ` Okehee Goh
  0 siblings, 0 replies; 3+ messages in thread
From: Okehee Goh @ 2001-11-30 18:35 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]


 I'm so sorry to post this unrelated message.
....
Hello,
I want to print out some message to console monitor for a debugging from the
application loaded
 at MBX860 through EPPC-Bug.This machine doesn't have any OS and my
application is a kernel.

The port status is the following.

EPPC-Bug>pf
Current Port Assignments:  (LUN: Device-Name Port-Name)

00: FDC37C672-COM     COM1              (Console)

01: MPC8XX-SMC        SMC2

02: MEMORY            CHNL0

According to MBX manual, SMC1 is used as console port.

If it's true, COM1 is using SMC1?

So, I thought I must use SMC'1 UART to print out to a console. Is it
correct?

I tested the application using SMC1' s UART

 by applying a SMC's UART application note provided by Motorola's
website(MPC860COD17).

But It doesn't seem to work. I can't see anything from a console after
executing this test application.

The following is what I did to run this application using SMC1' UART.

-----------

EPPC-Bug>LO 0; X=cat smc1.s3

EPPC-Bug>GO

Effective address: 00080004


--------------
I attached the source code.

Thank you so much for any help.



Okehee

[-- Attachment #2: smc1.c --]
[-- Type: application/octet-stream, Size: 14164 bytes --]

/*-------------------------------------------------------------------------
* FILENAME:  SMC1.c
*
* DESCRIPTION:   
*
*   The code in this module provides echo capability on SMC1. It's 
*   intent is to provide the beginnings of a debug port that is 
*   mostly compiler independent. If an ASCII terminal is connected
*   at 9600,N,8,1 on Port 2 (PB3) on the ADS board with no hardware
*   control, characters typed on the keyboard will be received by
*   SMC1 and echoed back out the RS232 port to the ASCII terminal.
*   This function was designed and tested on an ADS860 
*   development board. Note that if a different baud rate is 
*   required, there is a header file on the netcomm website under 
*   the General Software category that is labelled "Asynchronous
*   Baud Rate Tables".
*
* REFERENCES:
*
*   1) MPC860 Users Manual
*   2) PowerPC Microprocessor Family: The Programming Environments for 
*      32-Bit Microprocessors
*
* HISTORY:
*
* 27 APR 98  jay    initial release
*
*-------------------------------------------------------------------------*/

#include "netcomm.h"
#include "mpc860.h"
#include "masks860.h"
#include "smc1.h"

int stack[100]=0;
int stackTop;

/***********************/
/* Global Declarations */
/***********************/

EPPC  *IMMR;      /* IMMR base pointer */
BDRINGS *RxTxBD;  /* buffer descriptors base pointer */
LB *SMC1Buffers;  /* SMC1 base pointers */

/*---------------------*/
/* Function Prototypes */
/*---------------------*/

void  startup(void);
void  SMC1Init(void);
void  SMC1PutChar(UBYTE);
UBYTE SMC1GetChar(void);
UBYTE SMC1Poll(void);
void  main(void);
void  InitBDs(void);
void  EchoChar(void);


/*
void startup (void)
{
	 asm("     	.global	_start ");
	 asm("_start:	 ");
	 asm("		addis   r1,r0,stackTop@h");
	 asm("		ori     r1,r1,stackTop@l");

  main();
}
*/

/*-----------------------------------------------------------------------------
*
* FUNCTION NAME:  main 
*
* DESCRIPTION:
*
*  This is the main function for the SMC1 code.
*
* EXTERNAL EFFECT: 
*                 
* PARAMETERS:  None
*
* RETURNS: None
*
*---------------------------------------------------------------------------*/

void main(void)

{

   /*------------------------*/
   /* Establish IMMR pointer */
   /*------------------------*/
      
   IMMR = (EPPC *)(GetIMMR() & 0xFFFF0000);  /* MPC8xx internal register
                                                map  */

   /*--------------------------------------------------------------------*/
   /* We add 64 bytes to the start of the buffer descriptors because     */
   /* this code was also tested on the monitor version of SDS debugger.  */
   /* The monitor program on our target uses most of the first 64 bytes  */
   /* for buffer descriptors. If you are not using the SDS monitor  with */
   /* Motorola's ADS development board, you can delete 64 below and      */
   /* start at the beginning of this particular block of Dual Port RAM.  */
   /*--------------------------------------------------------------------*/

   /*----------------------------------*/  
   /* Get pointer to BD area on DP RAM */
   /*----------------------------------*/  
      
   RxTxBD = (BDRINGS *)(IMMR->qcp_or_ud.ud.udata_bd + 64);  

   /*-------------------------------------------------------------------*/
   /* Establish the buffer pool in Dual Port RAM. We do this because the*/
   /* pool size is only 2 bytes (1 for Rx and 1 for Tx) and to avoid    */
   /* disabling data cache for the memory region where BufferPool would */
   /* reside. The CPM does not recognize data in buffer pools once it   */
   /* been cached. It's acesses are direct through DMA to external      */
   /* memory.                                                           */
   /*-------------------------------------------------------------------*/

   SMC1Buffers = (LB *)(IMMR->qcp_or_ud.ud.udata_bd + 80);

   /*----------------------------------------*/
   /* Initialize SMC1 and buffer descriptors */
   /*----------------------------------------*/

   SMC1Init();

   while (1)

   {
      /*--------------------------------------------------*/
      /* if there is a receive character echo it back out */
      /*--------------------------------------------------*/

      if (SMC1Poll())   /* Check BD status for Rx characters */

         EchoChar();
   }

} /* END main */



/*-----------------------------------------------------------------------------
*
* FUNCTION NAME:  SMC1Init 
*
* DESCRIPTION:
*
*  Initialize SMC1 as a UART at 9600 Baud 
*  with 40MHZ CPU clock.
*
* EXTERNAL EFFECT: 
*                 
* PARAMETERS:  None
*
* RETURNS: None
*
*---------------------------------------------------------------------------*/

void SMC1Init(void)

{

unsigned long *bcsr1; 
   
	/*-----------------------*/
	/* Allow SMC1 TX, RX out */
	/*-----------------------*/

   IMMR->pip_pbpar |= (0x03000000);     
   IMMR->pip_pbdir &= 0xFCFFFFFF; 

   /*------------------------------------------------*/
   /* Set Baud Rate to 9600 for 40MHz System Clock.  */
   /* Enable BRG Count.									     */
   /*------------------------------------------------*/

   IMMR->brgc2 = (0x00202 | 0x10000);   /* CD is 259 for target bd 9600 at 40MHz system */

   IMMR->si_simode &= ~(0x0000F000);    /* SMC1:  NMSI mode */
   IMMR->si_simode |= 0x00001000;       /* SMC1:  Tx/Rx Clocks are BRG2 */


   /*----------------------------------------*/
	/* Set RXBD table start at Dual Port +800 */
	/*----------------------------------------*/

   IMMR->PRAM[PAGE3].pg.other.smc_dsp1.psmc1.u1.rbase = 
    
   (UHWORD)&RxTxBD->RxBD;

   /*----------------------------------------*/
	/* Set TXBD table start at Dual Port +808 */
	/*----------------------------------------*/

   IMMR->PRAM[PAGE1].pg.other.smc_dsp1.psmc1.u1.tbase =	
    
   (UHWORD)&RxTxBD->TxBD;	    	

   /*---------------------------------------*/
   /* Initialize Rx and Tx Params for SMC1: */
   /* Spin until cpcr flag is cleared		  */
   /*---------------------------------------*/

   for(IMMR->cp_cr = 0x0091; IMMR->cp_cr & 0x0001;) ;
	
   /*---------------------------------------*/
   /* Initialize SDCR: */
   /*---------------------------------------*/
   IMMR->dma_sdcr = 0x0001;
   
	/*--------------------------------------*/
   /* Set RFCR,TFCR -- Rx,Tx Function Code */
   /* Normal Operation and Motorola byte   */
   /* ordering                             */
	/*--------------------------------------*/

   IMMR->PRAM[PAGE3].pg.other.smc_dsp1.psmc1.u1.rfcr = 0x10;  
                                                               

   IMMR->PRAM[PAGE3].pg.other.smc_dsp1.psmc1.u1.tfcr = 0x10;  

   /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
   /* Protocol Specific Parameters */
   /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

   /*---------------------------*/
   /* MRBLR = MAX buffer length */
   /*---------------------------*/

   IMMR->PRAM[PAGE3].pg.other.smc_dsp1.psmc1.u1.mrblr = 0x0010;    

   /*------------------------------------*/
   /* MAX_IDL = Disable MAX Idle Feature */
   /*------------------------------------*/

   IMMR->PRAM[PAGE3].pg.other.smc_dsp1.psmc1.u1.max_idl = 0;  

   /*-------------------------------------*/
   /* BRKEC = No break condition occurred */
   /*-------------------------------------*/

   IMMR->PRAM[PAGE3].pg.other.smc_dsp1.psmc1.u1.brkec = 0;    

   /*---------------------------------------*/
   /* BRKCR = 1 break char sent on top XMIT */
   /*---------------------------------------*/

   IMMR->PRAM[PAGE3].pg.other.smc_dsp1.psmc1.u1.brkcr = 0;    


   /*--------------------*/
   /* Initialize the BDs */
   /*--------------------*/

   InitBDs();

   IMMR->smc_regs[SMC1_REG].smc_smce = 0xFF;  /* Clear any pending events */

   /*--------------------------------------------------*/
   /* SMC_SMCM = Mask all interrupts, use polling mode */
   /*--------------------------------------------------*/

   IMMR->smc_regs[SMC1_REG].smc_smcm = 0x17;     

   IMMR->cpmi_cicr = 0;           /* Disable all CPM interrups */
   IMMR->cpmi_cipr = 0xFFFFFFFF;  /* Clear all pending interrupt events */
   IMMR->cpmi_cimr = 0;           /* Mask all event interrupts */

   /*-----------------------------------------------*/
   /* Enable RS232 interface on ADS board via BCSR1 */
   /* Get the base address of BCSR                  */ 
   /*-----------------------------------------------*/

   bcsr1 = (UWORD *) ((IMMR->memc_br1 & 0xFFFFFFFE) + 4);    
   *bcsr1 &= 0xFFFB0000;  /* Assert the RS232EN* bit */

   /*------------------------------------*/
   /* 8-bit mode,  no parity, 1 stop-bit */
   /* UART SMC Mode							  */
   /* Normal operation (no loopback),	  */
   /* SMC Transmitter/Receiver Enabled	  */
   /*------------------------------------*/

   IMMR->smc_regs[SMC1_REG].smc_smcmr = 0x4823;

} /* END SMC1Init */



/*-----------------------------------------------------------------------------
*
* FUNCTION NAME:  InitBDs
*
* DESCRIPTION: This function initializes the Tx and Rx Buffer Descriptors.
*
* EXTERNAL EFFECT: RxTxBD
*                 
* PARAMETERS:  None
*
* RETURNS: None
*
*---------------------------------------------------------------------------*/

void InitBDs(void)

{
   /*-----------------------------------*/
   /* Setup Receiver Buffer Descriptors */
   /*-----------------------------------*/
   
   RxTxBD->RxBD.bd_cstatus = 0xB000;            /* Enable, Last BD */
   RxTxBD->RxBD.bd_length = 1;
   RxTxBD->RxBD.bd_addr = &(SMC1Buffers->RxBuffer);


   /*--------------------------------------*/
   /* Setup Transmitter Buffer Descriptors */
   /*--------------------------------------*/

   RxTxBD->TxBD.bd_cstatus = 0xB000;      /* Buffer not yet ready; Last BD */
   RxTxBD->TxBD.bd_length = 5;
   RxTxBD->TxBD.bd_addr = &(SMC1Buffers->TxBuffer);


} /* END InitBDs */



/*-----------------------------------------------------------------------------
*
* FUNCTION NAME:  EchoChar
*
* DESCRIPTION: This function facilitates the echoing of a received character.
*
* EXTERNAL EFFECT: RxTxBD
*                 
* PARAMETERS:  None
*
* RETURNS: None
*
*---------------------------------------------------------------------------*/

void  EchoChar(void)

{

UBYTE mych;

   mych = SMC1GetChar();
   SMC1PutChar(mych); 
  /*SMC1PutChar(1); */

} /* end EchoChar */


/*-----------------------------------------------------------------------------
*
* FUNCTION NAME:  SMC1PutChar
*
* DESCRIPTION: Output a character to SMC1
*
* EXTERNAL EFFECT: RxTxBD
*                 
* PARAMETERS:  ch - input character
*
* RETURNS: None
*
*---------------------------------------------------------------------------*/

void SMC1PutChar(UBYTE ch)

{
   /*-----------------------------------*/
	/* Loop until transmission completed */
	/*-----------------------------------*/
   
   while (RxTxBD->TxBD.bd_cstatus  &  0x8000);    
   
   /*------------*/ 
	/* Store data */
	/*------------*/

   *(RxTxBD->TxBD.bd_addr) = ch;                  
   RxTxBD->TxBD.bd_length = 1;

   /*---------------*/
   /* Set Ready bit */
 	/*---------------*/

   RxTxBD->TxBD.bd_cstatus |= 0x8000;              


} /* END SMC1PutChar */



/*-----------------------------------------------------------------------------
*
* FUNCTION NAME:  SMC1GetChar
*
* DESCRIPTION: Get a character from SMC1
*
* EXTERNAL EFFECT: RxTxBD
*                 
* PARAMETERS:  NONE
*
* RETURNS: A character from SMC1
*
*---------------------------------------------------------------------------*/

UBYTE SMC1GetChar(void)

{

UBYTE ch;   /* output character from SMC1 */
   
	/*--------------------*/
	/* Loop if RxBD empty */
	/*--------------------*/

   while (RxTxBD->RxBD.bd_cstatus  &  0x8000);      

	/*--------------*/
   /* Receive data */
	/*--------------*/

   ch = *(RxTxBD->RxBD.bd_addr);   
                   
	/*----------------------*/
   /* Set Buffer Empty bit */
	/*----------------------*/

   RxTxBD->RxBD.bd_cstatus |= 0x8000;   

   return ch;

} /* END SMC1GetChar */



/*-----------------------------------------------------------------------------
*
* FUNCTION NAME:  SMC1Poll
*
* DESCRIPTION: Poll SMC1 RxBD and check to see if a character was received
*
* EXTERNAL EFFECT: NONE
*                 
* PARAMETERS:  NONE
*
* RETURNS: A one if there is a character available in the receive buffer,
*          else zero.
*
*---------------------------------------------------------------------------*/

UBYTE SMC1Poll(void)

{
      
   if(RxTxBD->RxBD.bd_cstatus & 0x8000) 
   
   {
       return 0;  /*  character NOT available */
   } 
   
   else
   
   {
       return 1;  /*  character IS available */
   }

} /* END SMC1Poll */



/*-----------------------------------------------------------------------------
*
* FUNCTION NAME:  GetIMMR
*
* DESCRIPTION: Returns current value in the IMMR register.
*
* EXTERNAL EFFECT: NONE
*                 
* PARAMETERS:  NONE
*
* RETURNS: The IMMR value in r3. The compiler uses r3 as the register 
*          containing the return value.
*
*---------------------------------------------------------------------------*/

GetIMMR()

{
    asm(" mfspr  r3,638 ");        /* IMMR is spr #638 */
}




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-11-30 18:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-30 15:45 Typo in drivers/char/Config.in? Kent Borg
2001-11-30 18:35 ` Printing out message to a console in MBX860?? Okehee Goh
  -- strict thread matches above, loose matches on Subject: below --
2001-11-30 15:48 Typo in drivers/char/Config.in? Kent Borg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).