2011-8-7 17:52:56
来源:互联网 发布:淘宝女装店名起名大全 编辑:程序博客网 时间:2024/05/01 21:49
2011-8-7 17:52:56
typedef enum {
fromFlash = 0,
fromDownload = 1
} block_source_t;
typedef struct {
int kernelSize;
block_source_t kernelType;
u32 kernel_md5_digest[4];
int paramSize;
block_source_t paramType;
u32 param_md5_digest[4];
int ramdiskSize;
block_source_t ramdiskType;
u32 ramdisk_md5_digest[4];
int blobSize;
block_source_t blobType;
u32 blob_md5_digest[4];
serial_baud_t downloadSpeed;
serial_baud_t terminalSpeed;
int load_ramdisk;
int boot_delay; /* -1 == no-autoboot */
char cmdline[COMMAND_LINE_SIZE];
} blob_status_t;
extern blob_status_t blob_status;
blob_status.paramType = fromFlash;
blob_status.kernelType = fromFlash;
blob_status.ramdiskType = fromFlash;
blob_status.downloadSpeed = baud_38400;
blob_status.terminalSpeed = TERMINAL_SPEED;
blob_status.load_ramdisk = LOAD_RAMDISK;
blob_status.cmdline[0] = '\0';
初试化了一些状态
/* export serial driver */
serial_driver_t mhn_serial_driver = {
init: mhn_serial_init,
read: mhn_serial_read,
write: mhn_serial_write,
poll: mhn_serial_poll,
flush_input: mhn_serial_flush_input,
flush_output: mhn_serial_flush_output
};
也需要串口
int UartSetGPIO()
static int mhn_serial_read(void)
{
int rv;
for(;;) {
rv = mhn_serial_poll();
if(rv < 0)
return rv;
if(rv > 0)
return SerialDATA & 0xff;
}
}
设置串口的读写
int mhn_serial_write(int c)
{
/* wait for room in the transmit FIFO */
while((SerialLSR & LSR_TDRQ) == 0) {
}
SerialDATA = c & 0xff;
return 0;
}
static int mhn_serial_flush_input(void)
{
volatile u32 tmp;
/* keep on reading as long as the receiver is not empty */
while(SerialLSR & LSR_DR) {
if(SerialLSR & (LSR_FE | LSR_PE | LSR_OE))
return -ESERIAL;
tmp = SerialDATA;
}
return 0;
}
/* flush output queue. returns 0 on success or negative error number
* otherwise. This only waits for space in the tx fifo, NOT until the fifo
* has completely emptied.
*/
static int mhn_serial_flush_output(void)
{
/* wait until the transmitter is no longer busy */
while(SerialLSR & ~LSR_TDRQ) ;
return 0;
}
刷新串口输入队列和输出队列
- 2011-8-7 17:52:56
- 6/26/2011 8:52:56 PM
- 2011-8-8 17:41:52
- 2011-8-7 13:52:49
- 2011-8-7 17:27:44
- 2011-9-17 21:20:56
- 2011-10-15 17:58:56
- 2011-8-5 8:56:49
- 2011-9-17 12:21:52
- 2011-8-17总结
- 2011-8-8 20:52:01
- 8/27/2011 3:41:56 AM
- 2011-7-10 14:56:05
- 2011-7-14 14:56:00
- 2011-7-30 13:56:27
- 2011-7-31 10:32:56
- 2011-7-30 19:39:52
- 2011-7-17 blue screen
- JSTL-Core标签库
- 《ASP.NET本质论》 ASP.NET 中线程池设置
- 2011-8-7 14:25:51
- 2011-8-7 17:27:44
- 访问图像元素(imagedata widthstep)
- 2011-8-7 17:52:56
- 2011-8-7 18:06:30
- 关闭整个FRAMESET窗口的问题
- android设置Activity背景色为透明的2种方法
- hdu 1166 树状数组 线段树
- Begin from C++
- NSOperationQueue的简单应用
- 如何查看本电脑ASP.NET的版本?
- ACMSTEP 1.2.3 QuickSum //超级水题 模拟