Skip to content

Commit

Permalink
<POSIX> Build Success: posix_time.c, posix_semaphore.c, posix_utils.c…
Browse files Browse the repository at this point in the history
…, posix_mqueue.c
  • Loading branch information
pranjalchanda08 authored and akashkollipara committed Jan 13, 2022
1 parent 22d6870 commit 6299685
Show file tree
Hide file tree
Showing 21 changed files with 242 additions and 158 deletions.
1 change: 1 addition & 0 deletions src/lib/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LIB_DIR := $(GET_PATH)
# Mandatory libraries
include $(LIB_DIR)/libresource/build.mk
include $(LIB_DIR)/libc/build.mk
include $(LIB_DIR)/posix/build.mk
#==================================================

include $(LIB_DIR)/libnmath/build.mk
22 changes: 22 additions & 0 deletions src/lib/posix/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2019, Cyancore Team
#
# File Name : build.mk
# Descrption : This script accumulates sources and builds
# library
# Primary Author : Pranjal Chanda [[email protected]]
# Organisation : Cyancore Core-Team
#

POSIX_PATH := $(GET_PATH)
LIB_OBJS :=

LIB := libposix.a
LIB_INCLUDE += $(POSIX_PATH)/include/
DEP_LIBS_ARG += -lposix

include $(POSIX_PATH)/src/build.mk

DIR := $(POSIX_PATH)
include mk/lib.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
*
* File Name : cc_posix_config.h
* Description : POSIX user config
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#pragma once

#ifndef posixconfigTICK_RATE_HZ
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#ifndef _CC_POSIX_INTERNAL_H_
#define _CC_POSIX_INTERNAL_H_
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
*
* File Name : cc_posix_internal.h
* Description : Internal typedefs
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#pragma once

#include <stdint.h>
#include <cc_posix_config.h>
Expand Down Expand Up @@ -100,5 +109,3 @@
StaticEventGroup_t xBarrierEventGroup; /**< Kernel event group that blocks to wait on threads entering barrier. */
} pthread_barrier_internal_t;
#endif /* if posixconfigENABLE_PTHREAD_BARRIER_T == 1 */

#endif /* _CC_POSIX_INTERNAL_H_ */
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
*
* File Name : cc_posix_types.h
* Description : POSIX typedefs
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#pragma once

#ifndef _CC_POSIX_INTERNAL_TYPES_H_
#define _CC_POSIX_INTERNAL_TYPES_H_

#include <posix/cc_posix_internal.h>
#include <cc_posix_internal.h>

/*
* sys/types.h defines a POSIX type when posixconfigENABLE_PTHREAD_<TYPE>_T
Expand Down Expand Up @@ -61,5 +68,3 @@
typedef size_t TickType_t;
#endif
#define posixconfigMAX_DELAY (TickType_t)(~0)

#endif /* _CC_POSIX_INTERNAL_TYPES_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* Organisation : Cyancore Core-Team
*/

#ifndef _CC_POSIX_ERRNO_H_
#pragma once

#define _CC_POSIX_ERRNO_H_

#include <status.h>
Expand Down Expand Up @@ -67,5 +68,3 @@
#if ( configUSE_POSIX_ERRNO == 1 )
#endif
/**@} */

#endif /* ifndef _CC_POSIX_ERRNO_H_ */
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
/**
* @file fcntl.h
* @brief File control options.
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
*
* File Name : fcntl.h
* Description : File control options.
* : http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html
*
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#ifndef _CC_POSIX_FCNTL_H_
#pragma once

#define _CC_POSIX_FCNTL_H_

/**
Expand Down Expand Up @@ -50,5 +56,3 @@
#define O_SEARCH 0x4000 /**< Open directory for search only. */
#define O_WRONLY 0x8000 /**< Open for writing only. */
/**@} */

#endif /* ifndef _CC_POSIX_FCNTL_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@
* File Name : mqueue.h
* Description : This file consists of posix message queue related declarations
* : http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html
*
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#ifndef _CC_POSIX_MQUEUE_H_
#pragma once

#define _CC_POSIX_MQUEUE_H_

/* CC+POSIX includes. */
#include <posix/include/time.h>
#include <posix/include/sys/types.h>
#include <posix/time.h>
#include <posix/sys/types.h>

/**
* @brief Message queue attributes.
Expand Down Expand Up @@ -235,5 +237,3 @@ int mq_timedsend( mqd_t mqdes,
* ENOENT - The named message queue does not exist.
*/
int mq_unlink( const char * name );

#endif /* ifndef _CC_POSIX_MQUEUE_H_ */
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
/**
* @file pthread.h
* @brief Threads.
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
*
* File Name : pthread.h
* Description : Threads.
* : http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html
*
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#ifndef _CC_POSIX_PTHREAD_H_
#pragma once

#define _CC_POSIX_PTHREAD_H_

/* CC+POSIX includes. POSIX states that this header shall make symbols
* defined in sched.h and time.h visible. */
#include "posix/include/sched.h"
#include "posix/include/time.h"
#include "posix/sched.h"
#include "posix/time.h"

