Hi friends ,
here i have done it Blinking LED in S3c2440 development board.. also declare serial received character display at 115200 baud rate..
The source code as:: (any doubt contact me)
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
//================================
void dely(U32 tt)
{
U32 i;
for(;tt>0;tt--)
{
for(i=0;i<10000;i++){}
}
}
int Main()
{
U8 key=14,ch,c;
U32 val;int pclk,baud;
U8 m, p, s;
U32 mpll_val=0;
int data;
mpll_val = (92<<12)|(1<<4)|(1);
ChangeMPllValue((mpll_val>>12)&0xff, (mpll_val>>4)&0x3f, mpll_val&3);
ChangeClockDivider(key, 12);
MMU_DisableICache();
MMU_DisableDCache();
val = rMPLLCON;
m = (val>>12)&0xff;
p = (val>>4)&0x3f;
s = val&3;
baud=115200;
pclk = PCLK;
rUFCON0 = 0x0;
rUMCON0 = 0x0;
rULCON0 = 0x3;
rUCON0 = 0x245; // Control register
rUBRDIV0=( (int)(pclk/16./baud+0.5) -1 ); //Baud rate divisior register 0
rGPBCON = 0x155555;
data = 0x06;
while(1)
{
rGPBDAT = (data<<5);
//dely(1200);
data =~data;
while(!(rUTRSTAT0 & 0x1));
c = RdURXH0();
while(!(rUTRSTAT0 & 0x2)); //Wait until THR is empty.
//ch=c+0x30;
WrUTXH0(c);
}
}
here i have done it Blinking LED in S3c2440 development board.. also declare serial received character display at 115200 baud rate..
The source code as:: (any doubt contact me)
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
//================================
void dely(U32 tt)
{
U32 i;
for(;tt>0;tt--)
{
for(i=0;i<10000;i++){}
}
}
int Main()
{
U8 key=14,ch,c;
U32 val;int pclk,baud;
U8 m, p, s;
U32 mpll_val=0;
int data;
mpll_val = (92<<12)|(1<<4)|(1);
ChangeMPllValue((mpll_val>>12)&0xff, (mpll_val>>4)&0x3f, mpll_val&3);
ChangeClockDivider(key, 12);
MMU_DisableICache();
MMU_DisableDCache();
val = rMPLLCON;
m = (val>>12)&0xff;
p = (val>>4)&0x3f;
s = val&3;
baud=115200;
pclk = PCLK;
rUFCON0 = 0x0;
rUMCON0 = 0x0;
rULCON0 = 0x3;
rUCON0 = 0x245; // Control register
rUBRDIV0=( (int)(pclk/16./baud+0.5) -1 ); //Baud rate divisior register 0
rGPBCON = 0x155555;
data = 0x06;
while(1)
{
rGPBDAT = (data<<5);
//dely(1200);
data =~data;
while(!(rUTRSTAT0 & 0x1));
c = RdURXH0();
while(!(rUTRSTAT0 & 0x2)); //Wait until THR is empty.
//ch=c+0x30;
WrUTXH0(c);
}
}
No comments:
Post a Comment