📄 async1.inc
字号:
// openbios/arch/pallas/redwood5/async1.inc, redbios, redbios_iii_1.0 6/14/99 14:34:40//------------------------------------------------------------------------------+//// This source code has been made available to you by IBM on an AS-IS// basis. Anyone receiving this source is licensed under IBM// copyrights to use it in any way he or she deems fit, including// copying it, modifying it, compiling it, and redistributing it either// with or without modifications. No license under IBM patents or// patent applications is to be implied by the copyright license.//// Any user of this software should understand that IBM cannot provide// technical support for this software and will not be responsible for// any consequences resulting from the use of this software.//// Any person who transfers this source code or any derivative work// must include the IBM copyright notice, this paragraph, and the// preceding two paragraphs in the transferred software.//// COPYRIGHT I B M CORPORATION 1995// LICENSED MATERIAL - PROGRAM PROPERTY OF I B M//-------------------------------------------------------------------------------//-------------------------------------------------------------------------------//// File Name: async1.s//// Function: Base COM1 functions to be called out of ROS - require no// R/W storage, platform specific//// Author: Alan Booker//// Change Activity-//// Date Description of Change BY// --------- --------------------- ---// 2Sept93 Created ajb// 2Feb96 Removed setting of high address bit kdw// 28Mar96 updated for 602/603 cogent and use of s1ldLib for download kdw// 10-Jul-96 Port to zapatos JWB// 07-Aug-96 Port to mesquite JWB// 14-Nov-96 Update for 16553. Set AFR to 0x06 for MF pin & divide by 13 JWB// 09-Feb-98 Port to Redwood pag// 02-Apr-99 Updated Baud divisor for RITB of romeo pag// 14-Jun-99 Moved s1setbaud to async.c added s1setbauddiv pag// 09-Jan-02 Splitted platform dependent part YYD////-------------------------------------------------------------------------------#include "s1Lib.inc"//-----------------------------------------------------------------------------// Function: async_init// Description: Initalize COM1 and COM2 ports//----------------------------------------------------------------------------- .text .align 2 .globl asyncs1_initasyncs1_init: addis r7,r0,COM1UPPER // set offset for COM1 ori r7,r7,COM1LOWER addi r3,r0,0x80 // set DLAB bit stb r3,LINE_CONTROL(r7)// Note - the divisor value is close enough to work and will be adjusted in the// main routine in "C" code addi r3,r0,0x88 // set divisors for 9600 baud stb r3,DL_LSB(r7) addi r3,r0,0x00 stb r3,DL_MSB(r7) addi r3,r0,0x06 // set MF pin to OUT2 via AFR bits stb r3,ALT_FUNCTION(r7) // 1 & 2; enable divide by 13 addi r3,r0,0x03 // line control 8 bits no parity stb r3,LINE_CONTROL(r7) addi r3,r0,0x00 // disable FIFO stb r3,FIFO_CONTROL(r7) addi r3,r0,0x03 // modem control DTR RTS stb r3,MODEM_CONTROL(r7) lbz r4,LINE_STATUS(r7) // clear line status lbz r4,DATA_REG(r7) // read receive buffer addi r3,r0,0x00 // set scratchpad stb r3,SCRATCH(r7) addi r3,r0,0x00 // set interrupt enable reg stb r3,INT_ENABLE(r7)//// Removed setup of port 2 (doesn*t exist in redwood)// blr .type asyncs1_init,@function .size asyncs1_init,.-asyncs1_init//-----------------------------------------------------------------------------// Function: s1setbauddiv// Description: Set baud rate divisor for COM1 port//----------------------------------------------------------------------------- .text .align 2 .globl s1setbauddivs1setbauddiv: addis r7,r0,COM1UPPER // set offset for COM1 ori r7,r7,COM1LOWER addi r5,r0,0x80 // set DLAB bit stb r5,LINE_CONTROL(r7) stb r3,DL_LSB(r7) srwi r3,r3,8 stb r3,DL_MSB(r7) addi r5,r0,0x03 // line control 8 bits no parity stb r5,LINE_CONTROL(r7) blr .type s1setbauddiv,@function .size s1setbauddiv,.-s1setbauddiv//-----------------------------------------------------------------------------// Function: s1putchar// Description: Put a character out on COM1//----------------------------------------------------------------------------- .text .align 2 .globl s1putchars1putchar: mfmsr r8 addi r9,0,0x7FFF // Mask external interrupts oris r9,r9,0xFFFF and r9,r9,r8 mtmsr r9 addis r7,r0,COM1UPPER // set offset for COM1 ori r7,r7,COM1LOWER stb r3,DATA_REG(r7) // put character out eieiospnlp: lbz r4,LINE_STATUS(r7) eieio andi. r4,r4,0x20 // check for THRE bit beq spnlp mtmsr r8 // restore interrupts blr .type s1putchar,@function .size s1putchar,.-s1putchar
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -