ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

kdbg.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:         ReactOS Kernel
00003  * LICENSE:         BSD - See COPYING.ARM in the top level directory
00004  * FILE:            drivers/base/kdcom/arm/kdbg.c
00005  * PURPOSE:         Serial Port Kernel Debugging Transport Library
00006  * PROGRAMMERS:     ReactOS Portable Systems Group
00007  */
00008 
00009 /* INCLUDES *******************************************************************/
00010 
00011 #define NOEXTAPI
00012 #include <ntifs.h>
00013 #define NDEBUG
00014 #include <halfuncs.h>
00015 #include <stdio.h>
00016 #include <debug.h>
00017 #include "arc/arc.h"
00018 #include "windbgkd.h"
00019 #include <kddll.h>
00020 #include <ioaccess.h>
00021 #include <arm/peripherals/pl011.h>
00022 
00023 /* GLOBALS ********************************************************************/
00024 
00025 typedef struct _KD_PORT_INFORMATION
00026 {
00027     ULONG ComPort;
00028     ULONG BaudRate;
00029     ULONG BaseAddress;
00030 } KD_PORT_INFORMATION, *PKD_PORT_INFORMATION;
00031 
00032 KD_PORT_INFORMATION DefaultPort = {0, 0, 0};
00033 
00034 //
00035 // We need to build this in the configuration root and use KeFindConfigurationEntry
00036 // to recover it later.
00037 //
00038 #define HACK 24000000
00039 
00040 /* REACTOS FUNCTIONS **********************************************************/
00041 
00042 BOOLEAN
00043 NTAPI
00044 KdPortInitializeEx(IN PKD_PORT_INFORMATION PortInformation,
00045                    IN ULONG Unknown1,
00046                    IN ULONG Unknown2)
00047 {
00048     ULONG Divider, Remainder, Fraction;
00049     ULONG Baudrate = PortInformation->BaudRate;
00050     
00051     //
00052     // Calculate baudrate clock divider and remainder
00053     //
00054     Divider   = HACK / (16 * Baudrate);
00055     Remainder = HACK % (16 * Baudrate);
00056     
00057     //
00058     // Calculate the fractional part
00059     //
00060     Fraction  = (8 * Remainder / Baudrate) >> 1;
00061     Fraction += (8 * Remainder / Baudrate) & 1;
00062     
00063     //
00064     // Disable interrupts
00065     //
00066     WRITE_REGISTER_ULONG(UART_PL011_CR, 0);
00067     
00068     //
00069     // Set the baud rate
00070     //
00071     WRITE_REGISTER_ULONG(UART_PL011_IBRD, Divider);
00072     WRITE_REGISTER_ULONG(UART_PL011_FBRD, Fraction);
00073     
00074     //
00075     // Set 8 bits for data, 1 stop bit, no parity, FIFO enabled
00076     //
00077     WRITE_REGISTER_ULONG(UART_PL011_LCRH,
00078                          UART_PL011_LCRH_WLEN_8 | UART_PL011_LCRH_FEN);
00079     
00080     //
00081     // Clear and enable FIFO
00082     //
00083     WRITE_REGISTER_ULONG(UART_PL011_CR,
00084                          UART_PL011_CR_UARTEN |
00085                          UART_PL011_CR_TXE |
00086                          UART_PL011_CR_RXE);
00087     
00088     //
00089     // Done
00090     //
00091     return TRUE;
00092 }
00093 
00094 BOOLEAN
00095 NTAPI
00096 KdPortInitialize(IN PKD_PORT_INFORMATION PortInformation,
00097                  IN ULONG Unknown1,
00098                  IN ULONG Unknown2)
00099 {
00100     //
00101     // Call the extended version
00102     //
00103     return KdPortInitializeEx(PortInformation, Unknown1, Unknown2);
00104 }
00105 
00106 BOOLEAN
00107 NTAPI
00108 KdPortGetByteEx(IN PKD_PORT_INFORMATION PortInformation,
00109                 OUT PUCHAR ByteReceived)
00110 {
00111     UNIMPLEMENTED;
00112     while (TRUE);
00113     return FALSE;
00114 }
00115 
00116 BOOLEAN
00117 NTAPI
00118 KdPortGetByte(OUT PUCHAR ByteReceived)
00119 {
00120     //
00121     // Call the extended version
00122     //
00123     return KdPortGetByteEx(&DefaultPort, ByteReceived); 
00124 }
00125 
00126 BOOLEAN
00127 NTAPI
00128 KdPortPollByteEx(IN PKD_PORT_INFORMATION PortInformation,
00129                  OUT PUCHAR ByteReceived)
00130 {
00131     UNIMPLEMENTED;
00132     while (TRUE);
00133     return TRUE;
00134 }
00135 
00136 BOOLEAN
00137 NTAPI
00138 KdPortPollByte(OUT PUCHAR ByteReceived)
00139 {
00140     //
00141     // Call the extended version
00142     //
00143     return KdPortPollByteEx(&DefaultPort, ByteReceived);
00144 }
00145 
00146 VOID
00147 NTAPI
00148 KdPortPutByteEx(IN PKD_PORT_INFORMATION PortInformation,
00149                 IN UCHAR ByteToSend)
00150 {
00151     //
00152     // Wait for ready
00153     //
00154     while ((READ_REGISTER_ULONG(UART_PL01x_FR) & UART_PL01x_FR_TXFF) != 0);
00155     
00156     //
00157     // Send the character
00158     //
00159     WRITE_REGISTER_ULONG(UART_PL01x_DR, ByteToSend);
00160 }
00161 
00162 VOID
00163 NTAPI
00164 KdPortPutByte(IN UCHAR ByteToSend)
00165 {
00166     //
00167     // Call the extended version
00168     //
00169     KdPortPutByteEx(&DefaultPort, ByteToSend);
00170 }
00171 
00172 VOID
00173 NTAPI
00174 KdPortRestore(VOID)
00175 {
00176     UNIMPLEMENTED;
00177     while (TRUE);
00178 }
00179 
00180 VOID
00181 NTAPI
00182 KdPortSave(VOID)
00183 {
00184     UNIMPLEMENTED;
00185     while (TRUE);
00186 }
00187 
00188 BOOLEAN
00189 NTAPI
00190 KdPortDisableInterrupts(VOID)
00191 {
00192     UNIMPLEMENTED;
00193     while (TRUE);
00194     return TRUE;
00195 }
00196 
00197 BOOLEAN
00198 NTAPI
00199 KdPortEnableInterrupts(VOID)
00200 {
00201     UNIMPLEMENTED;
00202     while (TRUE);
00203     return TRUE;
00204 }
00205 
00206 /* WINDOWS FUNCTIONS **********************************************************/
00207 
00208 NTSTATUS
00209 NTAPI
00210 KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
00211 {
00212     UNIMPLEMENTED;
00213     return STATUS_NOT_IMPLEMENTED;
00214 }
00215 
00216 NTSTATUS
00217 NTAPI
00218 KdDebuggerInitialize1(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
00219 {
00220     UNIMPLEMENTED;
00221     return STATUS_NOT_IMPLEMENTED;
00222 }
00223 
00224 NTSTATUS
00225 NTAPI
00226 KdSave(IN BOOLEAN SleepTransition)
00227 {
00228     UNIMPLEMENTED;
00229     while (TRUE);
00230     return STATUS_SUCCESS;
00231 }
00232 
00233 NTSTATUS
00234 NTAPI
00235 KdRestore(IN BOOLEAN SleepTransition)
00236 {
00237     UNIMPLEMENTED;
00238     while (TRUE);
00239     return STATUS_SUCCESS;
00240 }
00241 
00242 VOID
00243 NTAPI
00244 KdSendPacket(IN ULONG PacketType,
00245              IN PSTRING MessageHeader,
00246              IN PSTRING MessageData,
00247              IN OUT PKD_CONTEXT Context)
00248 {
00249     UNIMPLEMENTED;
00250     while (TRUE);
00251     return;
00252 }
00253 
00254 KDSTATUS
00255 NTAPI
00256 KdReceivePacket(IN ULONG PacketType,
00257                 OUT PSTRING MessageHeader,
00258                 OUT PSTRING MessageData,
00259                 OUT PULONG DataLength,
00260                 IN OUT PKD_CONTEXT Context)
00261 {
00262     UNIMPLEMENTED;
00263     while (TRUE);
00264     return 0;
00265 }
00266 
00267 /* EOF */

Generated on Sun May 27 2012 04:27:12 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.