Merge pull request #159 from SamTebbs33/feature/serial-init-payload
Pass boot payload to serial init
This commit is contained in:
		
						commit
						c4083b0161
					
				
					 4 changed files with 11 additions and 5 deletions
				
			
		|  | @ -267,10 +267,13 @@ fn writeSerialCom1(byte: u8) void { | |||
| /// | ||||
| /// Initialise serial communication using port COM1 and construct a Serial instance | ||||
| /// | ||||
| /// Arguments: | ||||
| ///     IN boot_payload: arch.BootPayload - The payload passed at boot. Not currently used by x86 | ||||
| /// | ||||
| /// Return: serial.Serial | ||||
| ///     The Serial instance constructed with the function used to write bytes | ||||
| /// | ||||
| pub fn initSerial() Serial { | ||||
| pub fn initSerial(boot_payload: BootPayload) Serial { | ||||
|     serial.init(serial.DEFAULT_BAUDRATE, serial.Port.COM1) catch |e| { | ||||
|         panic(@errorReturnTrace(), "Failed to initialise serial: {}", .{e}); | ||||
|     }; | ||||
|  |  | |||
|  | @ -37,7 +37,7 @@ pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn | |||
| } | ||||
| 
 | ||||
| export fn kmain(boot_payload: arch.BootPayload) void { | ||||
|     const serial_stream = serial.init(); | ||||
|     const serial_stream = serial.init(boot_payload); | ||||
| 
 | ||||
|     log.init(serial_stream); | ||||
| 
 | ||||
|  |  | |||
|  | @ -23,11 +23,14 @@ pub const Serial = struct { | |||
| /// | ||||
| /// Initialise the serial interface. The details of how this is done depends on the architecture. | ||||
| /// | ||||
| /// Arguments: | ||||
| ///     IN boot_payload: arch.BootPayload - The payload passed to the kernel at boot. How this is used depends on the architecture | ||||
| /// | ||||
| /// Return: Serial | ||||
| ///     The serial interface constructed by the architecture | ||||
| /// | ||||
| pub fn init() Serial { | ||||
|     const serial = arch.initSerial(); | ||||
| pub fn init(boot_payload: arch.BootPayload) Serial { | ||||
|     const serial = arch.initSerial(boot_payload); | ||||
|     if (build_options.rt_test) runtimeTests(serial); | ||||
|     return serial; | ||||
| } | ||||
|  |  | |||
|  | @ -102,7 +102,7 @@ pub fn haltNoInterrupts() noreturn { | |||
|     while (true) {} | ||||
| } | ||||
| 
 | ||||
| pub fn initSerial() Serial { | ||||
| pub fn initSerial(boot_payload: BootPayload) Serial { | ||||
|     return .{ .write = undefined }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sam Tebbs
						Sam Tebbs