Added mock SBI_EXTENSION_TIMER
This commit is contained in:
		@@ -16,6 +16,19 @@ void sbi_call(rv32_cpu_t* cpu, uint32_t extension_id, uint32_t func_id)
 | 
				
			|||||||
					cpu->regs.a0 = 0;
 | 
										cpu->regs.a0 = 0;
 | 
				
			||||||
					cpu->regs.a1 = 0x2000000;
 | 
										cpu->regs.a1 = 0x2000000;
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
 | 
									case SBI_FUNCTION_GET_IMPL_ID:
 | 
				
			||||||
 | 
										cpu->regs.a0 = 0;
 | 
				
			||||||
 | 
										cpu->regs.a1 = 0;
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case SBI_FUNCTION_GET_IMPL_VERSION:
 | 
				
			||||||
 | 
										cpu->regs.a0 = 0;
 | 
				
			||||||
 | 
										cpu->regs.a1 = 0;
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									case SBI_FUNCTION_PROBE_EXTENSION:
 | 
				
			||||||
 | 
										// For now, we say that everything is available
 | 
				
			||||||
 | 
										cpu->regs.a0 = 0;
 | 
				
			||||||
 | 
										cpu->regs.a1 = 1;
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
				case SBI_FUNCTION_GET_MVENDOR_ID:
 | 
									case SBI_FUNCTION_GET_MVENDOR_ID:
 | 
				
			||||||
					cpu->regs.a0 = 0;
 | 
										cpu->regs.a0 = 0;
 | 
				
			||||||
					cpu->regs.a1 = 0;
 | 
										cpu->regs.a1 = 0;
 | 
				
			||||||
@@ -34,6 +47,19 @@ void sbi_call(rv32_cpu_t* cpu, uint32_t extension_id, uint32_t func_id)
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							case SBI_EXTENSION_TIMER:
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								switch(func_id)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									case SBI_FUNCTION_SET_TIMER:
 | 
				
			||||||
 | 
										cpu->regs.a0 = 0;
 | 
				
			||||||
 | 
										cpu->regs.a1 = 0;
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									default:
 | 
				
			||||||
 | 
										fprintf(stderr, "sbi_call: unknown function id 0x%x for timer extension\n", func_id);
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		case SBI_EXTENSION_SET_TIMER:
 | 
							case SBI_EXTENSION_SET_TIMER:
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			// TODO : Correctly implement that
 | 
								// TODO : Correctly implement that
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,11 @@
 | 
				
			|||||||
#define SBI_FUNCTION_GET_MARCH_ID 0x5
 | 
					#define SBI_FUNCTION_GET_MARCH_ID 0x5
 | 
				
			||||||
#define SBI_FUNCTION_GET_MIMPL_ID 0x6
 | 
					#define SBI_FUNCTION_GET_MIMPL_ID 0x6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* SBI Timer extension */
 | 
				
			||||||
 | 
					#define SBI_EXTENSION_TIMER 0x54494d45
 | 
				
			||||||
 | 
					#define SBI_FUNCTION_SET_TIMER 0x0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* SBI legacy */
 | 
				
			||||||
#define SBI_EXTENSION_SET_TIMER 0x0
 | 
					#define SBI_EXTENSION_SET_TIMER 0x0
 | 
				
			||||||
#define SBI_EXTENSION_LEGACY_CONSOLE_PUTCHAR 0x1
 | 
					#define SBI_EXTENSION_LEGACY_CONSOLE_PUTCHAR 0x1
 | 
				
			||||||
#define SBI_EXTENSION_LEGACY_SHUTDOWN 0x8
 | 
					#define SBI_EXTENSION_LEGACY_SHUTDOWN 0x8
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user