Skip to content

Commit 9b63ad2

Browse files
Improved souce ig?
1 parent 94274c7 commit 9b63ad2

File tree

4 files changed

+77
-8
lines changed

4 files changed

+77
-8
lines changed

source/includes/drivers/rtl8139.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
* @copyright Copyright (c) Pradosh 2023
99
*
1010
*/
11-
#pragma once
11+
#ifndef rtl8139_h
12+
#define rtl8139_h
13+
1214
#include <stdint.h>
1315
#include <stdbool.h>
1416
#include <basics.h>
@@ -44,6 +46,10 @@ struct rtl8139 {
4446
int8 mac_address[6];
4547
};
4648

49+
/**
50+
* @brief Global pointer for the RTL card.
51+
*
52+
*/
4753
extern struct rtl8139* RTL8139;
4854

4955
/**
@@ -78,4 +84,6 @@ bool rtl8139_send_packet(const int8* data, int16 length);
7884
* @return [true] Return yes if a packet was received
7985
* @return [false] Return false if a packet was not received
8086
*/
81-
bool rtl8139_receive_packet(int8* buffer, int16* length);
87+
bool rtl8139_receive_packet(int8* buffer, int16* length);
88+
89+
#endif

source/includes/heap.h

+55
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,69 @@ typedef struct {
2121

2222
#define MAX_PAGE_ALIGNED_ALLOCS 32
2323

24+
/**
25+
* @brief Function to initlialize heap.
26+
*
27+
* @param kernel_end The position in memory where kernel ends.
28+
*/
2429
extern void mm_init(uint32_t kernel_end);
30+
31+
/**
32+
* @brief Function to extend available heap.
33+
*
34+
* @param additional_size Additional size to be added.
35+
*/
2536
extern void mm_extend(uint32_t additional_size);
2637

38+
/**
39+
* @brief Function to constrict available heap.
40+
*
41+
* @param removal_size Amount of size needed to be reduced.
42+
*/
43+
extern void mm_constrict(uint32_t removal_size);
44+
45+
/**
46+
* @brief Prints out heap information.
47+
*
48+
*/
2749
extern void mm_print_out();
2850

51+
/**
52+
* @brief Page based memory allocate.
53+
*
54+
* @param size Amount of size needed to be allocated.
55+
* @return char* Location in memory.
56+
*/
2957
extern char* pmalloc(size_t size);
58+
59+
/**
60+
* @brief Function to free a page.
61+
*
62+
* @param mem Location in memory.
63+
*/
64+
extern void pfree(void *mem);
65+
66+
/**
67+
* @brief The main memory alloc function.
68+
*
69+
* @param size Amount of size needed to be allocated.
70+
* @return char* Location in memory.
71+
*/
3072
extern char* malloc(size_t size);
73+
74+
/**
75+
* @brief The main memory realloc function.
76+
*
77+
* @param size Amount of size needed to be extened.
78+
* @return char* Location in memory.
79+
*/
3180
extern char* realloc(void *ptr, size_t size);
81+
82+
/**
83+
* @brief The main free function for memory allocation.
84+
*
85+
* @param mem Location in memory.
86+
*/
3287
extern void free(void *mem);
3388

3489
#endif

source/includes/image/targa.h

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#include <basics.h>
1212
#include <opengl/glbackend.h>
1313

14+
/**
15+
* @brief Targa header.
16+
*
17+
*/
1418
typedef struct {
1519
int8 idLength;
1620
int8 colorMapType;

source/kernel/C/kernel.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,14 @@ void main(void) {
321321

322322
info("Welcome to FrostWing Operating System!", "(https://github.com/Frost-Wing)");
323323

324+
// glCreateContext();
325+
// glCreateContextCustom(framebuffer->address, framebuffer->width, framebuffer->height);
326+
// glClearColor(0, 0, 0, 0xff);
327+
// glClear(GL_COLOR_BUFFER_BIT);
328+
// display_png(module_request.response->modules[1]->address, module_request.response->modules[1]->size);
329+
// glDrawTriangle((uvec2){10, 10}, (uvec2){100, 100}, (uvec2){100, 10}, 0xffdadbad, false);
330+
// glDestroyContext(null);
331+
324332
// glDestroyContext(null);
325333

326334
// Below code is for triggering Page Fault
@@ -376,12 +384,6 @@ void main(void) {
376384
// int status_code = execute_binary();
377385
// printf("return code: 0x%x", status_code);
378386

379-
// glCreateContext();
380-
// glCreateContextCustom(front_buffer, framebuffer->width, framebuffer->height);
381-
// glClearColor(0, 0, 0, 0xff);
382-
// glClear(GL_COLOR_BUFFER_BIT);
383-
// glDrawTriangle((uvec2){10, 10}, (uvec2){100, 100}, (uvec2){100, 10}, 0xffdadbad, false);
384-
// glDestroyContext(null);
385387

386388
extern char* login_request();
387389

0 commit comments

Comments
 (0)