type
stringclasses
5 values
content
stringlengths
9
163k
functions
void R_DrawColumnInCache(const column_t *patch, byte *cache, int originy, int cacheheight, byte *marks) { while (patch->topdelta != 0xff) { int count = patch->length; int position = originy + patch->topdelta; if (position < 0) { count += posi...
functions
void R_GenerateComposite(int texnum) { texture_t *texture = textures[texnum]; byte *block = Z_Malloc(texture->compositesize, PU_STATIC, (void **)&texture->composite); // Composite the columns together. texpatch_t *patch = texture->patches; short *collump = texture->columnlump; ...
functions
void R_GenerateLookup(int texnum, int *const errors) { texture_t *texture = textures[texnum]; // killough 4/9/98: make column offsets 32-bit; // clean up malloc-ing to use sizeof // CPhipps - moved allocing here short *collump = texture->columnlump = Z_Malloc(texture->width*sizeof(*texture->colum...
functions
equal if (lump != lastlump) { // cph - must change the cached lump if (lastlump>0) W_UnlockLumpNum(lastlump); if ((lastlump = lump) > 0) lastlumpdata = W_CacheLumpNum(lump); #ifdef RANGECHECK else lastlumpdata = NULL; #endif }
functions
void R_InitTextures (void) { strifemaptexture_t *mtexture; //kaiser texture_t *texture; strifemappatch_t *mpatch; //kaiser texpatch_t *patch; int i, j; int maptex_lump[2] = {-1, -1}
functions
killough for (i=0 ; i<nummappatches ; i++) { strncpy (name,name_p+i*8, 8); patchlookup[i] = W_CheckNumForName(name); if (patchlookup[i] == -1) { // killough 4/17/98: // Some wads use sprites as wall patches, so repeat check and // look for sprites...
functions
void R_InitFlats(void) { int i; firstflat = W_GetNumForName("F_START") + 1; lastflat = W_GetNumForName("F_END") - 1; numflats = lastflat - firstflat + 1; // Create translation table for global animation. // killough 4/9/98: make column offsets 32-bit; // clean up malloc-ing to use sizeof ...
functions
void R_InitSpriteLumps(void) { int i; const patch_t *patch; firstspritelump = W_GetNumForName("S_START") + 1; lastspritelump = W_GetNumForName("S_END") - 1; numspritelumps = lastspritelump - firstspritelump + 1; // killough 4/9/98: make columnd offsets 32-bit; // clean up malloc-ing to use siz...
functions
void R_InitColormaps(void) { int i; firstcolormaplump = W_GetNumForName("C_START"); lastcolormaplump = W_GetNumForName("C_END"); numcolormaps = lastcolormaplump - firstcolormaplump; colormaps = Z_Malloc(sizeof(*colormaps) * numcolormaps, PU_STATIC, 0); colormaps[0] = (lighttable_t *)W_CacheLumpName(...
functions
int R_ColormapNumForName(const char *name) { register int i = 0; if (strncasecmp(name,"COLORMAP",8)) // COLORMAP predefined to return 0 if ((i = (W_CheckNumForName)(name, ns_colormaps)) != -1) i -= firstcolormaplump; return i; }
functions
void R_InitTranMap(int progress) { int lump = W_CheckNumForName("TRANMAP"); // If a tranlucency filter map lump is present, use it if (lump != -1) // Set a pointer to the translucency filter maps. main_tranmap = W_CacheLumpNum(lump); // killough 4/11/98 else { // Compose a default transp...
functions
void R_InitData(void) { lprintf(LO_INFO, "Textures "); R_InitTextures(); lprintf(LO_INFO, "Flats "); R_InitFlats(); lprintf(LO_INFO, "Sprites "); R_InitSpriteLumps(); if (default_translucency) // killough 3/1/98 R_InitTranMap(1); // killough 2/21/98, 3/6/98 R_...
functions
int R_CheckTextureNumForName(const char *name) { int i = 0; if (*name != '-') // "NoTexture" marker. { i = textures[W_LumpNameHash(name) % (unsigned) numtextures]->index; while (i >= 0 && strncasecmp(textures[i]->name,name,8)) i = textures[i]->next; }
functions
void R_PrecacheLevel(void) { register int i; register byte *hitlist; if (demoplayback) return; { size_t size = numflats > numsprites ? numflats : numsprites; hitlist = malloc((size_t)numtextures > size ? numtextures : size); }
functions
void R_SetPatchNum(patchnum_t *patchnum, const char *name) { patch_t *patch; patch = (patch_t *) W_CacheLumpName(name); patchnum->width = patch->width; patchnum->height = patch->height; patchnum->leftoffset = patch->leftoffset; patchnum->topoffset = patch->topoffset; patchnum->lumpnum = W_GetNum...
includes
#include <config.h>
includes
#include <string.h>
includes
#include <tds_sysdep_public.h>
includes
#include <freetds/bytes.h>
defines
#define P32I_INDEX_ROW(n,i,a,b,c,d) \
defines
#define P32I_INDEX(n) \
functions
void tds_des_set_odd_parity(des_cblock key) { int i; unsigned char parity; for (i = 0; i < 8; i++) { parity = key[i]; parity ^= parity >> 4; parity ^= parity >> 2; parity ^= parity >> 1; key[i] = (key[i] & 0xfe) | (parity & 1); }
functions
int des_init(DES_KEY * key) { spinit(key); perminit_ip(key); perminit_fp(key); return 0; }
functions
int tds_des_set_key(DES_KEY * dkey, const des_cblock user_key, int len) { char pc1m[56]; /* place to modify pc1 into */ char pcr[56]; /* place to rotate pc1 into */ register int i, j, l; int m; memset(dkey, '\0', sizeof(DES_KEY)); des_init(dkey); /* Clear key schedule */ for (j = 0; j < 56; j++) { /* conv...
functions
void tds_des_encrypt(DES_KEY * key, des_cblock block) { register uint32_t left, right; register unsigned char *knp; uint32_t work[2]; /* Working data storage */ permute_ip(block, key, (unsigned char *) work); /* Initial Permutation */ left = TDS_GET_A4BE(&work[0]); right = TDS_GET_A4BE(&work[1]); /* Do the 16 ...
functions
void _mcrypt_decrypt(DES_KEY * key, unsigned char *block) { register uint32_t left, right; register unsigned char *knp; uint32_t work[2]; /* Working data storage */ permute_ip(block, key, (unsigned char *) work); /* Initial permutation */ /* Left/right half swap, plus byte swap if little-endian */ right = TDS_G...
functions
void permute_ip(des_cblock inblock, DES_KEY * key, des_cblock outblock) { register unsigned char *ib, *ob; /* ptr to input or output block */ register unsigned char *p, *q; register int j; /* Clear output block */ memset(outblock, '\0', 8); ib = inblock; for (j = 0; j < 16; j += 2, ib++) { /* for each input ni...
functions
void permute_fp(des_cblock inblock, DES_KEY * key, des_cblock outblock) { register unsigned char *ib, *ob; /* ptr to input or output block */ register unsigned char *p, *q; register int j; /* Clear output block */ memset(outblock, '\0', 8); ib = inblock; for (j = 0; j < 16; j += 2, ib++) { /* for each input ni...
functions
uint32_t f(DES_KEY * key, register uint32_t r, register unsigned char *subkey) { register const uint32_t *spp; register uint32_t rval, rt; register int er; #ifdef TRACE printf("f(%08lx, %02x %02x %02x %02x %02x %02x %02x %02x) = ", r, subkey[0], subkey[1], subkey[2], subkey[3], subkey[4], subkey[5], subkey...
functions
void perminit_ip(DES_KEY * key) { register int l, j, k; int i, m; /* Clear the permutation array */ memset(key->iperm, '\0', 16 * 16 * 8); for (i = 0; i < 16; i++) /* each input nibble position */ for (j = 0; j < 16; j++) /* each possible input nibble */ for (k = 0; k < 64; k++) { /* each output bit positio...
functions
void perminit_fp(DES_KEY * key) { register int l, j, k; int i, m; /* Clear the permutation array */ memset(key->fperm, '\0', 16 * 16 * 8); for (i = 0; i < 16; i++) /* each input nibble position */ for (j = 0; j < 16; j++) /* each possible input nibble */ for (k = 0; k < 64; k++) { /* each output bit positio...
functions
void spinit(DES_KEY * key) { int i, s, j, rowcol; uint32_t val; for (s = 0; s < 8; s++) { /* For each S-box */ for (i = 0; i < 64; i++) { /* For each possible input */ val = 0; /* The row number is formed from the first and last * bits; the column number is from the middle 4 */ rowcol = (i & 32) ...
functions
int tds_des_ecb_encrypt(const void *plaintext, int len, DES_KEY * akey, unsigned char *output) { int j; const unsigned char *plain = (const unsigned char *) plaintext; for (j = 0; j < len / 8; j++) { memcpy(&output[j * 8], &plain[j * 8], 8); tds_des_encrypt(akey, &output[j * 8]); }
includes
#include <linux/init.h>
includes
#include <linux/module.h>
includes
#include <linux/errno.h>
includes
#include <linux/sched.h>
includes
#include <linux/tick.h>
includes
#include <linux/timer.h>
includes
#include <linux/device.h>
includes
#include <linux/jiffies.h>
includes
#include <linux/workqueue.h>
includes
#include <mach/hardware.h>
includes
#include <mach/pxa-regs.h>
includes
#include <mach/mspm_prof.h>
includes
#include <mach/ipmc.h>
includes
#include <mach/prm.h>
includes
#include <mach/dvfm.h>
includes
#include <mach/pxa3xx_dvfm.h>
defines
#define IDLE_WATCHDOG_MSECS 40
defines
#define MSPM_PMU_RES_NUM 6
defines
#define PXA3xx_TOP_SPEED (4) /* 624M */
defines
#define mspm_attr(_name) \
structs
struct mspm_op_stats { int op; int idle; unsigned int timestamp; unsigned int jiffies; };
structs
struct mspm_mips { int mips; int mem; int xsi; int h_thres; /* high threshold */ int l_thres; /* low threshold */ };
functions
int read_time(void) { #ifdef CONFIG_PXA_32KTIMER return OSCR4; #else return OSCR0; #endif }
functions
int mspm_calc_pmu(struct ipm_profiler_arg *arg) { ext_mem_cnt = arg->pmn0; return 0; }
functions
int calc_xsi_mem(unsigned int sum_time, int *xsi, int *mem) { int i; if (sum_time == 0) return -EINVAL; for (i = 0, *xsi = 0, *mem = 0; i < mspm_op_num; i++) { *xsi += op_duration[i] * op_mips[i].xsi; *mem += op_duration[i] * op_mips[i].mem; }
functions
int check_memstall(int mips, unsigned sum_time) { static int max_nonstall_cnt = 3, nonstall_cnt = 0; int count = 0, bandwidth = 0, stall = 0, ret = 0; int xsi = 0, mem = 0; calc_xsi_mem(sum_time, &xsi, &mem); /* 16-bit memory */ /* * At here, there's an assumption only 16-bit memory is configured. * If config...
functions
int mspm_request_tune(int mips, int memstall, int mem, int cur_op) { int i; #ifdef CONFIG_PXA3xx_DVFM_PERFORMANCE struct op_info *info = NULL; int curop = dvfm_get_op(&info); #endif /* If memory stall, disable d0csidle. Otherwise, enable it. */ if (memstall || cur_op>1) /* if cur_op>104M, disable d0cs, by frank *...
functions
else if (i < curop) { i = curop -1; }
functions
int check_idle_wd(int mips) { int mips_thres = 200, max_idle_cnt = 3; static int idle_cnt = 0; /* if mspm_watchdog isn't enabled, don't calculate */ if (!mspm_watchdog) return 0; if (mips < mips_thres) { if (idle_cnt < max_idle_cnt) { idle_cnt++; idle_wd_valid = 1; }
functions
int is_idle_wd_valid(void) { if (mspm_watchdog) return idle_wd_valid; return 0; }
functions
int mspm_calc_mips(unsigned int first_time) { int i, mips, stall, mem = 0, curop; unsigned int time, sum_time = 0, sum =0; struct op_info *info = NULL; curop = dvfm_get_op(&info); /* Store the last slot as RUN state */ time = read_time(); run_op_time[cur_stats.op] += (time > cur_stats.timestamp) ? (time - ...
functions
int mspm_add_event(int op, int cpu_idle) { unsigned int time; if (mspm_prof_state == ENABLE) { if (is_idle_wd_valid()) mod_timer(&idle_watchdog, jiffies + watchdog_jif); time = read_time(); /* sum the current sample window */ if (cpu_idle == CPU_STATE_IDLE) idle_op_time[cur_stats.op] += (time > cur...
functions
int mspm_do_new_sample(void) { /* clear previous sample window */ memset(&run_op_time, 0, sizeof(int) * MAX_OP_NUM); memset(&idle_op_time, 0, sizeof(int) * MAX_OP_NUM); /* prepare for the new sample window */ first_stats.op = cur_stats.op; first_stats.idle = cur_stats.idle; first_stats.timestamp = read_time(); ...
functions
int mspm_start_prof(void) { struct pmu_results res; struct op_info *info = NULL; /* pmu_arg.window_size stores the number of miliseconds. * window_jif stores the number of jiffies. */ memset(&pmu_arg, 0, sizeof(struct ipm_profiler_arg)); pmu_arg.flags = IPM_IDLE_PROFILER | IPM_PMU_PROFILER; pmu_arg.pmn0 = PX...
functions
int mspm_stop_prof(void) { struct pmu_results res; /* flush workqueue */ flush_scheduled_work(); if (mspm_prm_state == MSPM_PRM_COMMITED) { if (pmu_arg.flags & IPM_PMU_PROFILER) pmu_stop(&res); del_timer(&idle_prof_timer); if (is_idle_wd_valid()) del_timer(&idle_watchdog); /* try to use 624MHz if it's...
functions
int calc_pmu_res(struct pmu_results *res) { if (res == NULL) return -EINVAL; sum_pmu_res.ccnt += res->ccnt; sum_pmu_res.pmn0 += res->pmn0; sum_pmu_res.pmn1 += res->pmn1; sum_pmu_res.pmn2 += res->pmn2; sum_pmu_res.pmn3 += res->pmn3; return 0; }
functions
void down_freq_worker(void) { /* request operating point higher than D0CS */ dvfm_request_op(1); }
functions
void idle_prof_handler(unsigned long data) { struct ipm_profiler_result out_res; struct pmu_results res; if (mspm_prm_state == MSPM_PRM_COMMITED) { if (pmu_arg.flags & IPM_PMU_PROFILER) { if (!pmu_stop(&res)) calc_pmu_res(&res); pmu_start(pmu_arg.pmn0, pmu_arg.pmn1, pmu_arg.pmn2, pmu_arg.pmn3); m...
functions
void idle_watchdog_handler(unsigned long data) { struct op_info *info = NULL; struct dvfm_md_opt *md_op = NULL; int mips; if (mspm_prof_state == ENABLE) { #ifdef CONFIG_PXA3xx_DVFM int curop = dvfm_get_op(&info); md_op = (struct dvfm_md_opt *)info->op; mips = md_op->core; /* Now CPU usage is 100% in current...
functions
int mspm_prof_notifier_freq(struct notifier_block *nb, unsigned long val, void *data) { struct dvfm_freqs *freqs = (struct dvfm_freqs *)data; struct op_info *info = &(freqs->new_info); struct dvfm_md_opt *md = NULL; int cpu; if (mspm_prof_state == DISABLE) return 0; /* only delete timer and stop tick for ...
functions
int launch_mspm(void) { int ret = 0; if ((mspm_ctrl_state == DISABLE) && (mspm_ctrl == ENABLE)) { /* enable mspm control */ switch (mspm_prm_state) { case MSPM_PRM_COMMITED: mspm_idle_load(); /* check whether profiler should be launched. * At here, we check mspm_prof value. */ if (mspm_prof =...
functions
void resource_handler(prm_event event, unsigned int group_id, void *data) { switch (event) { case PRM_RES_READY: /* Resource is available to MSPM */ pr_debug("resource available to MSPM\n"); if (prm_commit_resources(mspm_prm_id, group_id)) { pr_debug("failed to commit PRM resources again\n"); mspm_prm...
functions
ssize_t mspm_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "%u\n", mspm_ctrl); }
functions
ssize_t mspm_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t len) { int data; sscanf(buf, "%u", &data); if (data) mspm_ctrl = ENABLE; else mspm_ctrl = DISABLE; pr_debug("mspm_ctrl:%d, mspm_ctrl_state:%d\n", mspm_ctrl, mspm_ctrl_state); pr_debug("mspm_prm_state:%d\n", msp...
functions
int mspm_state() { return mspm_ctrl; }
functions
void mspm_disable(void) { mspm_ctrl = 0; launch_mspm(); }
functions
void mspm_enable(void) { mspm_ctrl = 1; launch_mspm(); }
functions
ssize_t prof_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "%u\n", mspm_prof); }
functions
ssize_t prof_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t len) { int data; sscanf(buf, "%u", &data); if (data) mspm_prof = ENABLE; else mspm_prof = DISABLE; pr_debug("mspm_prof:%d, mspm_prof_state:%d\n", mspm_prof, mspm_prof_state); pr_debug("mspm_prm_state:%d\n", mspm...
functions
ssize_t mem_thres_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "%uMB/s\n", mspm_mem_thres); }
functions
ssize_t mem_thres_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t len) { sscanf(buf, "%u", &mspm_mem_thres); return len; }
functions
ssize_t window_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "%ums\n", mspm_window); }
functions
ssize_t window_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t len) { sscanf(buf, "%u", &mspm_window); return len; }
functions
ssize_t watchdog_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "%u\n", mspm_watchdog); }
functions
ssize_t watchdog_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t len) { sscanf(buf, "%u", &mspm_watchdog); if (mspm_watchdog) mod_timer(&idle_watchdog, jiffies + watchdog_jif); else del_timer(&idle_watchdog); return len; }
functions
ssize_t wtimer_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "%ums\n", mspm_wtimer); }
functions
ssize_t wtimer_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t len) { sscanf(buf, "%u", &mspm_wtimer); if (mspm_wtimer > 0) watchdog_jif = msecs_to_jiffies(mspm_wtimer); return len; }
functions
ssize_t d0cs_dbg_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return sprintf(buf, "%d\n", dvfm_d0cs_dbg_enable); }
functions
ssize_t d0cs_dbg_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t len) { sscanf(buf, "%d", &dvfm_d0cs_dbg_enable); if (dvfm_d0cs_dbg_enable) dvfm_disable_op_name("D0CS", dvfm_d0cs_dbg_dev_idx); else dvfm_enable_op_name_aync("D0CS", dvfm_d0cs_dbg_dev_idx); return len; }
functions
__init mspm_init_mips(void) { struct op_info *info = NULL; struct dvfm_md_opt *md_op = NULL; int i, ret; memset(&op_mips, 0, MAX_OP_NUM * sizeof(struct mspm_mips)); #ifdef CONFIG_PXA3xx_DVFM mspm_op_num = dvfm_op_count(); for (i = 0; i < mspm_op_num; i++) { ret = dvfm_get_opinfo(i, &info); if (ret) continu...
functions
__init mspm_prm_request(void) { int ret, i; /* open a session to access PRM COP resources */ ret = prm_open_session(PRI_IPMC, "MSPM", resource_handler, (void *)NULL); if (ret < 0) { printk(KERN_ERR "unable to open session of PMU access: %d\n", ret); return ret; }
functions
void system_suspend_timer_handler(unsigned long data) { dvfm_enable_op_name_aync("D0CS", dvfm_system_suspend_dev_idx); }
functions
int system_suspend_notify(struct notifier_block *self, unsigned long action, void *data) { if (action==PM_SUSPEND_PREPARE) dvfm_disable_op_name("D0CS", dvfm_system_suspend_dev_idx); else if (action==PM_POST_SUSPEND) mod_timer(&system_suspend_timer, jiffies+HZ*2); return 0; }
functions
__exit mspm_prm_release(void) { /* release all resources in group 0 */ prm_free_resources(mspm_prm_id, 0); prm_close_session(mspm_prm_id); mspm_prm_state = MSPM_PRM_FREE; }
functions
__init mspm_prof_init(void) { if (!cpu_is_pxa3xx()) return -EFAULT; if (sysfs_create_group(power_kobj, &attr_group)) return -EFAULT; mspm_prm_request(); /* It's used to trigger sample window. * If system is idle, the timer could be deferred. */ init_timer_deferrable(&idle_prof_timer); idle_prof_timer.f...
functions
__exit mspm_prof_exit(void) { dvfm_unregister("MSPM PROF", &dvfm_dev_idx); dvfm_unregister_notifier(&notifier_freq_block, DVFM_FREQUENCY_NOTIFIER); mspm_prm_release(); }
includes
#include <stddef.h>