type
stringclasses
5 values
content
stringlengths
9
163k
defines
#define SBO_TIME 10000
defines
#define SBO_CNT 10
functions
void suspend_backoff(void) { pr_info("suspend: too many immediate wakeups, back off\n"); wake_lock_timeout(&suspend_backoff_lock, msecs_to_jiffies(SBO_TIME)); }
functions
void try_to_suspend(struct work_struct *work) { unsigned int initial_count, final_count; struct timespec ts_entry, ts_exit; u64 elapsed_msecs64; u32 elapsed_msecs32; if (!pm_get_wakeup_count(&initial_count, true)) goto out; mutex_lock(&autosleep_lock); if (!pm_save_wakeup_count(initial_count)) { mutex_unl...
functions
void queue_up_suspend_work(void) { if (!work_pending(&suspend_work) && autosleep_state > PM_SUSPEND_ON) queue_work(autosleep_wq, &suspend_work); }
functions
suspend_state_t pm_autosleep_state(void) { return autosleep_state; }
functions
int pm_autosleep_lock(void) { return mutex_lock_interruptible(&autosleep_lock); }
functions
void pm_autosleep_unlock(void) { mutex_unlock(&autosleep_lock); }
functions
int pm_autosleep_set_state(suspend_state_t state) { #ifndef CONFIG_HIBERNATION if (state >= PM_SUSPEND_MAX) return -EINVAL; #endif __pm_stay_awake(autosleep_ws); mutex_lock(&autosleep_lock); autosleep_state = state; __pm_relax(autosleep_ws); if (state > PM_SUSPEND_ON) { pm_wakep_autosleep_enabled(true);...
functions
__init pm_autosleep_init(void) { autosleep_ws = wakeup_source_register("autosleep"); if (!autosleep_ws) return -ENOMEM; wake_lock_init(&suspend_backoff_lock, WAKE_LOCK_SUSPEND, "suspend_backoff"); autosleep_wq = alloc_ordered_workqueue("autosleep", 0); if (autosleep_wq) return 0; wake_lock_destroy(&suspe...
defines
#define READ_PIXELS(a, b, c) \
defines
#define V210DEC_FLAGS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
functions
void v210_planar_unpack_c(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width) { uint32_t val; int i; for( i = 0; i < width-5; i += 6 ){ READ_PIXELS(u, y, v); READ_PIXELS(y, u, y); READ_PIXELS(v, y, u); READ_PIXELS(y, v, y); }
functions
int decode_init(AVCodecContext *avctx) { V210DecContext *s = avctx->priv_data; if (avctx->width & 1) { av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n"); return -1; }
functions
int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { V210DecContext *s = avctx->priv_data; int h, w, stride, aligned_input; AVFrame *pic = avctx->coded_frame; const uint8_t *psrc = avpkt->data; uint16_t *y, *u, *v; if (s->custom_stride ...
functions
int decode_close(AVCodecContext *avctx) { AVFrame *pic = avctx->coded_frame; if (pic->data[0]) avctx->release_buffer(avctx, pic); av_freep(&avctx->coded_frame); return 0; }
defines
#define partstNUM_LEDs 4
functions
void vParTestInitialise( void ) { /* Enable signals as GPIO */ MCF_GPIO_PTCPAR = 0 | MCF_GPIO_PTCPAR_DTIN3_GPIO | MCF_GPIO_PTCPAR_DTIN2_GPIO | MCF_GPIO_PTCPAR_DTIN1_GPIO | MCF_GPIO_PTCPAR_DTIN0_GPIO; /* Enable signals as digital outputs */ MCF_GPIO_DDRTC = 0 ...
functions
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ) { unsigned portBASE_TYPE uxLEDMask; if( uxLED < partstNUM_LEDs ) { uxLEDMask = 1UL << uxLED; taskENTER_CRITICAL(); { if( xValue ) { MCF_GPIO_PORTTC |= uxLEDMask; }
functions
void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) { unsigned portBASE_TYPE uxLEDMask; if( uxLED < partstNUM_LEDs ) { uxLEDMask = 1UL << uxLED; taskENTER_CRITICAL(); { if( MCF_GPIO_PORTTC & uxLEDMask ) { MCF_GPIO_PORTTC &= ~uxLEDMask; }
includes
#include <epan/packet.h>
includes
#include <epan/prefs.h>
includes
#include <epan/strutil.h>
includes
#include <epan/asn1.h>
defines
#define PNAME "UTRAN Iupc interface Positioning Calculation Application Part (PCAP)"
defines
#define PSNAME "PCAP"
defines
#define PFNAME "pcap"
defines
#define MAX_SSN 254
functions
int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { return (dissector_try_uint(pcap_ies_dissector_table, ProtocolIE_ID, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; }
functions
int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { return (dissector_try_uint(pcap_extension_dissector_table, ProtocolIE_ID, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; }
functions
int dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { return (dissector_try_uint(pcap_proc_imsg_dissector_table, ProcedureCode, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; }
functions
int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { return (dissector_try_uint(pcap_proc_sout_dissector_table, ProcedureCode, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; }
functions
int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { return (dissector_try_uint(pcap_proc_uout_dissector_table, ProcedureCode, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; }
functions
int dissect_OutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { return (dissector_try_uint(pcap_proc_out_dissector_table, ProcedureCode, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; }
functions
int dissect_pcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { proto_item *pcap_item = NULL; proto_tree *pcap_tree = NULL; /* make entry in the Protocol column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "PCAP"); /* create the pcap protocol tree */ pcap_item = proto_tr...
functions
void proto_reg_handoff_pcap(void) { static gboolean prefs_initialized = FALSE; static range_t *ssn_range; if (! prefs_initialized) { sccp_ssn_table = find_dissector_table("sccp.ssn"); prefs_initialized = TRUE; #include "packet-pcap-dis-tab.c" }
functions
void proto_register_pcap(void) { /* List of fields */ static hf_register_info hf[] = { #include "packet-pcap-hfarr.c" }
defines
#define TIMEOUT_VALUE 1000
defines
#define TWI_IDX(obj) ((obj)->i2c.twi_idx)
defines
#define TWI_IDX(obj) ((obj)->twi_idx)
defines
#define TWI_INFO(obj) (&m_twi_info[TWI_IDX(obj)])
defines
#define TWI0_INSTANCE_INDEX 0
defines
#define TWI1_INSTANCE_INDEX TWI0_INSTANCE_INDEX+TWI0_ENABLED
defines
#define TWI_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
defines
#define TWI_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST
functions
void start_asynch_rx(twi_info_t *twi_info, NRF_TWI_Type *twi) { if (twi_info->rx_length == 1 && twi_info->stop) { nrf_twi_shorts_set(twi, NRF_TWI_SHORT_BB_STOP_MASK); }
functions
void twi_irq_handler(uint8_t instance_idx) { twi_info_t *twi_info = &m_twi_info[instance_idx]; NRF_TWI_Type *twi = m_twi_instances[instance_idx]; if (nrf_twi_event_check(twi, NRF_TWI_EVENT_ERROR)) { nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); // In case of an error, force STOP. ...
functions
else if (twi_info->rx_length > 0) { start_asynch_rx(twi_info, twi); // If there is nothing more to do, finalize the transfer. }
functions
void irq_handler_twi0(void) { twi_irq_handler(TWI0_INSTANCE_INDEX); }
functions
void irq_handler_twi1(void) { twi_irq_handler(TWI1_INSTANCE_INDEX); }
functions
void configure_twi_pin(uint32_t pin, nrf_gpio_pin_dir_t dir) { nrf_gpio_cfg(pin, dir, NRF_GPIO_PIN_INPUT_CONNECT, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_S0D1, NRF_GPIO_PIN_NOSENSE); }
functions
void twi_clear_bus(twi_info_t *twi_info) { // Try to set SDA high, and check if no slave tries to drive it low. nrf_gpio_pin_set(twi_info->pselsda); configure_twi_pin(twi_info->pselsda, NRF_GPIO_PIN_DIR_OUTPUT); // In case SDA is low, make up to 9 cycles on SCL line to help the slave // that pulls S...
functions
void i2c_init(i2c_t *obj, PinName sda, PinName scl) { int i; for (i = 0; i < TWI_COUNT; ++i) { if (m_twi_info[i].initialized && m_twi_info[i].pselsda == (uint32_t)sda && m_twi_info[i].pselscl == (uint32_t)scl) { TWI_IDX(obj) = i; TWI_INFO(obj)->frequency =...
functions
void i2c_reset(i2c_t *obj) { twi_info_t *twi_info = TWI_INFO(obj); NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; nrf_twi_disable(twi); nrf_twi_pins_set(twi, twi_info->pselscl, twi_info->pselsda); nrf_twi_frequency_set(twi, twi_info->frequency); nrf_twi_enable(twi); }
functions
int i2c_start(i2c_t *obj) { twi_info_t *twi_info = TWI_INFO(obj); #if DEVICE_I2C_ASYNCH if (twi_info->active) { return I2C_ERROR_BUS_BUSY; }
functions
int i2c_stop(i2c_t *obj) { NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; // The current transfer may be suspended (if it is RX), so it must be // resumed before the STOP task is triggered. nrf_twi_task_trigger(twi, NRF_TWI_TASK_RESUME); nrf_twi_task_trigger(twi, NRF_TWI_TASK_STOP); uint32_...
functions
void i2c_frequency(i2c_t *obj, int hz) { twi_info_t *twi_info = TWI_INFO(obj); NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; if (hz < 250000) { twi_info->frequency = NRF_TWI_FREQ_100K; }
functions
else if (hz < 400000) { twi_info->frequency = NRF_TWI_FREQ_250K; }
functions
uint8_t twi_address(int i2c_address) { // The TWI peripheral requires 7-bit slave address (without R/W bit). return (i2c_address >> 1); }
functions
void start_twi_read(NRF_TWI_Type *twi, int address) { nrf_twi_event_clear(twi, NRF_TWI_EVENT_STOPPED); nrf_twi_event_clear(twi, NRF_TWI_EVENT_RXDREADY); nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); (void)nrf_twi_errorsrc_get_and_clear(twi); nrf_twi_shorts_set(twi, NRF_TWI_SHORT_BB_SUSPEND_MASK); ...
functions
int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) { // Zero-length RX transfers are not supported. Such transfers cannot // be easily achieved with TWI peripheral (some dirty tricks would be // required for this), and they are actually useless (TX can be used // to check if the add...
functions
uint8_t twi_byte_write(NRF_TWI_Type *twi, uint8_t data) { nrf_twi_event_clear(twi, NRF_TWI_EVENT_TXDSENT); nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); nrf_twi_txd_set(twi, data); uint32_t remaining_time = TIMEOUT_VALUE; do { if (nrf_twi_event_check(twi, NRF_TWI_EVENT_TXDSENT)) { ...
functions
void start_twi_write(NRF_TWI_Type *twi, int address) { nrf_twi_event_clear(twi, NRF_TWI_EVENT_STOPPED); nrf_twi_event_clear(twi, NRF_TWI_EVENT_TXDSENT); nrf_twi_event_clear(twi, NRF_TWI_EVENT_ERROR); (void)nrf_twi_errorsrc_get_and_clear(twi); nrf_twi_shorts_set(twi, 0); nrf_twi_address_set(twi...
functions
int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) { twi_info_t *twi_info = TWI_INFO(obj); #if DEVICE_I2C_ASYNCH if (twi_info->active) { return I2C_ERROR_BUS_BUSY; }
functions
int i2c_byte_read(i2c_t *obj, int last) { NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; if (last) { nrf_twi_shorts_set(twi, NRF_TWI_SHORT_BB_STOP_MASK); }
functions
int i2c_byte_write(i2c_t *obj, int data) { NRF_TWI_Type *twi = m_twi_instances[TWI_IDX(obj)]; twi_info_t *twi_info = TWI_INFO(obj); if (twi_info->start_twi) { twi_info->start_twi = false; if (data & 1) { start_twi_read(twi, data); }
functions
void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, void *rx, size_t rx_length, uint32_t address, uint32_t stop, uint32_t handler, uint32_t event, DMAUsage hint) { (void)hint; twi_info_t *twi_info = TWI_INFO(obj); ...
functions
else if (rx_length > 0) { start_asynch_rx(twi_info, twi); // Both 'tx_length' and 'rx_length' are 0 - this case may be used // to test if the slave is presentand ready for transfer (by just // sending the address and checking if it is acknowledged). }
functions
uint32_t i2c_irq_handler_asynch(i2c_t *obj) { twi_info_t *twi_info = TWI_INFO(obj); return (twi_info->events & twi_info->evt_mask); }
functions
uint8_t i2c_active(i2c_t *obj) { twi_info_t *twi_info = TWI_INFO(obj); return twi_info->active; }
functions
void i2c_abort_asynch(i2c_t *obj) { i2c_reset(obj); }
includes
#include <sys/cdefs.h>
functions
float remquof(float x, float y, int *quo) { int32_t n,hx,hy,hz,ix,iy,sx,i; u_int32_t q,sxy; GET_FLOAT_WORD(hx,x); GET_FLOAT_WORD(hy,y); sxy = (hx ^ hy) & 0x80000000; sx = hx&0x80000000; /* sign of x */ hx ^=sx; /* |x| */ hy &= 0x7fffffff; /* |y| */ /* purge off exception values */ if(hy==0||hx>=0x7f800...
functions
else if(hx==hy) { *quo = (sxy ? -1 : 1); return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/ }
includes
#include <errno.h>
includes
#include <sys/socket.h>
includes
#include <net/sock.h>
structs
struct unix_sock { /* sk has to be the first member */ struct sock sk; };
functions
int supported_sock_type(struct socket *sock) { switch (sock->type) { default: return -ESOCKTNOSUPPORT; case SOCK_STREAM: sock->ops = &unix_stream_ops; break; case SOCK_RAW: sock->type = SOCK_DGRAM; case SOCK_DGRAM: sock->ops = &unix_dgram_ops; break; case SOCK_SEQPACKET: sock->ops = &unix_seqpacket_...
functions
int unix_create(struct socket *sock, int type, int protocol) { int res; struct sock *sk; res = supported_sock_type(sock); if (res < 0) { return res; }
includes
#include <stdarg.h>
includes
#include <stdlib.h>
includes
#include <stdio.h>
includes
#include <string.h>
defines
#define NLINES 2
defines
#define MAX_LINE_SIZE 512
defines
#define NUMBER_OF_STARS 80
functions
int UpnpInitLog(void) { ithread_mutex_init(&GlobalDebugMutex, NULL); if (DEBUG_TARGET == 1) { if ((ErrFileHnd = fopen(errFileName, "a")) == NULL) { return -1; }
functions
void UpnpSetLogLevel(Upnp_LogLevel log_level) { g_log_level = log_level; }
functions
void UpnpCloseLog(void) { if (DEBUG_TARGET == 1) { fflush(ErrFileHnd); fflush(InfoFileHnd); fclose(ErrFileHnd); fclose(InfoFileHnd); }
functions
void UpnpSetLogFileNames(const char *ErrFileName, const char *InfoFileName) { if (ErrFileName) { errFileName = ErrFileName; }
functions
int DebugAtThisLevel(Upnp_LogLevel DLevel, Dbg_Module Module) { int ret = DLevel <= g_log_level; ret &= DEBUG_ALL || (Module == SSDP && DEBUG_SSDP) || (Module == SOAP && DEBUG_SOAP) || (Module == GENA && DEBUG_GENA) || (Module == TPOOL && DEBUG_TPOOL) || (Module == MSERV && DEBUG_MSERV) ...
functions
void UpnpPrintf(Upnp_LogLevel DLevel, Dbg_Module Module, const char *DbgFileName, int DbgLineNo, const char *FmtStr, ...) { va_list ArgList; if (!DebugAtThisLevel(DLevel, Module)) return; ithread_mutex_lock(&GlobalDebugMutex); va_start(ArgList, FmtStr); if (!DEBUG_TARGET) { if (DbgFileName) UpnpDisplay...
functions
else if (DLevel == 0) { if (DbgFileName) UpnpDisplayFileAndLine(ErrFileHnd, DbgFileName, DbgLineNo); vfprintf(ErrFileHnd, FmtStr, ArgList); fflush(ErrFileHnd); }
functions
void UpnpDisplayFileAndLine(FILE *fd, const char *DbgFileName, int DbgLineNo) { const char *lines[NLINES]; char buf[NLINES][MAX_LINE_SIZE]; int i; /* Initialize the pointer array */ for (i = 0; i < NLINES; i++) lines[i] = buf[i]; /* Put the debug lines in the buffer */ sprintf(buf[0], "DEBUG - THREAD ID: 0...
functions
void UpnpDisplayBanner(FILE * fd, const char **lines, size_t size, size_t starLength) { size_t leftMarginLength = starLength / 2 + 1; size_t rightMarginLength = starLength / 2 + 1; size_t i = 0; size_t LineSize = 0; size_t starLengthMinus2 = starLength - 2; char *leftMargin = malloc(leftMarginLength); ...
includes
#include <stdint.h>
defines
#define MENU_NUMBER_OF_MENU_ITEMS (35) //!< Declaration of number of items in the DB101 menu.
includes
#include <linux/ihex.h>
defines
#define PRISM2_USB_FWFILE "prism2_ru.fw"