repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
smwikipedia/EwokOS | kernel/arch/raspi2/src/hardware.c | #include <hardware.h>
#include <mm/mmu.h>
#include <mailbox.h>
void hw_init() {
mailboxInit();
}
uint32_t get_phy_ram_size() {
TagsInfoT info;
if(mailboxGetBoardInfo(&info) == NULL)
return 256*MB;
return info.memory_arm_size+info.memory_vc_size;
}
uint32_t get_mmio_base_phy() {
return 0x3F000000;
}
uint32_t ... |
smwikipedia/EwokOS | rootfs/bin/echo/echo.c | <filename>rootfs/bin/echo/echo.c<gh_stars>0
#include <unistd.h>
#include <stdio.h>
int main() {
init_cmain_arg();
const char* arg = read_cmain_arg();
arg = read_cmain_arg();
if(arg == NULL)
return 0;
printf("%s\n", arg);
return 0;
}
|
smwikipedia/EwokOS | kernel/arch/versatilepb/src/timer.c | #include <timer.h>
#include <types.h>
#include <mm/mmu.h>
#include <hardware.h>
/*
The ARM Versatile 926EJS board contains two ARM SB804 dual timer modules [ARM Timers 2004]. Each timer module contains two timers, which are driven by the same clock. The base addresses of the timers are:
Timer0: 0x101E2000, Timer1: 0x... |
smwikipedia/EwokOS | kernel/arch/raspi2/src/mailbox.h | #ifndef MAILBOX_H
#define MAILBOX_H
void mailboxInit(void);
unsigned int mailboxRead(unsigned int channel);
void mailboxWrite(unsigned int channel,unsigned int value);
typedef struct {
unsigned int tags_id;
unsigned int vbuf_size; /* usually 8-bytes */
unsigned int req_res; /* req:0x00000000, res: 0x80000000 | val... |
smwikipedia/EwokOS | rootfs/lib/include/proto.h | #ifndef PROTO_H
#define PROTO_H
#include "types.h"
#include "kstring.h"
#define PROTO_BUFFER 128
typedef struct {
void *data;
uint32_t size;
uint32_t totalSize;
uint32_t offset;
bool readOnly;
}proto_t;
void proto_init(proto_t* proto, void* data, uint32_t size);
proto_t* proto_new(void* data, uint32_t size);
... |
smwikipedia/EwokOS | kernel/include/mm/mmu.h | #ifndef MMU_H
#define MMU_H
#include <types.h>
#define PAGE_SIZE (4*KB)
#define PAGE_TABLE_SIZE (1*KB)
#define PAGE_DIR_NUM 4096
#define PAGE_DIR_SIZE (PAGE_DIR_NUM*4)
#define KERNEL_BASE 0x80000000 //=2G virtual address start base.
#define MMIO_BASE (KERNEL_BASE + 1*GB)
#define IPC_TASK_BASE (MMIO_BASE + 512*MB)
#... |
smwikipedia/EwokOS | rootfs/test/test/test.c | <gh_stars>0
#include <types.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <syscall.h>
#include <device.h>
int main() {
int i = 0;
while(true) {
printf("%d ", i++);
usleep(1000000);
}
return 0;
}
|
smwikipedia/EwokOS | kernel/src/printk.c | <gh_stars>0
#include "printk.h"
#include "vprintf.h"
#include "dev/basic_dev.h"
static void outc(char c, void* p) {
(void)p;
dev_char_write(dev_typeid(DEV_UART, 0), &c, 1);
}
void printk(const char *format, ...) {
va_list ap;
va_start(ap, format);
v_printf(outc, NULL, format, ap);
va_end(ap);
}
|
smwikipedia/EwokOS | rootfs/bin/ls/ls.c | #include <unistd.h>
#include <stdio.h>
#include <vfs/fs.h>
#include <stdlib.h>
#include <kstring.h>
int main() {
char name[NAME_MAX];
char pwd[NAME_MAX];
getcwd(pwd, NAME_MAX);
init_cmain_arg();
const char* arg = read_cmain_arg();
arg = read_cmain_arg();
if(arg == NULL) {
strcpy(name, pwd);
}
else if(arg[0... |
smwikipedia/EwokOS | lib/include/types.h | #ifndef TYPES_H
#define TYPES_H
#ifndef __ASSEMBLER__
#include <stdint.h>
#ifndef NULL
#define NULL ((void*) 0)
#endif
/* boolean */
#ifndef bool
typedef int bool;
#endif
/* integer types */
/*
typedef __signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
type... |
smwikipedia/EwokOS | rootfs/lib/src/graph/font.c | #include "graph/font.h"
#include "kstring.h"
extern font_t font_16x32;
extern font_t font_12x24;
extern font_t font_10x20;
extern font_t font_12x16;
extern font_t font_9x16;
extern font_t font_8x16;
extern font_t font_8x10;
extern font_t font_9x8;
extern font_t font_8x8;
extern font_t font_7x9;
extern font_t font_6x8;... |
smwikipedia/EwokOS | rootfs/sbin/vfsd/fstree.h | #ifndef FS_TREE_H
#define FS_TREE_H
#include "types.h"
#include "tree.h"
#include "fsinfo.h"
void fs_tree_init();
void fs_tree_node_init(tree_node_t* node);
tree_node_t* fs_new_node();
tree_node_t* fs_tree_simple_get(tree_node_t* father, const char* name);
tree_node_t* fs_tree_get(tree_node_t* father, const char*... |
smwikipedia/EwokOS | lib/src/kstring.c | <reponame>smwikipedia/EwokOS
#include "kstring.h"
/*
* memcmp copies n bytes from the source buffer to the target buffer. It returns
* the point32_ter to the target.
*/
extern void *__memcpy32(void *target, const void *source, uint32_t n);
inline void *memcpy(void *target, const void *source, uint32_t n) {
char *t... |
smwikipedia/EwokOS | kernel/arch/versatilepb/src/uart.c | #include <mm/mmu.h>
#include <hardware.h>
#include <dev/basic_dev.h>
#include <system.h>
#include <proc.h>
/* memory mapping for the serial port */
#define UART0 ((volatile uint32_t*)(MMIO_BASE+0x001f1000))
/* serial port register offsets */
#define UART_DATA 0x00
#define UART_FLAGS 0x18
#define UART_INT... |
smwikipedia/EwokOS | rootfs/lib/src/graph/graph.c | #include <graph/graph.h>
#include <stdlib.h>
#include <kstring.h>
#include <vfs/fs.h>
#include <fbinfo.h>
#include <unistd.h>
#include <shm.h>
inline uint32_t rgb(uint32_t r, uint32_t g, uint32_t b) {
return b << 16 | g << 8 | r;
}
uint32_t rgb_int(uint32_t c) {
return rgb((c>>16)&0xff, (c>>8)&0xff, c&0xff);
}
gra... |
smwikipedia/EwokOS | kernel/include/dev/basic_dev.h | #ifndef BASIC_DEVICE_H
#define BASIC_DEVICE_H
#include <types.h>
#include <device.h>
bool dev_init();
bool conf_dev_init();
int32_t dev_info(int32_t type_id, void* info);
int32_t dev_char_read(int32_t type_id, void* buf, uint32_t size);
int32_t dev_char_write(int32_t type_id, void* buf, uint32_t size);
int32_t dev... |
smwikipedia/EwokOS | rootfs/lib/include/thread.h | <reponame>smwikipedia/EwokOS
#ifndef THREAD_H
#define THREAD_H
#include <types.h>
typedef void (*thread_func_t)(void*p);
int32_t thread_raw(thread_func_t func, void* p);
#endif
|
smwikipedia/EwokOS | lib/src/ext2.c | #include <ext2.h>
#include <kstring.h>
static int32_t search(INODE *ip, const char *name, read_block_func_t read_block, char* buf) {
int32_t i;
char c, *cp;
DIR *dp;
for (i=0; i<12; i++){
if ( ip->i_block[i] ){
read_block(ip->i_block[i], buf);
dp = (DIR *)buf;
cp = buf;
while (cp < &buf[SDC_BLOCK_... |
smwikipedia/EwokOS | rootfs/sbin/vfsd/tree.c | #include <tree.h>
#include <kstring.h>
void tree_node_init(tree_node_t* node) {
memset(node, 0, sizeof(tree_node_t));
}
void tree_add(tree_node_t* father, tree_node_t* node) {
if(father == NULL || node == NULL)
return;
node->father = father;
if(father->eChild == NULL) {
father->fChild = node;
}
else {
fa... |
smwikipedia/EwokOS | kernel/include/kfile.h | #ifndef KFILE_H
#define KFILE_H
#include <types.h>
#include <fsinfo.h>
typedef struct kfile {
fs_info_t node_info;
uint16_t ref_r;
uint16_t ref_w;
} kfile_t;
void kf_init();
int32_t kf_open(fs_info_t* info, int32_t wr);
void kf_close(int32_t fd);
void kf_unref(kfile_t* kf, uint32_t wr);
void kf_ref(kfile_t* kf, u... |
smwikipedia/EwokOS | rootfs/bin/shell/shell.c | <gh_stars>0
#include <stdio.h>
#include <kstring.h>
#include <unistd.h>
#include <vfs/fs.h>
#include <syscall.h>
#define KEY_BACKSPACE 127
#define KEY_LEFT 0x8
static void gets(char* buf, int len) {
int i = 0;
while(true) {
if(i >= len)
break;
int c = getch();
if(c == 0) {
sleep(0);
continue;
}
... |
smwikipedia/EwokOS | rootfs/bin/pwd/pwd.c | <filename>rootfs/bin/pwd/pwd.c
#include <unistd.h>
#include <stdio.h>
int main() {
char pwd[NAME_MAX];
printf("%s\n", getcwd(pwd, NAME_MAX));
return 0;
}
|
smwikipedia/EwokOS | rootfs/lib/src/stdio.c | #include <syscall.h>
#include <kstring.h>
#include <vprintf.h>
#include <device.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int32_t _stdin =-1;
int32_t _stdout = -1;
#define STDOUT_BUF_SIZE 128
static char _out_buffer[STDOUT_BUF_SIZE];
static int32_t _out_size = 0;
void init_stdio() {
_stdin = _st... |
smwikipedia/EwokOS | rootfs/lib/src/dev/devserv.c | <filename>rootfs/lib/src/dev/devserv.c
#include <dev/devserv.h>
#include <kserv.h>
#include <unistd.h>
#include <ipc.h>
#include <stdlib.h>
#include <kstring.h>
#include <vfs/vfs.h>
#include <vfs/fs.h>
#include <proto.h>
#include <stdio.h>
static void do_open(device_t* dev, package_t* pkg) {
proto_t* proto = proto_n... |
smwikipedia/EwokOS | kernel/arch/versatilepb/src/mailbox.c | <reponame>smwikipedia/EwokOS<gh_stars>0
#include <hardware.h>
|
smwikipedia/EwokOS | kernel/arch/raspi2/src/irq.c | <reponame>smwikipedia/EwokOS
#include <irq.h>
#include <mm/mmu.h>
#include <kstring.h>
#include <types.h>
#include <timer.h>
#include <dev/uart.h>
#include <hardware.h>
/* interrupt controller register offsets */
#define PIC_STATUS 2
#define PIC_INT_ENABLE 5
#define PIC_INT_DISABLE 9
#define PIC_BASE_OFF 0xB200... |
smwikipedia/EwokOS | rootfs/test/draw/draw.c | #include <types.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <kstring.h>
#include <graph/graph.h>
#include <graph/font.h>
void fbtest() {
font_t* font = get_font("16x32");
graph_t* g = graph_open("/dev/fb0");
if(g == NULL) {
return;
}
int i = 0;
char s[32];
while(i<200) {
clear(g,... |
smwikipedia/EwokOS | lib/include/sconf_parse.h | <filename>lib/include/sconf_parse.h
#ifndef SIMPLE_CONFIG_PARSE_H
#define SIMPLE_CONFIG_PARSE_H
#include <types.h>
#define S_CONF_NAME_MAX 32
#define S_CONF_VALUE_MAX 128
#define S_CONF_ITEM_MAX 32
typedef struct {
char name[S_CONF_NAME_MAX];
char value[S_CONF_VALUE_MAX];
} sconf_item_t;
typedef struct {
sconf_i... |
smwikipedia/EwokOS | kernel/include/timer.h | #ifndef TIMER_H
#define TIMER_H
#include <types.h>
void timer_init();
void timer_start();
void timer_set_interval(uint32_t intervalMicrosecond);
void timer_clear_interrupt(void);
void cpu_tick(uint32_t* sec, uint32_t* msec);
void timer_handle();
#endif
|
smwikipedia/EwokOS | rootfs/sbin/vfsd/tree.h | #ifndef TREE_H
#define TREE_H
#include <types.h>
typedef struct tree_node {
uint32_t id;
struct tree_node* father;
struct tree_node* fChild; /*first child*/
struct tree_node* eChild; /*last child*/
struct tree_node* next; /*next brother*/
struct tree_node* prev; /*prev brother*/
uint32_t size;
void* data;
... |
smwikipedia/EwokOS | rootfs/test/mouse/mouse.c | #include <device.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int main() {
printf("read mouse, click to quit.\n");
int fd = open("/dev/mouse0", 0);
if(fd < 0)
return -1;
while(true) {
int8_t ev[4];
int sz = read(fd, ev, 4);
if(sz < 0)
break;
if(sz == 0)
continue;
printf("mouse... |
smwikipedia/EwokOS | rootfs/lib/src/semaphore.c | #include <semaphore.h>
#include <syscall.h>
#include <unistd.h>
int32_t semaphore_init(semaphore_t* s) {
return syscall1(SYSCALL_SEMAPHORE_INIT, (int32_t)s);
}
int32_t semaphore_close(semaphore_t* s) {
return syscall1(SYSCALL_SEMAPHORE_CLOSE, (int32_t)s);
}
int32_t semaphore_lock(semaphore_t* s) {
//return syscal... |
smwikipedia/EwokOS | kernel/src/semaphore.c | #include <semaphore.h>
#include <system.h>
#include <proc.h>
static inline uint32_t semaphore_phy_addr(int32_t* s) {
uint32_t paddr = resolve_phy_address(_current_proc->space->vm, (uint32_t)s);
return paddr;
}
static int32_t _p_lock = 0;
int32_t semaphore_init(int32_t *s) {
if(s == NULL)
return -1;
CRIT_IN(_p_... |
smwikipedia/EwokOS | rootfs/bin/mkdir/mkdir.c | #include <unistd.h>
#include <stdio.h>
#include <cmain.h>
#include <vfs/fs.h>
int main() {
init_cmain_arg();
const char* arg = read_cmain_arg();
arg = read_cmain_arg();
if(arg != NULL) {
char cwd[NAME_MAX];
int fd = fs_open(getcwd(cwd, NAME_MAX), 0);
if(fd >= 0) {
fs_add(fd, arg);
fs_close(fd);
}
}... |
smwikipedia/EwokOS | rootfs/lib/src/proto.c | #include "proto.h"
#include <kstring.h>
#include <stdlib.h>
void proto_init(proto_t* proto, void* data, uint32_t size) {
proto->data = data;
proto->size = size;
proto->totalSize = size;
proto->offset = 0;
proto->readOnly = (data == NULL) ? false:true;
}
proto_t* proto_new(void* data, uint32_t size) {
proto_t* r... |
smwikipedia/EwokOS | kernel/include/syscalls.h | #ifndef SYSCALLS_H
#define SYSCALLS_H
#include "types.h"
int32_t handle_syscall(int32_t code, int32_t arg0, int32_t arg1, int32_t arg2);
#endif
|
smwikipedia/EwokOS | rootfs/bin/kill/kill.c | #include <cmain.h>
#include <stdlib.h>
#include <syscall.h>
int main() {
init_cmain_arg();
const char* arg = read_cmain_arg();
arg = read_cmain_arg();
if(arg == NULL) {
return -1;
}
int pid = atoi(arg);
return syscall2(SYSCALL_SYSTEM_CMD, 3, pid);
}
|
smwikipedia/EwokOS | kernel/arch/raspi2/src/timer.c | <reponame>smwikipedia/EwokOS<gh_stars>0
#include <timer.h>
#include <types.h>
#include <mm/mmu.h>
#include <hardware.h>
#include <irq.h>
/*#define ARM_TIMER_OFF 0xB400
#define ARM_TIMER_CTRL_32BIT (1<<1)
#define ARM_TIMER_CTRL_ENABLE (1<<7)
#define ARM_TIMER_CTRL_IRQ_ENABLE (1<<5)
#define ARM_TIMER_CTRL_PRESCALE_256 (... |
smwikipedia/EwokOS | kernel/arch/versatilepb/src/hardware.c | #include <hardware.h>
#include <mm/mmu.h>
void hw_init() {
}
uint32_t get_phy_ram_size() {
return 256*MB;
}
uint32_t get_mmio_base_phy() {
return 0x10000000;
}
uint32_t get_mmio_mem_size() {
return 4*MB;
}
void arch_set_kernel_vm(page_dir_entry_t* vm) {
(void)vm;
uint32_t fbBase = (uint32_t)V2P(_fb_start); //... |
smwikipedia/EwokOS | rootfs/dev/consoled/consoled.c | <filename>rootfs/dev/consoled/consoled.c
#include <dev/devserv.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <syscall.h>
#include <graph/graph.h>
#include <graph/font.h>
#include <basic_math.h>
#include <sconf.h>
#define T_W 2 /*tab width*/
static uint32_t _bg_color = 0x0;
static uint32_t _fg... |
smwikipedia/EwokOS | rootfs/lib/include/sconf.h | #ifndef SIMPLE_CONFIG_H
#define SIMPLE_CONFIG_H
#include <sconf_parse.h>
sconf_t* sconf_load(const char* fname);
#endif
|
smwikipedia/EwokOS | kernel/include/scheduler.h | #ifndef SCHEDULER_H
#define SCHEDULER_H
extern void schedule();
#endif
|
smwikipedia/EwokOS | rootfs/lib/include/unistd.h | <filename>rootfs/lib/include/unistd.h
#ifndef UNISTD_H
#define UNISTD_H
#include <types.h>
#include <cmain.h>
int chdir(const char* dir);
char* getcwd(char* buf, uint32_t size);
int fork();
int getpid();
int exec(const char* cmd);
void exit(int code);
void wait(int pid);
int getuid();
unsigned int sleep(unsig... |
smwikipedia/EwokOS | kernel/include/kserv.h | <gh_stars>0
#ifndef KSERV_H
#define KSERV_H
#include <proc.h>
#define KSERV_NAME_MAX 16
typedef struct {
char name[KSERV_NAME_MAX+1];
int32_t pid;
} kserv_t;
int32_t kserv_reg(const char* name);
int32_t kserv_unreg(process_t* proc);
int32_t kserv_get(const char* name);
#endif
|
smwikipedia/EwokOS | lib/src/device.c | <filename>lib/src/device.c<gh_stars>0
#include <device.h>
int32_t dev_buffer_push(dev_buffer_t *buffer, char c, bool loop) {
if(buffer->buffer == NULL || buffer->buffer_size == 0)
return -1;
uint32_t at;
if(buffer->size == buffer->buffer_size) {
if(!loop)
return -1;
buffer->start++;
if(buffer->start ==... |
smwikipedia/EwokOS | rootfs/dev/procd/procd.c | <reponame>smwikipedia/EwokOS<filename>rootfs/dev/procd/procd.c<gh_stars>0
#include <dev/devserv.h>
#include <unistd.h>
#include <stdio.h>
#include <kstring.h>
#include <syscall.h>
#include <vfs/vfs.h>
#include <vfs/fs.h>
static int32_t proc_mount(uint32_t node, int32_t index) {
(void)index;
vfs_add(node, "free_mem"... |
smwikipedia/EwokOS | rootfs/lib/include/cmain.h | #ifndef CMAIN_H
#define CMAIN_H
#include <types.h>
void init_cmain_arg();
const char* read_cmain_arg();
extern int main();
#endif
|
smwikipedia/EwokOS | rootfs/lib/include/dev/mmio.h | #ifndef MMIO_H
#define MMIO_H
#include <types.h>
int32_t mmio_get(uint32_t offset);
int32_t mmio_put(uint32_t offset, int32_t val);
#endif
|
smwikipedia/EwokOS | rootfs/bin/clear/clear.c | #include <unistd.h>
#include <stdio.h>
#include <vfs/fs.h>
#include <stdlib.h>
#include <kstring.h>
int main() {
int32_t fd = _stdout;
if(fd < 0)
return -1;
int32_t cmd = 0; //clear console
fs_ctrl(fd, cmd, NULL, 0, NULL, 0);
return 0;
}
|
smwikipedia/EwokOS | kernel/src/timer.c | #include <timer.h>
#include <scheduler.h>
#include <hardware.h>
#include <irq.h>
#define SCHEDULE_TIME 1000 /*0.001 sec*/
//static uint32_t _cpu_tick = 0;
static uint32_t _cpu_msec = 0;
static uint32_t _cpu_sec = 0;
void timer_handle() {
/*
_cpu_tick++;
if(_cpu_tick >= 10) {
_cpu_msec++;
}
*/
_cpu_msec++;
if... |
smwikipedia/EwokOS | rootfs/dev/fbd/fbd.c | <filename>rootfs/dev/fbd/fbd.c
#include <dev/devserv.h>
#include <unistd.h>
#include <syscall.h>
#include <fbinfo.h>
#include <shm.h>
#include <device.h>
static fb_info_t _fb_info;
static int32_t _fb_buf_id = -1;
static int32_t _fb_bufSize = 0;
static void* _fb_buf = NULL;
static int32_t fb_mount(uint32_t node, int32... |
d3zd3z/mcuboot | boot/zephyr/include/sysflash/sysflash.h | /* Manual version of auto-generated version. */
#ifndef __SYSFLASH_H__
#define __SYSFLASH_H__
#include <generated_dts_board.h>
#include <mcuboot_config/mcuboot_config.h>
extern uint8_t current_image;
#if (MCUBOOT_IMAGE_NUMBER == 1)
#define FLASH_AREA_IMAGE_PRIMARY DT_FLASH_AREA_IMAGE_0_ID
#define FLASH_AREA_IMAG... |
harry624/reliable-data-transport-protocols | cse489589_assignment2/hwang67/src/abt.c | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
// #include "../include/queue.h"
#include "../include/simulator.h"
/* ******************************************************************
ALTERNATING BIT AND GO-BACK-N NETWORK EMULATOR: VERSION 1.1 J.F.Kurose
This code should be used for PA2, unidirection... |
harry624/reliable-data-transport-protocols | cse489589_assignment2/hwang67/src/sr.c | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "../include/simulator.h"
/* ******************************************************************
ALTERNATING8BIT AND GO-BACK-N NETWORK EMULATOR: VERSION 1.1 J.F.Kurose
This code should be used for PA2, unidirectional data transfer
protocols (f... |
wesleyrodriguessantos/Teste-Delvo | lista1.c | #include <stdio.h>
#define MAX 100
#define SUCESSO 1
#define FALHA -1
#define CHAVE_INVALIDA -1
#include <stdlib.h>
typedef struct
{
unsigned int chave;
unsigned int dado;
} Celula;
typedef struct
{
Celula celulas[MAX];
unsigned int tam;
} ListaLinear;
int criarListaVazia(ListaLinear *lls)
{
lls... |
wesleyrodriguessantos/Teste-Delvo | listaLigada1.c | <reponame>wesleyrodriguessantos/Teste-Delvo
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#define false 0
#define true 1
/**
* criei este tipo para se parecer com um boolean
* utilizado na função com retorno int
* e utilizar as define false e true
* */
typedef int boolean;
//typedef int TIPOCHAVE;... |
aniketsaha19/Hacktoberfest-KIIT | X-MAS_TREE_PATTERN.c | #include<stdio.h>
void main()
{
int i,j,k;
int height=3,width=4;
int space=width*5;
int r=1;
int m=1;
for(r=1;r<=height;r++)
{
for(i=m;i<=width;i++)
{
for(j=space;j>=i;j--)
{
printf(" ");
}
for(k=1;k<=i;k++)
{
printf("* ");//space after'*'
}
printf("\n");
}
m+=2;width+=2;
}
for(i=1;i<=4;i++)
{
... |
aniketsaha19/Hacktoberfest-KIIT | diamond_pat.c | #include<stdio.h>
void main()
{
int i,j;
int n=9;
int c1=(n-1)/2;
int c2=3*n/2-1;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(i+j<=c1||i-j>=c1||j-i>=c1||i+j>=c2)
printf("*");
else
printf(" ");
}
printf("\n");
}
}
|
aniketsaha19/Hacktoberfest-KIIT | Biswaroop Bhattacharjee/swap.c | #include<stdio.h>
#include<stdlib.h>
int main()
{
int r,c;
printf("enter no.of rows and column ");
scanf("%d %d",&r,&c);
int* arr[r];
for(int i=0;i<r;i++)
{
arr[i]=(int*)malloc(c*sizeof(int));
}
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
... |
aniketsaha19/Hacktoberfest-KIIT | wave_pat.c | <filename>wave_pat.c
#include<stdio.h>
void main()
{
int is=1;
int os=2;
int WL=5;
int WH=5;
int inc=1;
int i,j,k;
int jump=(WH*3)-(WH+1);
int ch='Z'-WH+1;
for(i=1;i<=WH;i++)
{
for(j=1;j<WL;j++)
{
for(k=1;k<=os;k++)
{
printf(" ");
}
printf("%c",ch);
for(k=1;k<=is;k++)
{
printf(" ");
}
ch-=inc;
... |
aniketsaha19/Hacktoberfest-KIIT | s_pattern.c | #include<stdio.h>
void main()
{
int i,j;
for(i=1;i<=15;i++)
{
for(j=1;j<=10;j++){
if(((i>=4 && i<=6) && (j>=4))||((i>=10 && i<=12)&&(j<=7)))
{
printf(" ");
}
else
{
printf("*");
}
}
printf("\n");
}
}
|
aniketsaha19/Hacktoberfest-KIIT | circle_pattern.c | <gh_stars>1-10
#include<stdio.h>
void main()
{
int i,j,k,z,x;
for(i=1;i<=9;i++)
{
switch(i)
{
case 1:
case 9:x=6;z=4;
break;
case 2:
case 8:x=8;z=2;
break;
case 3:
case 7:x=9;z=1;
break;
default:x=10;z=0;
}
for(j=1;j<=z;j++){
printf(" ");
}
for(k=1;k<=x;k++)
{
printf("* ");
}
printf("\n");
}
... |
aniketsaha19/Hacktoberfest-KIIT | Biswaroop Bhattacharjee/student.c | <reponame>aniketsaha19/Hacktoberfest-KIIT<filename>Biswaroop Bhattacharjee/student.c<gh_stars>1-10
#include <stdio.h>
struct student {
int r;
char name[30];
float m1,m2,m3,m4,m5;
};
int main() {
struct student marks[5];
for(int i=1; i<=5; i++)
{
printf("Student %d\n",i+1);
... |
aniketsaha19/Hacktoberfest-KIIT | Junaid Rahim/array_sum.c | <reponame>aniketsaha19/Hacktoberfest-KIIT
// Sum of an array using recursion
#include <stdio.h>
int sum(int size, int arr[size]){
int arr_sum = 0;
if(size == 1)
return arr[0];
else {
arr_sum = arr[size-1] + sum(--size, arr);
return arr_sum;
}
}
int main(){
int n;... |
aniketsaha19/Hacktoberfest-KIIT | heart_pattern.c | #include<stdio.h>
void main()
{
int i,j;
int n=5;
for(i=n/2;i<=n;i+=2)
{
for(j=1;j<n-i;j+=2)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf("*");
}
for(j=1;j<=n-i;j++)
{
printf(" ");
}
for(j=1;j<=i;j++)
{
printf("*");
}
printf("\n");
}
for(i=n;i>=1;i--)
{
for(j=i;j<n;j++)
{
printf(" ");
}
fo... |
aniketsaha19/Hacktoberfest-KIIT | disarium_num.c | #include<stdio.h>
#include<math.h>
int isDisarium(int);
int digit_count(int);
int main()
{
int i,limit;
int sum=0,digit_count=0,pd;
printf("Enter a number (upper limit)\n");
scanf("%d",&limit);
printf("Disarium Number between 1 to %d\n",limit);
for(i=1;i<=limit;i++)
{
if(isDisarium(i)==1)
{
printf("%... |
aniketsaha19/Hacktoberfest-KIIT | Junaid Rahim/prime_factors.c | <reponame>aniketsaha19/Hacktoberfest-KIIT
// Prime Factors of a given number
#include <stdio.h>
int isPrime(int n){
for(int i=2; i<n; i++){
if(n % i == 0)
return 0;
}
return 1;
}
void print_prime_factors(int *n){
for(int i=2; i<*n; i++){
if ((*n % i == 0) && (isPrime(i)))... |
albin-johansson/SDL | test/testtheme.c | <filename>test/testtheme.c
/*
Copyright (C) 1997-2022 <NAME> <<EMAIL>>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any ... |
albin-johansson/SDL | src/misc/windows/SDL_systheme.c | <reponame>albin-johansson/SDL<filename>src/misc/windows/SDL_systheme.c
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 <NAME> <<EMAIL>>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this sof... |
kurtjd/simon | brainpain.c | #ifdef WIN32
#include <windows.h>
#include <curses.h>
#define XSLEEP(time) Sleep(time)
#else
#include <ncurses.h>
#define XSLEEP(time) nanosleep((struct timespec[]){{0, (time * 1000000L)}}, NULL)
#endif
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define QUAD_WIDTH 15
#define QUAD_HEIGHT 7
#define MEMCHA... |
simonwarn/ExecTime | ExecTime.h | <reponame>simonwarn/ExecTime
#pragma once
#include <chrono>
class ExecTime
{
public:// time in ms
ExecTime();
void Start();
double Print();
private:
std::chrono::steady_clock::time_point start;
}; |
TerrySoba/TinyPaddleGame | source/print.c | #include "print.h"
#if defined(__WATCOMC__)
extern void _printChar(char ch);
#pragma aux _printChar = \
"mov ah, 02h" \
"int 21h" \
modify [ah] \
parm [dl];
#endif
void printString(const char* str)
{
while (*str)
{
#if defined(__GNUC__)
asm (
... |
TerrySoba/TinyPaddleGame | source/title.h | <gh_stars>0
#ifndef _TITLE_H_INCLUDED
#define _TITLE_H_INCLUDED
void drawTitle();
#endif |
TerrySoba/TinyPaddleGame | source/print.h | #ifndef _INCLUDE_PRINT_H
#define _INCLUDE_PRINT_H
// Prints string
// String has to be terminated with '$'.
void printString(const char* str);
#endif |
TerrySoba/TinyPaddleGame | source/main.c | <gh_stars>0
#include <stdint.h>
#include "vga.h"
#include "draw_number.h"
#include "keyboard.h"
#include "sound_engine.h"
#include "print.h"
#include "compiler_version.h"
#include "title.h"
#define abs(x) ((x > 0)?(x):(-x))
#define TO_SUBPIXELS(val) ((val) << 4)
#define FROM_SUBPIXELS(val) ((val) >> 4)
typedef struc... |
TerrySoba/TinyPaddleGame | source/draw_number.h | #ifndef _INCLUDE_DRAW_NUMBER_H
#define _INCLUDE_DRAW_NUMBER_H
#include <stdint.h>
void drawNumber(uint16_t x, int16_t y, uint8_t color, uint8_t scale, int number);
#endif
|
TerrySoba/TinyPaddleGame | source/title.c | #include "title.h"
#include "vga.h"
void drawTitle()
{
#include "title.inc"
}
|
TerrySoba/TinyPaddleGame | source/adlib.h | <filename>source/adlib.h
/* C Header File: ADLIB *****************************************************
Author: <NAME>
Last Amended: 27th April, 1993
Description: Low-level interface to the Adlib (or compatible)
FM sound card. All information gleaned from
<NAME>. Lee's "Programming the Adlib/Sound
Blaster F... |
TerrySoba/TinyPaddleGame | source/adlib.c | /* C Source File: ADLIB *****************************************************
Author: <NAME>
Last Amended: 27th March, 1993
Description: Low-level interface to the Adlib (or compatible)
FM sound card. All information gleaned from
<NAME>'s "Programming the Adlib/Sound
Blaster FM Music Chips".... |
TerrySoba/TinyPaddleGame | source/compiler_version.h | #ifndef _INCLUDE_COMPILER_VERSION_H_
#define _INCLUDE_COMPILER_VERSION_H_
#define xstr(s) str(s)
#define str(s) #s
#if defined(__GNUC__)
#define COMPILER_VERSION "GCC " xstr(__GNUC__) "." xstr(__GNUC_MINOR__) "." xstr(__GNUC_PATCHLEVEL__)
#endif
#if defined(__WATCOMC__)
#define COMPILER_VERSION "OpenWatcom C " xstr(... |
TerrySoba/TinyPaddleGame | source/sound_engine.c | #include "sound_engine.h"
bool initSound(SoundContext* context)
{
if (!context) return false;
if (!AdlibExists())
{
context->soundInitialized = false;
return false;
}
context->soundInitialized = true;
context->soundRestTime = -1;
FMReset();
FMInstrument instrument... |
TerrySoba/TinyPaddleGame | source/vga.c | <filename>source/vga.c
#include "vga.h"
#if defined(__WATCOMC__)
#include <conio.h>
#include <string.h>
#define inport(px) inpw(px)
#define inportb(px) inp(px)
#endif
#define abs(val) (((val) > 0)?(val):-(val))
#if defined(__GNUC__)
void videoInit(uint8_t mode)
{
asm("mov $0, %%ah\n"
"int $0x10"
... |
TerrySoba/TinyPaddleGame | source/sound_engine.h | <gh_stars>0
#ifndef _SOUND_ENGINE_INCLUDED
#define _SOUND_ENGINE_INCLUDED
#include <stdbool.h>
#include "adlib.h"
typedef struct _SoundContext
{
bool soundInitialized; // if set to false, then sound hardware was not found.
int soundRestTime; // contains the time units that the sound will be played until i... |
TerrySoba/TinyPaddleGame | source/keyboard.c | #include "keyboard.h"
#include <dos.h>
#include <stdint.h>
volatile uint8_t s_scancode;
volatile uint8_t s_keyLeft;
volatile uint8_t s_keyRight;
volatile uint8_t s_keyUp;
volatile uint8_t s_keyDown;
volatile uint8_t s_keyCtrl;
volatile uint8_t s_keyAlt;
volatile uint8_t s_keySpace;
volatile uint8_t s_keyEsc;
volat... |
TerrySoba/TinyPaddleGame | source/draw_number.c | #include "draw_number.h"
#include "vga.h"
void drawNumber(uint16_t x, int16_t y, uint8_t color, uint8_t scale, int number)
{
/// Seven segment style number drawing routine
/// The numbers of the segments are shown in the
/// diagram below.
//
// 5
// ######
// ... |
TerrySoba/TinyPaddleGame | source/vga.h | #ifndef _VGA_H_INCLUDED
#define _VGA_H_INCLUDED
#include <stdint.h>
#include <stdbool.h>
#define SCREEN_W 320
#define SCREEN_H 200
void videoInit(uint8_t mode);
void drawRect(uint16_t x, uint8_t y, uint16_t w, uint8_t h, uint8_t color);
void drawLine(int x0, int y0, int x1, int y1, uint8_t color);
void drawHLine(int... |
lubomir/libmodulemd | modulemd/include/modulemd-1.0/private/modulemd-util.h | /*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 <NAME>
*
* Fedora-License-Identifier: MIT
* SPDX-2.0-License-Identifier: MIT
* SPDX-3.0-License-Identifier: MIT
*
* This program is free software.
* For more information on the license, see COPYING.
* For more information on free software, see <h... |
lubomir/libmodulemd | modulemd/include/modulemd-1.0/modulemd-defaults.h | <reponame>lubomir/libmodulemd
/*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 <NAME>
*
* Fedora-License-Identifier: MIT
* SPDX-2.0-License-Identifier: MIT
* SPDX-3.0-License-Identifier: MIT
*
* This program is free software.
* For more information on the license, see COPYING.
* For more inform... |
lubomir/libmodulemd | modulemd/v1/modulemd-improvedmodule.c | /*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 <NAME>
*
* Fedora-License-Identifier: MIT
* SPDX-2.0-License-Identifier: MIT
* SPDX-3.0-License-Identifier: MIT
*
* This program is free software.
* For more information on the license, see COPYING.
* For more information on free software, see <h... |
lubomir/libmodulemd | modulemd/v1/modulemd-yaml-parser-modulemd.c | <gh_stars>0
/*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 <NAME>
*
* Fedora-License-Identifier: MIT
* SPDX-2.0-License-Identifier: MIT
* SPDX-3.0-License-Identifier: MIT
*
* This program is free software.
* For more information on the license, see COPYING.
* For more information on free soft... |
lubomir/libmodulemd | modulemd/v1/tests/test-modulemd-yaml.c | /*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 <NAME>
*
* Fedora-License-Identifier: MIT
* SPDX-2.0-License-Identifier: MIT
* SPDX-3.0-License-Identifier: MIT
*
* This program is free software.
* For more information on the license, see COPYING.
* For more information on free software, see <h... |
lubomir/libmodulemd | modulemd/v1/modulemd-defaults.c | <filename>modulemd/v1/modulemd-defaults.c<gh_stars>0
/*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 <NAME>
*
* Fedora-License-Identifier: MIT
* SPDX-2.0-License-Identifier: MIT
* SPDX-3.0-License-Identifier: MIT
*
* This program is free software.
* For more information on the license, see COPY... |
lubomir/libmodulemd | modulemd/v1/tests/test-modulemd-defaults.c | /*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 <NAME>
*
* Fedora-License-Identifier: MIT
* SPDX-2.0-License-Identifier: MIT
* SPDX-3.0-License-Identifier: MIT
*
* This program is free software.
* For more information on the license, see COPYING.
* For more information on free software, see <h... |
lubomir/libmodulemd | modulemd/include/modulemd-1.0/modulemd-modulestream.h | <gh_stars>0
/*
* This file is part of libmodulemd
* Copyright (C) 2017-2018 <NAME>
*
* Fedora-License-Identifier: MIT
* SPDX-2.0-License-Identifier: MIT
* SPDX-3.0-License-Identifier: MIT
*
* This program is free software.
* For more information on the license, see COPYING.
* For more information on free soft... |
Kristopher38/LuaCPU | software/lua_on_nios2/lua/luaconf.h | /*
** $Id: luaconf.h,v 1.259.1.1 2017/04/19 17:29:57 roberto Exp $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
#ifndef luaconf_h
#define luaconf_h
#include <limits.h>
#include <stddef.h>
/*
** ===================================================================
** Search for "@@" to find all c... |
Kristopher38/LuaCPU | software/lua_on_nios2_bsp/drivers/src/altera_avalon_jtag_uart_ioctl.c | <gh_stars>100-1000
/******************************************************************************
* *
* License Agreement *
* ... |
Kristopher38/LuaCPU | software/lua_on_nios2/lua/common.h | #ifndef h_common
#define h_common
#if defined(__NIOS2__) || defined(VERILATOR_SIM)
#define CUSTOM_LUA
#endif
#define SYNC_REGS(ci, base) { \
for (StkId slot = base; slot < ci->top; slot++) \
{ \
ALT_CI_LUA_STOREVAL(slot, slot->value_); \
ALT_CI_LUA_STORETT(slot, slot->tt_); \
} \
}
#i... |
Kristopher38/LuaCPU | software/lua_on_nios2_bsp/HAL/src/alt_remap_cached.c | <gh_stars>10-100
/******************************************************************************
* *
* License Agreement *
* ... |
Kristopher38/LuaCPU | hardware/soc_system/synthesis/submodules/sequencer/sequencer.pre.h | <reponame>Kristopher38/LuaCPU
#ifndef _SEQUENCER_H_
#define _SEQUENCER_H_
/*
* Copyright Altera Corporation (C) 2012-2014. All rights reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following cond... |
Kristopher38/LuaCPU | software/lua_on_nios2_bsp/HAL/inc/sys/alt_llist.h | <reponame>Kristopher38/LuaCPU
#ifndef __ALT_LIST_H__
#define __ALT_LIST_H__
/******************************************************************************
* *
* License Agreement *
* ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.