/**
* @name pthread detach state.
Expand Down Expand Up @@ -472,5 +478,3 @@ pthread_t pthread_self( void );
int pthread_setschedparam( pthread_t thread,
int policy,
const struct sched_param * param );

#endif /* _CC_POSIX_PTHREAD_H_ */
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
/**
* @file sched.h
* @brief Execution scheduling.
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
*
* File Name : sched.h
* Description : Execution scheduling.
* : http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sched.h.html
*
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sched.h.html
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#ifndef _CC_POSIX_SCHED_H_
#pragma once

#define _CC_POSIX_SCHED_H_

/**
Expand Down Expand Up @@ -55,5 +61,3 @@ int sched_get_priority_min( int policy );
* @retval 0 - Upon successful completion
*/
int sched_yield( void );

#endif /* ifndef _CC_POSIX_SCHED_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@
* File Name : semaphore.h
* Description : This file consists of posix semaphore related declarations
* : http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/semaphore.h.html
*
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#ifndef _CC_POSIX_SEMAPHORE_H_
#pragma once

#define _CC_POSIX_SEMAPHORE_H_

/* CC+POSIX includes. */
#include <posix/include/time.h>
#include <posix/cc_posix_types.h>
#include <posix/time.h>
#include <cc_posix_types.h>

/**
* @brief Semaphore type.
Expand Down Expand Up @@ -118,5 +120,3 @@ int sem_trywait( sem_t * sem );
* @note Deadlock detection is not implemented.
*/
int sem_wait( sem_t * sem );

#endif /* ifndef _CC_POSIX_SEMAPHORE_H_ */
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
/**
* @file signal.h
* @brief Signals.
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
*
* Signals are currently not implemented in CC+POSIX. This header only
* defines the signal data structures used elsewhere.
* File Name : signal.h
* Description : Signals (Signals are currently not implemented in CC+POSIX)
* : http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html
*
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#pragma once

#ifndef _CC_POSIX_SIGNAL_H_
#define _CC_POSIX_SIGNAL_H_

/**
Expand Down Expand Up @@ -41,5 +43,3 @@ struct sigevent
void ( * sigev_notify_function )( union sigval ); /**< Notification function. */
pthread_attr_t * sigev_notify_attributes; /**< Notification attributes. */
};

#endif /* ifndef _CC_POSIX_SIGNAL_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
* Copyrights (C) 2019, Cyancore Team
*
* File Name : sys/types.h
* Description : Data types. https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
* Description : Data types.
* : https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
*
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#ifndef _CC_POSIX_TYPES_H_
#pragma once

#define _CC_POSIX_TYPES_H_

/* C standard library includes. */
#include <stdint.h>

/* Kernel types include */
#include <posix/cc_posix_types.h>
#include <cc_posix_types.h>

/**
* @brief Used for system times in clock ticks or CLOCKS_PER_SEC.
Expand Down Expand Up @@ -165,5 +168,3 @@ typedef void * pthread_barrierattr_t;
#if !defined( posixconfigENABLE_OFF_T ) || ( posixconfigENABLE_OFF_T == 1 )
typedef long int off_t;
#endif

#endif /* ifndef _CC_POSIX_TYPES_H_ */
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
/**
* @file time.h
* @brief Time types.
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
*
* File Name : time.h
* Description : Time types
* : http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html
*
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#ifndef _CC_POSIX_TIME_H_
#pragma once

#define _CC_POSIX_TIME_H_

/* CC+POSIX includes. */
#include <posix/include/sys/types.h>
#include <posix/include/signal.h>
#include <posix/sys/types.h>
#include <posix/signal.h>

/**
* @name Unit conversion constants.
Expand Down Expand Up @@ -229,5 +235,3 @@ int timer_settime( timer_t timerid,
int flags,
const itimerspec_t * value,
itimerspec_t * ovalue );

#endif /* ifndef _CC_POSIX_TIME_H_ */
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
/**
* @file unistd.h
* @brief Standard symbolic constants and types
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
*
* File Name : unistd.h
* Description : Standard symbolic constants and types
* : http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html
*
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html
* Primary Author : Pranjal Chanda [[email protected]]
* Organisation : Cyancore Core-Team
*/

#ifndef _CC_POSIX_UNISTD_H_
#define _CC_POSIX_UNISTD_H_
#pragma once

#include "posix/include/sys/types.h"
#include "posix/sys/types.h"

#define _CC_POSIX_UNISTD_H_

/**
* @brief Suspend execution for an interval of time.
Expand All @@ -32,5 +38,3 @@ unsigned sleep( unsigned seconds );
* @retval 0 - Upon successful completion.
*/
int usleep( useconds_t usec );

#endif /* ifndef _CC_POSIX_UNISTD_H_ */
Loading

0 comments on commit 6299685

Please sign in to comment.