Skip to content

Commit

Permalink
Merge pull request #309 from VisorFolks/development
Browse files Browse the repository at this point in the history
Bumping changes into stable
  • Loading branch information
akashkollipara authored Jul 14, 2024
2 parents b582681 + b1be0eb commit c1f64e7
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 27 deletions.
20 changes: 2 additions & 18 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
# Cyancore root
* @visorfolks/cc-arch-board

# Akash Kollipara owns
/mk/ @akashkollipara
/src/arch/avr/ @akashkollipara
/src/arch/riscv/ @akashkollipara
/src/platform/mega_avr/ @akashkollipara
/src/platform/sifive/ @akashkollipara
/src/driver/ @akashkollipara
/src/lib/ @akashkollipara
/src/inlcude/ @akashkollipara
/src/visor/ @akashkollipara

# Mayuri Lokhande owns
/src/arch/arm/ @MayuriLokhande
/src/platform/pico/ @MayuriLokhande
/src/visor/supervisor/ @MayuriLokhande
/src/ @akashkollipara

# Pranjal Chanda owns
/src/visor/ @pranjalchanda08
/src/lib/libposix/ @pranjalchanda08
/src/ @pranjalchanda08
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@

> **Version (arch:2 | major:4 | minor:2): 1.4.1**
>
[![GitHub CI](https://github.com/VisorFolks/cyancore/actions/workflows/github_ci.yml/badge.svg)](https://github.com/VisorFolks/cyancore/actions/workflows/github_ci.yml)
[![GitHub CI](https://github.com/VisorFolks/cyancore/actions/workflows/github_ci.yml/badge.svg)](https://github.com/VisorFolks/cyancore/actions/workflows/github_ci.yml) [![Discord](https://img.shields.io/discord/859140196498014238?style=flat&logo=discord&logoSize=auto&label=VF%20Server)](https://discord.gg/gxUQr77MT2)

Cyancore is an open source unified software platform for embedded system projects. VisorFolks is motivated to develope a framework which enables a developer/user to write a portable project which can run on any of the target. It is designed to be a goto framework for almost all projects, be it an Embedded applications, IoT, firmware, OS, etc. It provides flexibility, tighter integration of features and abilities by utilizing the hardware and software resources better and boost various KPIs of the final product.


If you'd like to learn and contribute to this project, please follow below links for full documentation and start your endeavor.


### Join VisorFolks Community Forum
Connect with us over VisorFolks discord server
<a href="https://discord.gg/gxUQr77MT2"> <img align="center" alt="VisorFolks Discord Server" width="30px" src="https://discord.com/assets/3437c10597c1526c3dbd98c737c2bcae.svg" /> </a>

### Help
- [**Getting Started**](https://github.com/VisorFolks/cyancore/wiki/Getting-Started)
- [**QEMU Test**](https://github.com/VisorFolks/cyancore/wiki/qemu-test)
Expand Down
4 changes: 2 additions & 2 deletions src/arch/riscv/32/i/terravisor/exception_handler.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* CYANCORE LICENSE
* Copyrights (C) 2019, Cyancore Team
* Copyrights (C) 2024, Cyancore Team
*
* File Name : exception_handler.c
* Description : This file consists of sources for exception
Expand Down Expand Up @@ -67,7 +67,7 @@ void exception_handler(uint32_t mcause, context_frame_t *frame)
else
{
exhandler[cpuid][cause]();
frame->mepc += (MMIO8(frame->mepc) & 0x3) ? 4 : 2;
frame->mepc += (MMIO8(frame->mepc) & 0x2) ? 4 : 2;
}
set_context_frame(NULL);
fence(ow, ow);
Expand Down
1 change: 1 addition & 0 deletions src/lib/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ include $(LIB_DIR)/libc/build.mk
include $(LIB_DIR)/libresource/build.mk
include $(LIB_DIR)/libsyslog/build.mk
include $(LIB_DIR)/libccfs/build.mk
include $(LIB_DIR)/liblocks/build.mk
#==================================================

include $(LIB_DIR)/libnmath/build.mk
Expand Down
2 changes: 1 addition & 1 deletion src/lib/libc/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void *memcpy(void *i, const void *j, size_t size)
{
*dst++ = *src++;
}
return i;
return dst;
}

void *memmove(void *i, const void *j, size_t size)
Expand Down
44 changes: 44 additions & 0 deletions src/lib/liblocks/bakerylock.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

#include <status.h>
#include <stdint.h>
#include <arch.h>
#include <lock/bakerylock.h>

void bakerylock_acquire(bakerylock_t *key)
{
unsigned int tid = arch_core_index();
key->protect[tid] = 1;
arch_dmb();

unsigned int i, n_cust, n_max = 0;
for(i = 0; i < N_CORES; i++)
{
n_cust = key->thread_count[i];
n_max = n_cust > n_max ? n_cust : n_max;
}

key->thread_count[tid] = n_max + 1;

arch_dmb();
key->protect[tid] = 0;
arch_dmb();

for(i = 0; i < N_CORES; i++)
{
while(key->protect[i]);
arch_dmb();

while(key->thread_count[i] && (
(key->thread_count[i] < key->thread_count[tid]) ||
((key->thread_count[i] == key->thread_count[tid]) &&
(i < tid))));
}
}

void bakerylock_release(bakerylock_t *key)
{
unsigned int tid = arch_core_index();
arch_dmb();
key->thread_count[tid] = 0;
}

20 changes: 20 additions & 0 deletions src/lib/liblocks/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# CYANCORE LICENSE
# Copyrights (C) 2024, Cyancore Team
#
# File Name : build.mk
# Description : This file accumulates sources of locks
# Primary Author : Akash Kollipara [[email protected]]
# Organisation : Cyancore Core-Team
#

LIBLOCKS_PATH := $(GET_PATH)
LIB_OBJS :=

LIB += liblocks.a
LIB_INCLUDE += $(LIBLOCKS_PATH)/include
DEP_LIBS_ARG += -llocks


DIR := $(LIBLOCKS_PATH)
include mk/lib.mk
16 changes: 16 additions & 0 deletions src/lib/liblocks/include/lock/bakerylock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#pragma once
#define _BAKERYLOCK_H_

#include <stdbool.h>

#pragma pack(1)
typedef struct
{
volatile uint8_t thread_count[N_CORES];
volatile bool protect[N_CORES];
} bakerylock_t;
#pragma pack()

extern void bakerylock_acquire(bakerylock_t *);
extern void bakerylock_release(bakerylock_t *);
File renamed without changes.
File renamed without changes.

0 comments on commit c1f64e7

Please sign in to comment.