repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
alexandergr/INFView
INFViewExample/AppDelegate.h
<reponame>alexandergr/INFView // // AppDelegate.h // INFViewExample // // Created by Alexander on 2/1/18. // Copyright © 2018 Alexander. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
alexandergr/INFView
INFViewExample/ViewController.h
// // ViewController.h // INFViewExample // // Created by Alexander on 2/1/18. // Copyright © 2018 Alexander. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
wangxinzhi0/stream-engine-docs
samples/timesync_thread.h
<filename>samples/timesync_thread.h #ifndef sample_timesync_thread_h #define sample_timesync_thread_h typedef struct thread_context_t thread_context_t; typedef struct tobii_device_t tobii_device_t; thread_context_t* timesync_thread_create( tobii_device_t* device ); void timesync_thread_destroy( thread_context_t* con...
wangxinzhi0/stream-engine-docs
samples/main_loop_linux.h
#ifndef sample_main_loop_linux_h #define sample_main_loop_linux_h typedef struct tobii_device_t tobii_device_t; void main_loop( tobii_device_t* device, void ( *action )( void* context ), void* context ); #endif // sample_main_loop_linux_h
wangxinzhi0/stream-engine-docs
samples/wearable_game_loop_sample_windows.c
#include <tobii/tobii.h> #include <tobii/tobii_wearable.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <inttypes.h> #pragma warning( push ) #pragma warning( disable: 4255 4668 ) #include <windows.h> #pragma warning( pop ) static void wearable_callback( tobii_wearable_consumer_data_t const* we...
n-t-roff/ex-3.2
popen.c
/* Copyright (c) 1979 Regents of the University of California */ #include "stdio.h" #define tst(a,b) (*mode == 'r' ? (b) : (a)) FILE * popen(cmd,mode) char *cmd; char *mode; { register i; FILE *fptr; struct pstruct { int reader; int writer; } str; if (pipe(&str)<0) return NULL; if ((i=fork())==0) { close(...
n-t-roff/ex-3.2
ex_cmds2.c
<reponame>n-t-roff/ex-3.2 /* Copyright (c) 1979 Regents of the University of California */ #include "ex.h" #include "ex_argv.h" #include "ex_temp.h" #include "ex_tty.h" #include "ex_vis.h" extern bool pflag, nflag; extern int poffset; static void error0(void); static void setflav(void); /* * Subroutines for major c...
n-t-roff/ex-3.2
ex_vars.h
<reponame>n-t-roff/ex-3.2 #define AUTOINDENT 0 #define AUTOPRINT 1 #define AUTOWRITE 2 #define BEAUTIFY 3 #define DIRECTORY 4 #define EDCOMPATIBLE 5 #define ERRORBELLS 6 #define HARDTABS 7 #de...
n-t-roff/ex-3.2
ex_tty.c
/* Copyright (c) 1979 Regents of the University of California */ #include "ex.h" #include "ex_tty.h" /* * Terminal type initialization routines, * and calculation of flags at entry or after * a shell escape which may change them. */ /* short ospeed = -1; */ static void zap(void); void gettmode(void) { if (tcge...
n-t-roff/ex-3.2
ex_vput.c
/* Copyright (c) 1979 Regents of the University of California */ #include "ex.h" #include "ex_tty.h" #include "ex_vis.h" /* * Deal with the screen, clearing, cursor positioning, putting characters * into the screen image, and deleting characters. * Really hard stuff here is utilizing insert character operations * ...
n-t-roff/ex-3.2
ex_data.c
<gh_stars>1-10 /* Copyright (c) 1979 Regents of the University of California */ #include "ex.h" #include "ex_tty.h" /* * Initialization of option values. * The option #defines in ex_vars.h are made * from this file by the script makeoptions. */ char direct[ONMSZ] = { '/', 't', 'm', 'p' }; char sections[ONMSZ] = {...
n-t-roff/ex-3.2
ex_vops3.c
<gh_stars>1-10 /* Copyright (c) 1979 Regents of the University of California */ #include "ex.h" #include "ex_tty.h" #include "ex_vis.h" /* * Routines to handle structure. * Operations supported are: * ( ) { } [ ] * * These cover: LISP TEXT * ( ) s-exprs sentences * { } list at same paragraphs * [ ] defun...
ingoha/TTGO-T-Wristband
include/fonts/Orbitron_Light_7.h
<gh_stars>0 const uint8_t orbitron_light7pt7bBitmaps[] PROGMEM = { 0x00, 0xFE, 0x40, 0xB4, 0x0C, 0x41, 0x09, 0xFF, 0x88, 0x41, 0x08, 0x23, 0x08, 0x47, 0xFE, 0x23, 0x08, 0x40, 0x08, 0x02, 0x0F, 0xFA, 0x21, 0x88, 0x22, 0x0F, 0xF8, 0x21, 0x08, 0x42, 0x18, 0x87, 0xFE, 0x08, 0x02, 0x00, 0xF0, 0x29, 0x06, 0x90, 0xC9,...
ingoha/TTGO-T-Wristband
include/fonts/Orbitron_Light_5.h
<reponame>ingoha/TTGO-T-Wristband const uint8_t Orbitron_Light5pt7bBitmaps[] PROGMEM = { 0x00, 0xFA, 0xC0, 0x12, 0x7F, 0x24, 0x24, 0xDE, 0x68, 0x48, 0x10, 0xFF, 0x91, 0x90, 0xFF, 0x11, 0x91, 0xFF, 0x10, 0xF0, 0xA4, 0x4F, 0x20, 0x30, 0x13, 0xC8, 0x94, 0x3C, 0x7E, 0x20, 0x90, 0x16, 0x08, 0xD4, 0x1B, 0xFE, 0x80, 0...
ingoha/TTGO-T-Wristband
include/fonts/Orbitron_Medium_5.h
<filename>include/fonts/Orbitron_Medium_5.h // Created by http://oleddisplay.squix.ch/ Consider a donation // In case of problems make sure that you are using the font file with the correct version! const uint8_t Orbitron_Medium_5Bitmaps[] PROGMEM = { // Bitmap Data: 0x00, // ' ' 0xAA, // '!' 0xC0, // '"' 0x57,0x...
ingoha/TTGO-T-Wristband
include/fonts/Orbitron_Light_6.h
const uint8_t Orbitron_Light6pt7bBitmaps[] PROGMEM = { 0x00, 0xFC, 0x80, 0xB4, 0x08, 0x88, 0x9F, 0xE2, 0x22, 0x21, 0x13, 0xFE, 0x84, 0x44, 0x00, 0x08, 0x7F, 0xE2, 0x31, 0x08, 0x87, 0xFC, 0x22, 0x11, 0x88, 0xFF, 0xC2, 0x00, 0xF8, 0x51, 0x1A, 0x26, 0x7D, 0x00, 0x40, 0x13, 0xCC, 0x4B, 0x09, 0x41, 0xE0, 0x7F, 0x10,...
ingoha/TTGO-T-Wristband
include/fonts/Orbitron_Light_9.h
const uint8_t orbitron_light9pt7bBitmaps[] PROGMEM = { 0x00, 0xFF, 0x88, 0x99, 0x90, 0x0C, 0x10, 0x61, 0x82, 0x09, 0xFF, 0xF1, 0x06, 0x08, 0x20, 0xC1, 0x06, 0x18, 0x30, 0xC7, 0xFF, 0x98, 0x60, 0x83, 0x0C, 0x10, 0x00, 0x02, 0x00, 0x10, 0x1F, 0xFD, 0xFF, 0xF8, 0x21, 0xC1, 0x02, 0x08, 0x10, 0x40, 0x7F, 0xF0, 0x10,...
GauravWalia19/minfile
src/util.c
<filename>src/util.c<gh_stars>1-10 #include "util.h" /*HASHTABLE WORK*/ /** * This is my hash function * * @param string for hash * * @return hash value **/ int hashfunction(char* str) { int sum=0; register int i=0; while(str[i]!='\0') { sum=sum + (int)str[i] - 65; i++; } ...
GauravWalia19/minfile
src/Main.c
#include "Main.h" #include "util.c" #include "function.c" #include "minfile.c" /** * this is the main program * * @return int **/ int main(int argc,char* argv[]) { // buildHTML(); // printf("%d\n",reservedHTML("<head")); // printHashTable(); // freeHashTable(); // exit(0); if(argc==1) ...
GauravWalia19/minfile
test/C/test.c
#include <stdio.h> #define CONST 10 #include <string.h> int main() { char str[50]="This is test"; printf("Hello World"); }
GauravWalia19/minfile
src/minfile.h
<gh_stars>1-10 #include "Main.h" void minfile(char*);
GauravWalia19/minfile
src/function.h
#include "Main.h" /*OTHER FUNCTIONS*/ bool wildcard(char); bool checkValid(char*); /*RESERVED FUNCTIONS*/ bool reservedHTML(char*); bool reservedJS(char*); bool reservedC(char*); bool reservedCPP(char*); bool reservedJAVA(char*); bool reservedCSharp(char*); /*BUILD TREE FUNCTIONS*/ void buildHTML(); void buildJS(...
GauravWalia19/minfile
src/Main.h
/** * This header file contains the * main headers needed **/ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include <limits.h>
GauravWalia19/minfile
src/function.c
#include "function.h" /** * this function will tell whether given char is wildcard or not * for discarding char in filename * * @param ch for char * * @return bool **/ bool wildcard(char ch) { switch(ch) { case '!': case '\"': case '#': case '$': case '%': ...
GauravWalia19/minfile
src/minfile.c
<filename>src/minfile.c #include "minfile.h" /** * this function is the main function of the application * it will single file into minfile * * @param string for filename * * @return void **/ void minfile(char* argv) { printf("Valid filename: %d\n",checkValid(argv)); // ...
GauravWalia19/minfile
test/C/test2.c
#include <stdio.h> int main() { printf("This is awseome"); #define HEL 12 }
GauravWalia19/minfile
mfiles/tested/test.min.c
#include<stdio.h> #define CONST 10 #include<string.h> int main(){char str[50]="This is test";printf("Hello World");}
GauravWalia19/minfile
test/C/test1.c
#include <stdio.h> int main() { /** * checking the comments **/ //check this test comment }
GauravWalia19/minfile
src/util.h
#include "Main.h" #define HASHSIZE INT_MAX/100000 /*HASHTABLE*/ char** HASH=NULL; /*FUNCTIONS*/ int hashfunction(char*); void printHashTable(); void freeHashTable();
ryanoabel/incubator-nuttx
arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c
/**************************************************************************** * arch/risc-v/src/esp32c3/esp32c3_ble_adapter.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regardi...
ryanoabel/incubator-nuttx
arch/risc-v/src/esp32c3/esp32c3_wireless.h
/**************************************************************************** * arch/risc-v/src/esp32c3/esp32c3_wireless.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding ...
ryanoabel/incubator-nuttx
arch/risc-v/src/esp32c3/esp32c3_wireless.c
<filename>arch/risc-v/src/esp32c3/esp32c3_wireless.c<gh_stars>0 /**************************************************************************** * arch/risc-v/src/esp32c3/esp32c3_wireless.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file dis...
ryanoabel/incubator-nuttx
boards/arm/stm32/nucleo-f4x1re/src/stm32_bringup.c
<filename>boards/arm/stm32/nucleo-f4x1re/src/stm32_bringup.c /**************************************************************************** * boards/arm/stm32/nucleo-f4x1re/src/stm32_bringup.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE fil...
loxai/rotaryGames
aim.bmp.h
#ifndef _aim_bmp #define _aim_bmp #define ALPHA_aim_bmp 0x00ff00U static int maxColors_aim_bmp=256; static int width_aim_bmp=8; static int height_aim_bmp=8; static constexpr byte palette_aim_bmp[] = {0,255,0,131,132,136,126,127,131,127,128,132,129,130,134,130,131,135,131,130,135,126,125,130,130,6,31,125,126,130,128,127...
loxai/rotaryGames
bullet.bmp.h
#ifndef _bullet_bmp #define _bullet_bmp #define ALPHA_bullet_bmp 0x00ff00U static int maxColors_bullet_bmp=256; static int width_bullet_bmp=3; static int height_bullet_bmp=3; static constexpr byte palette_bullet_bmp[] = {0,255,0,130,6,31,255,203,89}; static constexpr byte image_bullet_bmp[] = {0,1,0,1,2,1,0,1,0}; #endi...
x0806485/ZJCFoundation
ZJCFoundationDemo/ViewController.h
<reponame>x0806485/ZJCFoundation // // ViewController.h // ZJCFoundationDemo // // Created by baihemiyu001 on 2017/2/24. // Copyright © 2017年 zjc. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
KOREAN139/simulator
Assets/Plugins/VideoCapture/Source/VideoCapture.c
/** * Copyright (c) 2020 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ #define COBJMACROS #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <d3d11.h> #include <synchapi.h> #include "IUnityGraphics.h" #include "IUnityGraphicsD3D11.h" #include "nvEncodeAPI.h" ...
vaind/objectbox-c
examples/c-gen/tasklist.obx.h
// Code generated by ObjectBox; DO NOT EDIT. #pragma once #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include "flatcc/flatcc.h" #include "flatcc/flatcc_builder.h" #include "objectbox.h" /// Internal function used in other generated functions to put (write) explicitly typed objects static obx_id t...
PaesslerAG/webweek-2018
Sketch/MKRFOX1200_SDS011/sigfox_tools.h
<reponame>PaesslerAG/webweek-2018 #define UINT16_t_MAX 65536 #define INT16_t_MAX UINT16_t_MAX/2 int16_t convertToFloatToInt16(float value, long max, long min) { float conversionFactor = (float) (INT16_t_MAX) / (float)(max - min); return (int16_t)(value * conversionFactor); } uint16_t convertToFloatToUInt16(flo...
streamx3/dr_stein
src/settings.h
<reponame>streamx3/dr_stein<gh_stars>0 #ifndef SETTINGS_H #define SETTINGS_H #include <QMutex> #include <QMutexLocker> #include <QtGlobal> #include <QSettings> #include <QFile> #ifndef Q_OS_WIN32 #include <unistd.h> // to use config in user's home folder #include <sys/types.h> #include <pwd.h> #include <stdio.h> #inc...
streamx3/dr_stein
src/mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QTime> #include "settings.h" enum E_ACT{ E_ACT_UNKNOWN = 0, E_ACT_RESTORE, E_ACT_CLONE }; namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWind...
msmania/chromium-debug
src/common.h
#define LOAD_FIELD_OFFSET(FIELD) \ field_name = FIELD; \ if (GetFieldOffset(type.c_str(), field_name, &offset) == 0) { \ offsets_[field_name] = offset; \ } \ else { \ dprintf("ERR> Symbol not found: %s::%s\n", type.c_str(), field_name); \ } #define LOAD_MEMBER_POINTER(MEMBER) \ if (!ReadP...
mop/snip-fu
src/ext/ragel-parser.h
<gh_stars>1-10 #ifndef _PARSER_H_ #define _PARSER_H_ #include <glib.h> enum { ARRAY_SIZE = 2 }; typedef struct parse_input { const char *data; int data_length; const char *start; int start_length; const char *end; int end_length; } parse_input; typedef struct parse_data { int depth; GList *elements; parse...
mop/snip-fu
src/ext/ragel-parser.c
<gh_stars>1-10 #line 1 "./ragel-parser.rl" #include <glib.h> #include <malloc.h> #include <string.h> #include <stdlib.h> #include "ragel-parser.h" /** * This function is called when a snip-fu opening-tag is encountered. * e.g. ${1:tag} */ static void push(parse_data *parse, int fpc); /** * This function is calle...
mop/snip-fu
src/ext/extension.c
#include <ruby.h> #include <glib.h> #include "ragel-parser.h" VALUE TagParser = Qnil; void Init_tag_parser(); static VALUE parse_tags( VALUE self, VALUE start_tag, VALUE end_tag, VALUE string ); void Init_tag_parser() { TagParser = rb_define_module("TagParser"); rb_define_module_function(TagParser, "parse_tag...
OpenLENA/lena-web
web-core/web-cmx/src/mod_cmx.c
/* Copyright 2021 LENA Development Team. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or ag...
smwikipedia/EwokOS
kernel/include/hardware.h
#ifndef HARDWARE_H #define HARDWARE_H #include <types.h> #include <mm/mmu.h> extern char _fb_start[]; extern void hw_init(); extern uint32_t get_mmio_base_phy(); extern uint32_t get_mmio_mem_size(); extern uint32_t get_phy_ram_size(); extern void arch_set_kernel_vm(page_dir_entry_t* vm); #endif
smwikipedia/EwokOS
rootfs/sbin/init/init.c
<reponame>smwikipedia/EwokOS #include <types.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <vfs/fs.h> #include <kserv.h> #include <syscall.h> static int start_vfsd() { printf("start vfs service ... "); int pid = fork(); if(pid == 0) { exec("/sbin/vfsd"); } kserv_wait("kserv.vfsd"); pr...
smwikipedia/EwokOS
rootfs/lib/src/shm.c
#include <shm.h> #include <syscall.h> int32_t shm_alloc(uint32_t size) { return syscall1(SYSCALL_SHM_ALLOC, (int32_t)size); } void shm_free(int32_t id) { syscall1(SYSCALL_SHM_FREE, id); } void* shm_map(int32_t id) { return (void*)syscall1(SYSCALL_SHM_MAP, id); } int32_t shm_unmap(int32_t id) { return syscall1...
smwikipedia/EwokOS
kernel/include/printk.h
<gh_stars>0 #ifndef PRINTK_H #define PRINTK_H void printk(const char *format, ...); #endif
smwikipedia/EwokOS
kernel/include/semaphore.h
<reponame>smwikipedia/EwokOS<filename>kernel/include/semaphore.h<gh_stars>0 #ifndef SEMAPHORE_H #define SEMAPHORE_H #include <types.h> int32_t semaphore_init(int32_t* s); int32_t semaphore_close(int32_t* s); int32_t semaphore_lock(int32_t* s); int32_t semaphore_unlock(int32_t* s); #endif
smwikipedia/EwokOS
kernel/src/dev/basic_dev.c
<gh_stars>0 #include <dev/basic_dev.h> #include <proc.h> #include <sconf.h> /*some devices */ bool uart_init(); bool keyboard_init(); bool mouse_init(); bool sdc_init(); bool dev_init() { if(!uart_init()) return false; if(!keyboard_init()) return false; if(!mouse_init()) return false; if(!sdc_init()) ...
smwikipedia/EwokOS
rootfs/dev/null/null.c
#include <dev/devserv.h> #include <unistd.h> int main() { device_t dev = {0}; dev_run(&dev, "dev.null", 0, "/dev/null", true); return 0; }
smwikipedia/EwokOS
rootfs/lib/src/package.c
#include "package.h" #include "kstring.h" #include "stdlib.h" package_t* pkg_new(int32_t id, uint32_t type, void* data, uint32_t size, int32_t pid) { package_t* pkg = (package_t*)malloc(sizeof(package_t) + size); if(pkg == NULL) return NULL; pkg->id = id; pkg->pid = pid; pkg->size = 0; pkg->type = type; voi...
smwikipedia/EwokOS
kernel/arch/versatilepb/src/irq.c
<filename>kernel/arch/versatilepb/src/irq.c #include <irq.h> #include <mm/mmu.h> #include <timer.h> /* memory mapping for the prime interrupt controller */ #define PIC ((volatile uint32_t*)(MMIO_BASE+0x00140000)) /* interrupt controller register offsets */ #define PIC_STATUS 0 #define PIC_INTACK 3 #define PIC...
smwikipedia/EwokOS
rootfs/lib/src/kserv.c
#include "kserv.h" #include <ipc.h> #include <syscall.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> bool kserv_run(const char* reg_name, kserv_func_t servFunc, void* p) { if(syscall1(SYSCALL_KSERV_REG, (int)reg_name) != 0) { return false; } while(true) { package_t* pkg = ipc_roll(); if(p...
smwikipedia/EwokOS
rootfs/lib/include/vfs/vfs.h
<reponame>smwikipedia/EwokOS<gh_stars>0 #ifndef VFS_NODE_H #define VFS_NODE_H #include <fsinfo.h> #define VFS_DIR_SIZE 0xffffffff uint32_t vfs_add(uint32_t node, const char* name, uint32_t size, void* data); int32_t vfs_del(uint32_t node); int32_t vfs_node_by_name(const char* fname, fs_info_t* info); uint32_t vfs...
smwikipedia/EwokOS
kernel/arch/raspi2/src/spi.c
<gh_stars>0 /*----------------------------------------------------------------------------*/ /** * - for accessing spi * = this is using spi0 (spi-specific interface) * = bcm2835 has 2 more mini-spi interfaces (spi1/spi2) * $ part of auxiliary peripheral (along with mini-uart) * $ NOT using these **/ #...
smwikipedia/EwokOS
rootfs/lib/src/sconf.c
<reponame>smwikipedia/EwokOS #include <sconf.h> #include <vfs/fs.h> #include <stdlib.h> sconf_t* sconf_load(const char* fname) { int32_t size; char* str = fs_read_file(fname, &size); if(str == NULL || size == 0) return NULL; sconf_t* ret = sconf_parse(str, malloc); free(str); return ret; }
smwikipedia/EwokOS
lib/src/sconf_parse.c
#include <sconf.h> #include <kstring.h> static inline bool is_space(char c) { return (c == ' ' || c == '\t' || c == '\r' || c == '\n'); } static inline void trim_right(char* s, int32_t i) { i--; while(i >= 0) { if(is_space(s[i])) s[i--] = 0; else break; } } sconf_t* sconf_parse(const char* str, malloc_...
smwikipedia/EwokOS
rootfs/lib/include/dev/devserv.h
#ifndef DEVSERV_H #define DEVSERV_H #include <types.h> #include <device.h> typedef struct { int32_t (*mount)(uint32_t node, int32_t index); int32_t (*unmount)(uint32_t node); int32_t (*open)(uint32_t node, int32_t flags); int32_t (*close)(uint32_t node); int32_t (*add)(uint32_t node, const char* name); int32_t ...
smwikipedia/EwokOS
rootfs/lib/include/stdio.h
<reponame>smwikipedia/EwokOS<filename>rootfs/lib/include/stdio.h<gh_stars>0 #ifndef STDIO_H #define STDIO_H #include <vprintf.h> extern int32_t _stdin; extern int32_t _stdout; void init_stdio(); void putch(int c); int getch(); void printf(const char *format, ...); #endif
smwikipedia/EwokOS
rootfs/lib/include/graph/graph.h
<reponame>smwikipedia/EwokOS #ifndef GRAPH_H #define GRAPH_H #include <graph/font.h> typedef struct Graph { uint32_t *buffer; uint32_t w; uint32_t h; int32_t fd; int32_t shm_id; } graph_t; uint32_t rgb(uint32_t r, uint32_t g, uint32_t b); uint32_t rgb_int(uint32_t c); graph_t* graph_open(const char* fname); ...
smwikipedia/EwokOS
rootfs/sbin/login/userman.c
<gh_stars>0 #include <userman.h> #include <ipc.h> #include <kstring.h> #include <syscall.h> #include <stdlib.h> #include <proto.h> static int _usermanPid = -1; #define CHECK_KSERV_USERMAN \ if(_usermanPid < 0) \ _usermanPid = syscall1(SYSCALL_KSERV_GET, (int)"kserv.userman"); \ if(_usermanPid < 0) \ return -1; ...
smwikipedia/EwokOS
rootfs/bin/uname/uname.c
#include <stdio.h> #include <unistd.h> #include <kstring.h> int main() { init_cmain_arg(); const char* arg = read_cmain_arg(); arg = read_cmain_arg(); if(arg == NULL) printf("Ewok\n"); else if(strcmp(arg, "-a") == 0) printf("Ewok micro-kernel OS, ARM A-Core, V 0.01\n"); return 0; }
smwikipedia/EwokOS
rootfs/lib/include/graph/font.h
<filename>rootfs/lib/include/graph/font.h #ifndef FONT_H #define FONT_H #include <types.h> typedef struct { int32_t idx; uint32_t w, h; const void *data; int32_t pref; } font_t; font_t* get_font(const char* name); #endif
smwikipedia/EwokOS
lib/include/fsinfo.h
<gh_stars>0 #ifndef FSINFO_H #define FSINFO_H #include <types.h> #define FS_TYPE_DIR 0x0 #define FS_TYPE_FILE 0x01 typedef struct { uint32_t id; //vfs treeNode id uint32_t node; //node of vfstree uint32_t size; //file size or children num of dir uint32_t type; //file or dir int32_t owner; //user owner char na...
smwikipedia/EwokOS
rootfs/bin/cat/cat.c
<reponame>smwikipedia/EwokOS #include <unistd.h> #include <cmain.h> #include <stdio.h> #include <vfs/fs.h> #include <kstring.h> #include <stdlib.h> void gen_fname(char* fname, const char* arg) { if(arg[0] == '/') { strcpy(fname, arg); } else { char pwd[NAME_MAX]; getcwd(pwd, NAME_MAX); if(pwd[1] == 0) /*roo...
smwikipedia/EwokOS
kernel/src/syscalls.c
#include <syscallcode.h> #include <system.h> #include <syscalls.h> #include <types.h> #include <proc.h> #include <kernel.h> #include <kstring.h> #include <mm/trunkmalloc.h> #include <mm/kmalloc.h> #include <mm/shm.h> #include <ipc.h> #include <types.h> #include <kserv.h> #include <fsinfo.h> #include <scheduler.h> #incl...
smwikipedia/EwokOS
kernel/arch/raspi2/src/keyboard.c
#include <types.h> #include <mm/mmu.h> #include <dev/keyboard.h> #include <printk.h> #include <system.h> #include <proc.h> #include <dev/basic_dev.h> //0 1 2 3 4 5 6 7 8 9 A B C D E F const char _ltab[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
smwikipedia/EwokOS
kernel/include/ipc.h
#ifndef KMESSAGE_H #define KMESSAGE_H #include <types.h> /*init ipcernel ipc channel*/ void ipc_init(); /*open ipcernel ipc channel*/ int32_t ipc_open(int32_t pid, uint32_t buf_size); /*close ipcernel ipc channel*/ int32_t ipc_close(int32_t id); /*return size sent, 0 means closed, < 0 means retry. */ int32_t ipc_w...
smwikipedia/EwokOS
kernel/arch/raspi2/src/gpio.c
<reponame>smwikipedia/EwokOS<filename>kernel/arch/raspi2/src/gpio.c #include <mm/mmu.h> #include <system.h> #define GPIO_OFFSET 0x00200000 #define GPIO_BASE (MMIO_BASE|GPIO_OFFSET) #include <dev/gpio.h> #define GPIO_FSEL (GPIO_BASE+0x00) #define GPIO_FSET (GPIO_BASE+0x1C) #define GPIO_FCLR (GPIO_BASE+0x28) #define G...
smwikipedia/EwokOS
kernel/src/kfile.c
<reponame>smwikipedia/EwokOS #include <kfile.h> #include <kstring.h> #include <system.h> #include <proc.h> #include <mm/kmalloc.h> #define OPEN_MAX 128 static kfile_t _files[OPEN_MAX]; //file info caches static int32_t _p_lock = 0; void kf_init() { uint32_t i = 0; while(i < OPEN_MAX) { _files[i].node_info.node =...
smwikipedia/EwokOS
rootfs/lib/src/cmain.c
<gh_stars>0 #include <cmain.h> #include <syscall.h> #include <stdio.h> #include <unistd.h> static char _cmd[256] = { 0 }; static int _offCmd = 0; void init_cmain_arg() { _offCmd = 0; syscall2(SYSCALL_GET_CMD, (int)_cmd, 256); } const char* read_cmain_arg() { const char* p = NULL; bool quotes = false; while(_cm...
smwikipedia/EwokOS
lib/include/procinfo.h
<reponame>smwikipedia/EwokOS #ifndef PROC_INFO_H #define PROC_INFO_H #include <types.h> typedef struct { int32_t pid; int32_t father_pid; int32_t owner; int32_t state; uint32_t start_sec; uint32_t heap_size; char cmd[CMD_MAX]; } proc_info_t; #endif
smwikipedia/EwokOS
rootfs/lib/include/kserv.h
#ifndef KSERV_H #define KSERV_H #include "package.h" typedef void (*kserv_func_t) (package_t* pkg, void *p); bool kserv_run(const char* reg_name, kserv_func_t servFunc, void* p); int kserv_get_pid(const char* reg_name); void kserv_wait(const char* reg_name); #endif
smwikipedia/EwokOS
rootfs/bin/uid/uid.c
<reponame>smwikipedia/EwokOS<filename>rootfs/bin/uid/uid.c #include <unistd.h> #include <stdio.h> #include <syscall.h> int main() { int uid = syscall1(SYSCALL_GET_UID, getpid()); printf("%d\n", uid); return 0; }
smwikipedia/EwokOS
kernel/arch/versatilepb/src/mouse.c
#include <types.h> #include <mm/mmu.h> #include <system.h> #include <proc.h> #include <basic_math.h> #include <dev/basic_dev.h> #define MOUSE_CR 0x00 #define MOUSE_STAT 0x04 #define MOUSE_DATA 0x08 #define MOUSE_CLKDIV 0x0C #define MOUSE_IIR 0x10 #define MOUSE_CR_TYPE (1 << 5) #define MOUSE_CR_RXINTREN (1 << 4) ...
smwikipedia/EwokOS
kernel/include/elf.h
#ifndef ELF_H #define ELF_H #include <types.h> #define ELF_MAGIC 0x464C457FU enum elf_type { ELFTYPE_NONE = 0, ELFTYPE_RELOCATABLE = 1, ELFTYPE_EXECUTABLE = 2 }; struct elf_header { uint32_t magic; char elf[12]; uint16_t type; uint16_t machine; uint32_t version; uint32_t entry; uint32_t phoff; ui...
smwikipedia/EwokOS
rootfs/sbin/vfsd/fstree.c
<filename>rootfs/sbin/vfsd/fstree.c #include <fstree.h> #include <kstring.h> #include <fsinfo.h> #include <stdlib.h> static uint32_t _node_id_counter = 0; void fs_tree_node_init(tree_node_t* node) { tree_node_init(node); node->id = _node_id_counter++; node->data = malloc(sizeof(fs_node_t)); fs_node_t* fn = (fs_no...
smwikipedia/EwokOS
rootfs/sbin/vfsd/vfsd.c
<gh_stars>0 #include <kserv.h> #include <unistd.h> #include <stdio.h> #include <ipc.h> #include <proto.h> #include <vfs/vfs.h> #include <vfs/vfscmd.h> #include <fstree.h> #include <kstring.h> #include <stdlib.h> #include <syscall.h> typedef struct { char dev_name[DEV_NAME_MAX]; int32_t dev_index; int32_t dev_serv_p...
smwikipedia/EwokOS
rootfs/lib/include/vfs/fs.h
#ifndef FS_H #define FS_H #include <fsinfo.h> enum { FS_OPEN = 0, FS_CLOSE, FS_WRITE, FS_READ, FS_CTRL, FS_FLUSH, FS_DMA, FS_ADD }; int fs_open(const char* name, int32_t flags); int fs_close(int fd); int fs_info(int fd, fs_info_t* info); int fs_ninfo(uint32_t node_addr, fs_info_t* info); int fs_finfo(con...
smwikipedia/EwokOS
lib/include/vprintf.h
#ifndef VPRINTF_H #define VPRINTF_H #include <stdarg.h> #include <types.h> typedef void (*outc_func_t)(char c, void* p); void v_printf(outc_func_t outc, void* p, const char* format, va_list ap); int32_t snprintf(char *target, int32_t size, const char *format, ...); #endif
smwikipedia/EwokOS
rootfs/lib/src/stdlib.c
#include <stdlib.h> #include <syscall.h> void* malloc(uint32_t size) { char* p = (char*)syscall1(SYSCALL_PMALLOC, size); return (void*)p; } void free(void* p) { syscall1(SYSCALL_PFREE, (int)p); } int32_t atoi_base(const char *s, int32_t b) { int32_t i, result, x, error; for (i = result = error = 0; s[i]!='\0'; ...
smwikipedia/EwokOS
rootfs/lib/src/thread.c
#include <thread.h> #include <syscall.h> int32_t thread_raw(thread_func_t func, void* p) { return syscall2(SYSCALL_THREAD, (int32_t)func, (int32_t)p); }
smwikipedia/EwokOS
kernel/src/mm/kmalloc.c
#include <mm/kmalloc.h> #include <mm/trunkmalloc.h> #include <mm/mmu.h> #include <kernel.h> #include <printk.h> static malloc_t _kmalloc; static uint32_t _kmalloc_mem_tail; static void km_shrink(void* arg, int32_t pages) { (void)arg; _kmalloc_mem_tail -= pages * PAGE_SIZE; } static bool km_expand(void* arg, int32...
smwikipedia/EwokOS
rootfs/lib/src/unistd.c
#include <unistd.h> #include <vfs/fs.h> #include <syscall.h> #include <kstring.h> #include <stdio.h> #include <stdlib.h> #include <procinfo.h> #include <ext2.h> int fork() { return syscall0(SYSCALL_FORK); } int getpid() { return syscall0(SYSCALL_GETPID); } char* from_sd(const char *filename, int32_t* sz); static c...
smwikipedia/EwokOS
rootfs/lib/include/vfs/vfscmd.h
#ifndef VFSCMD_H #define VFSCMD_H enum { VFS_CMD_ADD = 0, VFS_CMD_DEL, VFS_CMD_INFO, VFS_CMD_NODE_BY_FD, VFS_CMD_NODE_BY_NAME, VFS_CMD_KIDS, VFS_CMD_MOUNT, VFS_CMD_UNMOUNT }; #endif
smwikipedia/EwokOS
rootfs/lib/include/semaphore.h
#ifndef SEMAPHORE_H #define SEMAPHORE_H #include <types.h> typedef int32_t semaphore_t; int32_t semaphore_init(semaphore_t* s); int32_t semaphore_close(semaphore_t* s); int32_t semaphore_lock(semaphore_t* s); int32_t semaphore_unlock(semaphore_t* s); #endif
smwikipedia/EwokOS
kernel/src/system.c
#include <system.h> #include <types.h> #include <mm/kalloc.h> #include <proc.h> #include <kstring.h> #include <hardware.h> #include <timer.h> inline void loopd(uint32_t times) { while(times > 0) times--; } static int32_t get_procs_num() { int32_t res = 0; for(int32_t i=0; i<PROCESS_COUNT_MAX; i++) { if(_proces...
smwikipedia/EwokOS
rootfs/lib/src/vfs/vfs.c
#include <vfs/vfs.h> #include <vfs/vfscmd.h> #include <kserv.h> #include <proto.h> #include <stdlib.h> #include <ipc.h> #include <package.h> #define VFS_NAME "kserv.vfsd" inline uint32_t vfs_add(uint32_t node, const char* name, uint32_t size, void* data) { int32_t serv_pid = kserv_get_pid(VFS_NAME); if(serv_pid < ...
smwikipedia/EwokOS
kernel/arch/raspi2/src/mailbox.c
<reponame>smwikipedia/EwokOS #include "mailbox.h" #include "mm/mmu.h" #include "hardware.h" #define MAILBOX_OFFSET 0x0000B880 #define MAILBOX_BASE (MMIO_BASE | MAILBOX_OFFSET) #define MAIL0_BASE (MAILBOX_BASE+0x00) #define MAIL0_READ (MAILBOX_BASE+0x00) #define MAIL0_POLL (MAILBOX_BASE+0x10) #define MAIL0_SE...
smwikipedia/EwokOS
kernel/include/mm/shm.h
<filename>kernel/include/mm/shm.h<gh_stars>0 #ifndef SHAREMEM_H #define SHAREMEM_H #include <types.h> void shm_init(); int32_t shm_alloc(uint32_t size); void* shm_raw(int32_t id); void shm_free(int32_t id); void* shm_proc_map(int32_t pid, int32_t id); int32_t shm_proc_unmap(int32_t pid, int32_t id); void shm_pr...
smwikipedia/EwokOS
kernel/arch/raspi2/src/fb.c
<reponame>smwikipedia/EwokOS<gh_stars>0 #include "mailbox.h" #include "dev/fb.h" #include "kstring.h" void __mem_barrier(); #define VIDEO_FB_CHANNEL MAIL_CH_FBUFF #define VIDEO_INIT_RETRIES 3 #define VIDEO_INITIALIZED 0 #define VIDEO_ERROR_RETURN 1 #define VIDEO_ERROR_POINTER 2 #define MAIL_CH_FBUFF 0x00000001 int3...
smwikipedia/EwokOS
kernel/include/mm/kalloc.h
#ifndef KALLOC_H #define KALLOC_H #include <types.h> typedef struct PageList { struct PageList *next; } page_list_t; /* exported function declarations */ void kalloc_init(uint32_t start, uint32_t end); void *kalloc(); void kfree(void *page); void *kalloc1k(); void kfree1k(void *page); uint32_t get_free_mem_size(voi...
smwikipedia/EwokOS
rootfs/dev/sdcard/sdcard.c
#include <unistd.h> #include <stdlib.h> #include <kstring.h> #include <dev/devserv.h> #include <vfs/vfs.h> #include <vfs/fs.h> #include <syscall.h> #include <ext2.h> #include <device.h> static int32_t _iblock = 12; static int32_t _typeid = dev_typeid(DEV_SDC, 0); static int32_t read_block(int32_t block, char* buf) {...
smwikipedia/EwokOS
rootfs/lib/include/shm.h
#ifndef SHAREMEM_H #define SHAREMEM_H #include <types.h> int32_t shm_alloc(uint32_t size); void shm_free(int32_t id); void* shm_map(int32_t id); int32_t shm_unmap(int32_t id); #endif
smwikipedia/EwokOS
lib/include/basic_math.h
<filename>lib/include/basic_math.h #ifndef BASIC_MATH_H #define BASIC_MATH_H #include <types.h> uint32_t div_u32(uint32_t v, uint32_t by); uint32_t mod_u32(uint32_t v, uint32_t by); #endif
smwikipedia/EwokOS
kernel/include/kernel.h
#ifndef KERNEL_H #define KERNEL_H #include <mm/mmu.h> extern char _kernel_start[]; extern char _kernel_end[]; extern char _init_stack_top[]; extern char _irq_stack_top[]; extern page_dir_entry_t* _kernel_vm; void set_kernel_vm(page_dir_entry_t* vm); void set_allocable_vm(page_dir_entry_t* vm); #endif
smwikipedia/EwokOS
kernel/src/scheduler.c
<gh_stars>0 #include <proc.h> #include <scheduler.h> void schedule(void) { if(_current_proc->state == READY) { //current process ready to run _current_proc->state = RUNNING; proc_start(_current_proc); return; } //current process is runing, switch to next one. process_t* head_proc = _current_proc; process_t...