interface for determining kernel version on app level added
This commit is contained in:
		@@ -37,6 +37,15 @@ struct thread_context {
 | 
			
		||||
	struct queue_node sem_queue_node;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct kernel_version {
 | 
			
		||||
	unsigned int kernel_version;
 | 
			
		||||
	unsigned int major_version;
 | 
			
		||||
	unsigned int minor_version;
 | 
			
		||||
	unsigned int build_number;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int get_kernel_version(struct kernel_version *version);
 | 
			
		||||
 | 
			
		||||
struct thread_context *thread_create(
 | 
			
		||||
		struct thread_context *thread,
 | 
			
		||||
		stack_t *stack,
 | 
			
		||||
@@ -45,6 +54,7 @@ struct thread_context *thread_create(
 | 
			
		||||
		void *arg,
 | 
			
		||||
		enum thread_priority priority);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void thread_exit(void);
 | 
			
		||||
void sleep_ms(unsigned int ms);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								source/firmware/kernel/version.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								source/firmware/kernel/version.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
/*
 | 
			
		||||
 * version.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Created on: Aug 12, 2016
 | 
			
		||||
 *      Author: tkl
 | 
			
		||||
 */
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
#include "queue.h"
 | 
			
		||||
#include "stack.h"
 | 
			
		||||
#include "version.h"
 | 
			
		||||
#include "kernel.h"
 | 
			
		||||
 | 
			
		||||
int get_kernel_version(struct kernel_version *version)
 | 
			
		||||
{
 | 
			
		||||
	if(NULL == version)
 | 
			
		||||
		return -1;
 | 
			
		||||
	if(strcmp(KERNEL_VERSION, "unknown"))
 | 
			
		||||
		return -1;
 | 
			
		||||
	if(strcmp(MAJOR_VERSION, "unknown"))
 | 
			
		||||
		return -1;
 | 
			
		||||
	if(strcmp(MINOR_VERSION, "unknown"))
 | 
			
		||||
		return -1;
 | 
			
		||||
	if(strcmp(BUILD_NUMBER, "unknown"))
 | 
			
		||||
		return -1;
 | 
			
		||||
	version->kernel_version = (unsigned int)atoi(KERNEL_VERSION);
 | 
			
		||||
	version->major_version = (unsigned int)atoi(MAJOR_VERSION);
 | 
			
		||||
	version->minor_version = (unsigned int)atoi(MINOR_VERSION);
 | 
			
		||||
	version->build_number = (unsigned int)atoi(BUILD_NUMBER);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user