Skip to content

Commit d99884e

Browse files
authored
Merge pull request #354 from ChinYikMing/refine-io-comments
Refine I/O comments
2 parents bf07467 + 79a4001 commit d99884e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/io.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@
88
#include <stdint.h>
99
#include <string.h>
1010

11-
/* Directly map a memory with a size of 2^32 bytes. All memory read/write
12-
* operations can access this memory through the memory subsystem.
13-
*/
14-
1511
typedef struct {
1612
uint8_t *mem_base;
1713
uint64_t mem_size;
1814
} memory_t;
1915

16+
/* create a memory instance */
2017
memory_t *memory_new(uint32_t size);
18+
19+
/* delete a memory instance */
2120
void memory_delete(memory_t *m);
2221

2322
/* read an instruction from memory */
@@ -35,6 +34,7 @@ uint8_t memory_read_b(uint32_t addr);
3534
/* read a length of data from memory */
3635
void memory_read(const memory_t *m, uint8_t *dst, uint32_t addr, uint32_t size);
3736

37+
/* write a length of data to memory */
3838
static inline void memory_write(memory_t *m,
3939
uint32_t addr,
4040
const uint8_t *src,
@@ -43,12 +43,16 @@ static inline void memory_write(memory_t *m,
4343
memcpy(m->mem_base + addr, src, size);
4444
}
4545

46+
/* write a word to memory */
4647
void memory_write_w(uint32_t addr, const uint8_t *src);
4748

49+
/* write a short to memory */
4850
void memory_write_s(uint32_t addr, const uint8_t *src);
4951

52+
/* write a byte to memory */
5053
void memory_write_b(uint32_t addr, const uint8_t *src);
5154

55+
/* write a length of certain value to memory */
5256
static inline void memory_fill(memory_t *m,
5357
uint32_t addr,
5458
uint32_t size,

0 commit comments

Comments
 (0)