docstring stringlengths 22 576 | signature stringlengths 9 317 | prompt stringlengths 57 886 | code stringlengths 20 1.36k | repository stringclasses 49
values | language stringclasses 2
values | license stringclasses 9
values | stars int64 15 21.3k |
|---|---|---|---|---|---|---|---|
/* Routine: pinmux_init Description: Do individual peripheral pinmux configs */ | void pinmux_init(void) | /* Routine: pinmux_init Description: Do individual peripheral pinmux configs */
void pinmux_init(void) | {
pinmux_config_pingrp_table(tegra3_pinmux_common,
ARRAY_SIZE(tegra3_pinmux_common));
pinmux_config_pingrp_table(unused_pins_lowpower,
ARRAY_SIZE(unused_pins_lowpower));
pinmux_config_drvgrp_table(cardhu_padctrl, ARRAY_SIZE(cardhu_padctrl));
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Adds one USB MIDI packet to the output buffer. */ | static void snd_usbmidi_output_standard_packet(struct urb *urb, uint8_t p0, uint8_t p1, uint8_t p2, uint8_t p3) | /* Adds one USB MIDI packet to the output buffer. */
static void snd_usbmidi_output_standard_packet(struct urb *urb, uint8_t p0, uint8_t p1, uint8_t p2, uint8_t p3) | {
uint8_t* buf = (uint8_t*)urb->transfer_buffer + urb->transfer_buffer_length;
buf[0] = p0;
buf[1] = p1;
buf[2] = p2;
buf[3] = p3;
urb->transfer_buffer_length += 4;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Accumulate the BAR type of a virtio-1.0 register block into a UINT64 attribute map, such that the latter is suitable for enabling IO / MMIO decoding with EFI_PCI_IO_PROTOCOL.Attributes(). */ | STATIC VOID UpdateAttributes(IN VIRTIO_1_0_CONFIG *Config, IN OUT UINT64 *Attributes) | /* Accumulate the BAR type of a virtio-1.0 register block into a UINT64 attribute map, such that the latter is suitable for enabling IO / MMIO decoding with EFI_PCI_IO_PROTOCOL.Attributes(). */
STATIC VOID UpdateAttributes(IN VIRTIO_1_0_CONFIG *Config, IN OUT UINT64 *Attributes) | {
if (Config->Exists) {
*Attributes |= (Config->BarType == Virtio10BarTypeMem) ?
EFI_PCI_IO_ATTRIBUTE_MEMORY :
EFI_PCI_IO_ATTRIBUTE_IO;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Handle received frame interrupt.
This function handles transceiver interrupts for received frames and uploads the frames from the trx. */ | static void handle_received_frame_irq(void) | /* Handle received frame interrupt.
This function handles transceiver interrupts for received frames and uploads the frames from the trx. */
static void handle_received_frame_irq(void) | {
uint8_t phy_frame_len;
uint8_t *rx_frame_ptr = at86rfx_rx_buffer;
if (CRC16_NOT_VALID == pal_trx_bit_read(SR_RX_CRC_VALID)) {
return;
}
pal_trx_frame_read(&phy_frame_len, LENGTH_FIELD_LEN);
if (phy_frame_len > PHY_MAX_LENGTH) {
return;
}
pal_trx_frame_read(rx_frame_ptr, LENGTH_FIELD_LEN + phy_frame_len);
at86rfx_frame_rx = true;
set_trx_state(CMD_RX_ON);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* The function is used to enable the HFIRC auto trim interrupt. */ | void SysCtlHFIRCTrimIntEnable(xtBoolean bEnable, unsigned char ulTrimInt) | /* The function is used to enable the HFIRC auto trim interrupt. */
void SysCtlHFIRCTrimIntEnable(xtBoolean bEnable, unsigned char ulTrimInt) | {
xASSERT((ulTrimInt == SYSCTL_TRIM_32K_ERR_IEN) ||
(ulTrimInt == SYSCTL_TRIM_32K_FAIL_IEN));
if(bEnable)
{
xHWREG(GCR_IRCTRIMIEN) |= ulTrimInt;
}
else
{
xHWREG(GCR_IRCTRIMIEN) &= ~ulTrimInt;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Given an address of a host physical page, turn it into a valid gart entry. */ | static unsigned long sgi_tioca_mask_memory(struct agp_bridge_data *bridge, dma_addr_t addr, int type) | /* Given an address of a host physical page, turn it into a valid gart entry. */
static unsigned long sgi_tioca_mask_memory(struct agp_bridge_data *bridge, dma_addr_t addr, int type) | {
return tioca_physpage_to_gart(addr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Send a 12-byte CE message and DMA data to the primary partition VSP object */ | static int dma_and_signal_ce_msg(char *ce_msg, struct ce_msg_comp_data *completion, void *dma_data, unsigned dma_data_length, unsigned remote_address) | /* Send a 12-byte CE message and DMA data to the primary partition VSP object */
static int dma_and_signal_ce_msg(char *ce_msg, struct ce_msg_comp_data *completion, void *dma_data, unsigned dma_data_length, unsigned remote_address) | {
struct pending_event *ev = new_pending_event();
if (ev == NULL)
return -ENOMEM;
ev->event.hp_lp_event.xSubtype = 0;
ev->event.hp_lp_event.x.xSubtypeData =
subtype_data('M', 'F', 'C', 'E');
memcpy(ev->event.data.ce_msg.ce_msg, ce_msg, 12);
ev->event.data.ce_msg.completion = completion;
memcpy(ev->dma_data, dma_data, dma_data_length);
ev->dma_data_length = dma_data_length;
ev->remote_address = remote_address;
return signal_event(ev);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Searches an option list for an option with the given name */ | QEMUOptionParameter* get_option_parameter(QEMUOptionParameter *list, const char *name) | /* Searches an option list for an option with the given name */
QEMUOptionParameter* get_option_parameter(QEMUOptionParameter *list, const char *name) | {
while (list && list->name) {
if (!strcmp(list->name, name)) {
return list;
}
list++;
}
return NULL;
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Start the Mtftp6 instance to download. It first initializes some of the internal states, then builds and sends an RRQ request packet. Finally, it starts receive for the downloading. */ | EFI_STATUS Mtftp6RrqStart(IN MTFTP6_INSTANCE *Instance, IN UINT16 Operation) | /* Start the Mtftp6 instance to download. It first initializes some of the internal states, then builds and sends an RRQ request packet. Finally, it starts receive for the downloading. */
EFI_STATUS Mtftp6RrqStart(IN MTFTP6_INSTANCE *Instance, IN UINT16 Operation) | {
EFI_STATUS Status;
Status = Mtftp6InitBlockRange (&Instance->BlkList, 1, 0xffff);
if (EFI_ERROR (Status)) {
return Status;
}
Status = Mtftp6SendRequest (Instance, Operation);
if (EFI_ERROR (Status)) {
return Status;
}
return UdpIoRecvDatagram (
Instance->UdpIo,
Mtftp6RrqInput,
Instance,
0
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Arguments: CH - channel executing the instruction OPCODE - opcode ARGS - array of 8-bit arguments LEN - number of elements in ARGS array */ | static void pl330_dmaadxh(PL330Chan *ch, uint8_t *args, bool ra, bool neg) | /* Arguments: CH - channel executing the instruction OPCODE - opcode ARGS - array of 8-bit arguments LEN - number of elements in ARGS array */
static void pl330_dmaadxh(PL330Chan *ch, uint8_t *args, bool ra, bool neg) | {
uint32_t im = (args[1] << 8) | args[0];
if (neg) {
im |= 0xffffu << 16;
}
if (ch->is_manager) {
pl330_fault(ch, PL330_FAULT_UNDEF_INSTR);
return;
}
if (ra) {
ch->dst += im;
} else {
ch->src += im;
}
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* decode event and send MIDI bytes to read queue */ | static int send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, struct seq_oss_midi *mdev) | /* decode event and send MIDI bytes to read queue */
static int send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev, struct seq_oss_midi *mdev) | {
char msg[32];
int len;
snd_seq_oss_readq_put_timestamp(dp->readq, ev->time.tick, dp->seq_mode);
if (!dp->timer->running)
len = snd_seq_oss_timer_start(dp->timer);
if (ev->type == SNDRV_SEQ_EVENT_SYSEX) {
if ((ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
snd_seq_oss_readq_puts(dp->readq, mdev->seq_device,
ev->data.ext.ptr, ev->data.ext.len);
} else {
len = snd_midi_event_decode(mdev->coder, msg, sizeof(msg), ev);
if (len > 0)
snd_seq_oss_readq_puts(dp->readq, mdev->seq_device, msg, len);
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check the status of the Rx buffer of the specified SPI port. */ | xtBoolean SPIIsRxEmpty(unsigned long ulBase) | /* Check the status of the Rx buffer of the specified SPI port. */
xtBoolean SPIIsRxEmpty(unsigned long ulBase) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_RX_EMPTY)? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Releases all references of the configuration and frees up the memory. */ | void textsearch_destroy(struct ts_config *conf) | /* Releases all references of the configuration and frees up the memory. */
void textsearch_destroy(struct ts_config *conf) | {
if (conf->ops) {
if (conf->ops->destroy)
conf->ops->destroy(conf);
module_put(conf->ops->owner);
}
kfree(conf);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This file is part of the Simba project. */ | int test_init(void) | /* This file is part of the Simba project. */
int test_init(void) | {
BTASSERT(re_module_init() == 0);
BTASSERT(re_module_init() == 0);
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* If there is a pid at nr this function is exactly the same as find_pid_ns. */ | struct pid* find_ge_pid(int nr, struct pid_namespace *ns) | /* If there is a pid at nr this function is exactly the same as find_pid_ns. */
struct pid* find_ge_pid(int nr, struct pid_namespace *ns) | {
struct pid *pid;
do {
pid = find_pid_ns(nr, ns);
if (pid)
break;
nr = next_pidmap(ns, nr);
} while (nr > 0);
return pid;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The pid hash table is scaled according to the amount of memory in the machine. From a minimum of 16 slots up to 4096 slots at one gigabyte or more. */ | void __init pidhash_init(void) | /* The pid hash table is scaled according to the amount of memory in the machine. From a minimum of 16 slots up to 4096 slots at one gigabyte or more. */
void __init pidhash_init(void) | {
int i, pidhash_size;
pid_hash = alloc_large_system_hash("PID", sizeof(*pid_hash), 0, 18,
HASH_EARLY | HASH_SMALL,
&pidhash_shift, NULL, 4096);
pidhash_size = 1 << pidhash_shift;
for (i = 0; i < pidhash_size; i++)
INIT_HLIST_HEAD(&pid_hash[i]);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* write_carry sets the carry bits in MSR based on bit 0 of v. v are ignored. */ | static void write_carry(DisasContext *dc, TCGv v) | /* write_carry sets the carry bits in MSR based on bit 0 of v. v are ignored. */
static void write_carry(DisasContext *dc, TCGv v) | {
TCGv t0 = tcg_temp_new();
tcg_gen_shli_tl(t0, v, 31);
tcg_gen_sari_tl(t0, t0, 31);
tcg_gen_andi_tl(t0, t0, (MSR_C | MSR_CC));
tcg_gen_andi_tl(cpu_SR[SR_MSR], cpu_SR[SR_MSR],
~(MSR_C | MSR_CC));
tcg_gen_or_tl(cpu_SR[SR_MSR], cpu_SR[SR_MSR], t0);
tcg_temp_free(t0);
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Return protocol attributes of the performance management protocol. */ | STATIC EFI_STATUS PerformanceGetAttributes(IN SCMI_PERFORMANCE_PROTOCOL *This, OUT SCMI_PERFORMANCE_PROTOCOL_ATTRIBUTES *Attributes) | /* Return protocol attributes of the performance management protocol. */
STATIC EFI_STATUS PerformanceGetAttributes(IN SCMI_PERFORMANCE_PROTOCOL *This, OUT SCMI_PERFORMANCE_PROTOCOL_ATTRIBUTES *Attributes) | {
EFI_STATUS Status;
UINT32 *ReturnValues;
Status = ScmiGetProtocolAttributes (
ScmiProtocolIdPerformance,
&ReturnValues
);
if (EFI_ERROR (Status)) {
return Status;
}
CopyMem (
Attributes,
ReturnValues,
sizeof (SCMI_PERFORMANCE_PROTOCOL_ATTRIBUTES)
);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* 10. CTS permission No data 10. LSA Identifier 3GPP TS 24.008 version 6.8.0 Release 6 */ | static guint16 de_lsa_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) | /* 10. CTS permission No data 10. LSA Identifier 3GPP TS 24.008 version 6.8.0 Release 6 */
static guint16 de_lsa_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) | {
guint32 curr_offset;
curr_offset = offset;
if (len == 0) {
proto_tree_add_uint_format_value(tree, hf_gsm_a_dtap_lsa_id, tvb, curr_offset, len, 0, "not included");
}
else
{
proto_tree_add_item(tree, hf_gsm_a_dtap_lsa_id, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
}
curr_offset += len;
EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_dtap_extraneous_data);
return (curr_offset - offset);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* param base FlexIO I2S peripheral base address. param handle FlexIO I2S DMA handle pointer. */ | void FLEXIO_I2S_TransferAbortSendEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle) | /* param base FlexIO I2S peripheral base address. param handle FlexIO I2S DMA handle pointer. */
void FLEXIO_I2S_TransferAbortSendEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle) | {
assert(handle != NULL);
EDMA_AbortTransfer(handle->dmaHandle);
FLEXIO_I2S_TxEnableDMA(base, false);
handle->state = (uint32_t)kFLEXIO_I2S_Idle;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* 9.5.8 Request PDP context activation reject Direction: MS to network */ | static void dtap_sm_req_pdp_act_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) | /* 9.5.8 Request PDP context activation reject Direction: MS to network */
static void dtap_sm_req_pdp_act_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) | {
guint32 curr_offset;
guint32 consumed;
guint curr_len;
curr_offset = offset;
curr_len = len;
pinfo->p2p_dir = P2P_DIR_UNKNOWN;
pinfo->link_dir = P2P_DIR_UL;
ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL);
ELEM_OPT_TLV( 0x27, GSM_A_PDU_TYPE_GM, DE_PRO_CONF_OPT, NULL);
ELEM_OPT_TLV(0x33, GSM_A_PDU_TYPE_GM, DE_NBIFOM_CONT, NULL);
EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extraneous_data);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* save_flags() is expected to return the processor state (ie. "flags"). The flags word contains all kind of stuff, but in practice Linux only cares about the interrupt flag. Our "save_flags()" just returns that. */ | static unsigned long save_fl(void) | /* save_flags() is expected to return the processor state (ie. "flags"). The flags word contains all kind of stuff, but in practice Linux only cares about the interrupt flag. Our "save_flags()" just returns that. */
static unsigned long save_fl(void) | {
return lguest_data.irq_enabled;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set keyboard focus window or NULL, i.e., receiver of keyboard events.
This function changes the keyboard focus window. The current keyboard focus window is sent a LOSEFOCUS event, and the new focus window is sent a GETFOCUS event. The keyboard focus window will receive all keyboard events. Set the focus window to NULL to remove the focus. */ | void win_set_keyboard_focus(struct win_window *win) | /* Set keyboard focus window or NULL, i.e., receiver of keyboard events.
This function changes the keyboard focus window. The current keyboard focus window is sent a LOSEFOCUS event, and the new focus window is sent a GETFOCUS event. The keyboard focus window will receive all keyboard events. Set the focus window to NULL to remove the focus. */
void win_set_keyboard_focus(struct win_window *win) | {
if (win_keyboard_focus != NULL) {
win_handle_event(win_keyboard_focus, WIN_EVENT_LOSEFOCUS, NULL);
}
win_keyboard_focus = win;
win_handle_event(win, WIN_EVENT_GETFOCUS, NULL);
} | memfault/zero-to-main | C++ | null | 200 |
/* Disable clock specific peripherals.
Disable source clock pheripheral */ | void DisableSourceClk(CLKSRC_Type src_clk) | /* Disable clock specific peripherals.
Disable source clock pheripheral */
void DisableSourceClk(CLKSRC_Type src_clk) | {
uint32_t i=0;
const uint32_t PlainEnable = (0x2 << 3);
if(src_clk == SRC_OSC32K)
{
LPC_CREG->CREG0 &= ~((1<<1)|(1<<0));
LPC_CREG->CREG0 |= ((1<<3)|(1<<2));
}
if(src_clk == SRC_ENET_RX_CLK)scu_pinmux(0xC ,0 , PlainEnable, FUNC0);
if(src_clk == SRC_ENET_TX_CLK)scu_pinmux(0x1 ,19, PlainEnable, FUNC2);
if(src_clk == SRC_XTAL)
{
LPC_CGU->XTAL_OSC_CTRL = (1<<0);
for(i=0;i<0xFFFF;i++);
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* This function is called when user wants to close the socket. */ | static int winc1500_put(struct net_context *context) | /* This function is called when user wants to close the socket. */
static int winc1500_put(struct net_context *context) | {
SOCKET sock = (int) context->offload_context;
struct socket_data *sd = &w1500_data.socket_data[sock];
int ret;
memset(&(context->remote), 0, sizeof(struct sockaddr_in));
context->flags &= ~NET_CONTEXT_REMOTE_ADDR_SET;
ret = winc1500_close(sock);
net_pkt_unref(sd->rx_pkt);
memset(sd, 0, sizeof(struct socket_data));
return ret;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Callers are responsible for ensuring the channel is inactive, and will not be reactivated by linking, chaining, or software calls to edma_start(). */ | void edma_free_channel(unsigned channel) | /* Callers are responsible for ensuring the channel is inactive, and will not be reactivated by linking, chaining, or software calls to edma_start(). */
void edma_free_channel(unsigned channel) | {
unsigned ctlr;
ctlr = EDMA_CTLR(channel);
channel = EDMA_CHAN_SLOT(channel);
if (channel >= edma_cc[ctlr]->num_channels)
return;
setup_dma_interrupt(channel, RT_NULL, RT_NULL);
rt_memcpy((void *)(edmacc_regs_base[ctlr] + PARM_OFFSET(channel)),
&dummy_paramset, PARM_SIZE);
clear_bit(channel, edma_cc[ctlr]->edma_inuse);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* match_parisc_device - Matches a parisc device against a given hardware path entry. @dev: the generic device (known to be contained by a parisc_device). @index: the current BC index @modpath: the hardware path. */ | static int match_parisc_device(struct device *dev, int index, struct hardware_path *modpath) | /* match_parisc_device - Matches a parisc device against a given hardware path entry. @dev: the generic device (known to be contained by a parisc_device). @index: the current BC index @modpath: the hardware path. */
static int match_parisc_device(struct device *dev, int index, struct hardware_path *modpath) | {
struct parisc_device *curr = to_parisc_device(dev);
char id = (index == 6) ? modpath->mod : modpath->bc[index];
return (curr->hw_path == id);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If we were asked to do hardware stamping and such a time stamp is available, then it must have been for this skb here because we only allow only one such packet into the queue. */ | static void igb_tx_hwtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb) | /* If we were asked to do hardware stamping and such a time stamp is available, then it must have been for this skb here because we only allow only one such packet into the queue. */
static void igb_tx_hwtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb) | {
struct igb_adapter *adapter = q_vector->adapter;
union skb_shared_tx *shtx = skb_tx(skb);
struct e1000_hw *hw = &adapter->hw;
struct skb_shared_hwtstamps shhwtstamps;
u64 regval;
if (likely(!shtx->hardware) ||
!(rd32(E1000_TSYNCTXCTL) & E1000_TSYNCTXCTL_VALID))
return;
regval = rd32(E1000_TXSTMPL);
regval |= (u64)rd32(E1000_TXSTMPH) << 32;
igb_systim_to_hwtstamp(adapter, &shhwtstamps, regval);
skb_tstamp_tx(skb, &shhwtstamps);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function configures the TIM1 as a time base source. The time source is configured to have 1ms time base with a dedicated Tick interrupt priority. */ | HAL_StatusTypeDef HAL_InitTick([[maybe_unused]] uint32_t TickPriority) | /* This function configures the TIM1 as a time base source. The time source is configured to have 1ms time base with a dedicated Tick interrupt priority. */
HAL_StatusTypeDef HAL_InitTick([[maybe_unused]] uint32_t TickPriority) | {
return HAL_ERROR;
}
__HAL_TIM_UIFREMAP_ENABLE(&htim1);
return HAL_TIM_Base_Start_IT(&htim1);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Apparently the disk->capacity attribute is off by 1 sector for all disk drives. We add the one here, but it should really be done in sd.c. Even if it gets fixed there, this will still work. */ | static int ppa_biosparam(struct scsi_device *sdev, struct block_device *dev, sector_t capacity, int ip[]) | /* Apparently the disk->capacity attribute is off by 1 sector for all disk drives. We add the one here, but it should really be done in sd.c. Even if it gets fixed there, this will still work. */
static int ppa_biosparam(struct scsi_device *sdev, struct block_device *dev, sector_t capacity, int ip[]) | {
ip[0] = 0x40;
ip[1] = 0x20;
ip[2] = ((unsigned long) capacity + 1) / (ip[0] * ip[1]);
if (ip[2] > 1024) {
ip[0] = 0xff;
ip[1] = 0x3f;
ip[2] = ((unsigned long) capacity + 1) / (ip[0] * ip[1]);
if (ip[2] > 1023)
ip[2] = 1023;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the handle of the timer of the first allocated timer that has the specified parameter. */ | timer_handle_t TM_GetFirstTimerWithParam(void *param) | /* Returns the handle of the timer of the first allocated timer that has the specified parameter. */
timer_handle_t TM_GetFirstTimerWithParam(void *param) | {
timer_handle_struct_t *th = s_timermanager.timerHead;
while (NULL != th)
{
if (th->param == param)
{
return th;
}
th = th->next;
}
return NULL;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* ubi_get_volume_info - get information about UBI volume. @desc: volume descriptor @vi: the information is stored here */ | void ubi_get_volume_info(struct ubi_volume_desc *desc, struct ubi_volume_info *vi) | /* ubi_get_volume_info - get information about UBI volume. @desc: volume descriptor @vi: the information is stored here */
void ubi_get_volume_info(struct ubi_volume_desc *desc, struct ubi_volume_info *vi) | {
const struct ubi_volume *vol = desc->vol;
const struct ubi_device *ubi = vol->ubi;
vi->vol_id = vol->vol_id;
vi->ubi_num = ubi->ubi_num;
vi->size = vol->reserved_pebs;
vi->used_bytes = vol->used_bytes;
vi->vol_type = vol->vol_type;
vi->corrupted = vol->corrupted;
vi->upd_marker = vol->upd_marker;
vi->alignment = vol->alignment;
vi->usable_leb_size = vol->usable_leb_size;
vi->name_len = vol->name_len;
vi->name = vol->name;
vi->cdev = vol->cdev.dev;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* code uint16_t status; status = WDOG_GetStatusFlags (wdog_base); endcode param base WDOG peripheral base address return State of the status flag: asserted (true) or not-asserted (false).see _wdog_status_flags */ | uint16_t WDOG_GetStatusFlags(WDOG_Type *base) | /* code uint16_t status; status = WDOG_GetStatusFlags (wdog_base); endcode param base WDOG peripheral base address return State of the status flag: asserted (true) or not-asserted (false).see _wdog_status_flags */
uint16_t WDOG_GetStatusFlags(WDOG_Type *base) | {
uint16_t status_flag = 0U;
status_flag |= (base->WCR & WDOG_WCR_WDE_MASK);
status_flag |= (base->WRSR & WDOG_WRSR_POR_MASK);
status_flag |= (base->WRSR & WDOG_WRSR_TOUT_MASK);
status_flag |= (base->WRSR & WDOG_WRSR_SFTW_MASK);
status_flag |= (base->WICR & WDOG_WICR_WTIS_MASK);
return status_flag;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Returns PWM_CPR_CLKA, PWM_CPR_CLKB, or negative errno. The allocated clock will run with a period of (2^prescale * div) / MCK, or twice as long if center aligned PWM output is used. The clock must later be deconfigured using pwm_clk_free(). */ | int pwm_clk_alloc(unsigned prescale, unsigned div) | /* Returns PWM_CPR_CLKA, PWM_CPR_CLKB, or negative errno. The allocated clock will run with a period of (2^prescale * div) / MCK, or twice as long if center aligned PWM output is used. The clock must later be deconfigured using pwm_clk_free(). */
int pwm_clk_alloc(unsigned prescale, unsigned div) | {
unsigned long flags;
u32 mr;
u32 val = (prescale << 8) | div;
int ret = -EBUSY;
if (prescale >= 10 || div == 0 || div > 255)
return -EINVAL;
spin_lock_irqsave(&pwm->lock, flags);
mr = pwm_readl(pwm, PWM_MR);
if ((mr & 0xffff) == 0) {
mr |= val;
ret = PWM_CPR_CLKA;
} else if ((mr & (0xffff << 16)) == 0) {
mr |= val << 16;
ret = PWM_CPR_CLKB;
}
if (ret > 0)
pwm_writel(pwm, PWM_MR, mr);
spin_unlock_irqrestore(&pwm->lock, flags);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns TRUE if the AirPcap decryption for the current adapter is active, false otherwise */ | gboolean airpcap_decryption_on(void) | /* Returns TRUE if the AirPcap decryption for the current adapter is active, false otherwise */
gboolean airpcap_decryption_on(void) | {
gboolean is_on = FALSE;
airpcap_if_info_t* fake_if_info = NULL;
fake_if_info = airpcap_driver_fake_if_info_new();
if (fake_if_info != NULL)
{
if (fake_if_info->DecryptionOn == AIRPCAP_DECRYPTION_ON)
is_on = TRUE;
else if (fake_if_info->DecryptionOn == AIRPCAP_DECRYPTION_OFF)
is_on = FALSE;
}
airpcap_if_info_free(fake_if_info);
return is_on;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Acknowledge that data was read from the given endpoint's FIFO in device mode. */ | void USBDevEndpointDataAck(uint32_t ui32Base, uint32_t ui32Endpoint, bool bIsLastPacket) | /* Acknowledge that data was read from the given endpoint's FIFO in device mode. */
void USBDevEndpointDataAck(uint32_t ui32Base, uint32_t ui32Endpoint, bool bIsLastPacket) | {
ASSERT(ui32Base == USB0_BASE);
ASSERT((ui32Endpoint == USB_EP_0) || (ui32Endpoint == USB_EP_1) ||
(ui32Endpoint == USB_EP_2) || (ui32Endpoint == USB_EP_3) ||
(ui32Endpoint == USB_EP_4) || (ui32Endpoint == USB_EP_5) ||
(ui32Endpoint == USB_EP_6) || (ui32Endpoint == USB_EP_7));
if(ui32Endpoint == USB_EP_0)
{
HWREGB(ui32Base + USB_O_CSRL0) =
USB_CSRL0_RXRDYC | (bIsLastPacket ? USB_CSRL0_DATAEND : 0);
}
else
{
HWREGB(ui32Base + USB_O_RXCSRL1 + EP_OFFSET(ui32Endpoint)) &=
~(USB_RXCSRL1_RXRDY);
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* USB_OTG_BSP_uDelay This function provides delay time in micro sec. */ | void USB_OTG_BSP_uDelay(const uint32_t usec) | /* USB_OTG_BSP_uDelay This function provides delay time in micro sec. */
void USB_OTG_BSP_uDelay(const uint32_t usec) | {
if ( ++count > utime )
{
return ;
}
}
while (1);
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Check the busy status of the specified SPI port. */ | xtBoolean xSPIIsBusy(unsigned long ulBase) | /* Check the busy status of the specified SPI port. */
xtBoolean xSPIIsBusy(unsigned long ulBase) | {
xASSERT(ulBase == SPI0_BASE);
return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY) ? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Add a new entry to the Event Log. */ | EFI_STATUS EFIAPI TcgDxeLogEventI(IN TCG_DXE_DATA *TcgData, IN TCG_PCR_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData) | /* Add a new entry to the Event Log. */
EFI_STATUS EFIAPI TcgDxeLogEventI(IN TCG_DXE_DATA *TcgData, IN TCG_PCR_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData) | {
if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_CLIENT) {
TcgData->LastEvent = (UINT8 *)(UINTN)TcgData->TcgClientAcpiTable->Lasa;
return TpmCommLogEvent (
&TcgData->LastEvent,
&TcgData->EventLogSize,
(UINTN)TcgData->TcgClientAcpiTable->Laml,
NewEventHdr,
NewEventData
);
} else {
TcgData->LastEvent = (UINT8 *)(UINTN)TcgData->TcgServerAcpiTable->Lasa;
return TpmCommLogEvent (
&TcgData->LastEvent,
&TcgData->EventLogSize,
(UINTN)TcgData->TcgServerAcpiTable->Laml,
NewEventHdr,
NewEventData
);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* strlen_url() returns the length of the given URL if the spaces within the URL were properly URL encoded. URL encoding should be skipped for host names, otherwise IDN resolution will fail. */ | static size_t strlen_url(const char *url, bool relative) | /* strlen_url() returns the length of the given URL if the spaces within the URL were properly URL encoded. URL encoding should be skipped for host names, otherwise IDN resolution will fail. */
static size_t strlen_url(const char *url, bool relative) | {
const unsigned char *ptr;
size_t newlen = 0;
bool left = TRUE;
const unsigned char *host_sep = (const unsigned char *) url;
if(!relative)
host_sep = (const unsigned char *) find_host_sep(url);
for(ptr = (unsigned char *)url; *ptr; ptr++) {
if(ptr < host_sep) {
++newlen;
continue;
}
switch(*ptr) {
case '?':
left = FALSE;
default:
if(urlchar_needs_escaping(*ptr))
newlen += 2;
newlen++;
break;
case ' ':
if(left)
newlen += 3;
else
newlen++;
break;
}
}
return newlen;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* This function set the exclusion range in the IOMMU. DMA accesses to the exclusion range are passed through untranslated */ | static void iommu_set_exclusion_range(struct amd_iommu *iommu) | /* This function set the exclusion range in the IOMMU. DMA accesses to the exclusion range are passed through untranslated */
static void iommu_set_exclusion_range(struct amd_iommu *iommu) | {
u64 start = iommu->exclusion_start & PAGE_MASK;
u64 limit = (start + iommu->exclusion_length) & PAGE_MASK;
u64 entry;
if (!iommu->exclusion_start)
return;
entry = start | MMIO_EXCL_ENABLE_MASK;
memcpy_toio(iommu->mmio_base + MMIO_EXCL_BASE_OFFSET,
&entry, sizeof(entry));
entry = limit;
memcpy_toio(iommu->mmio_base + MMIO_EXCL_LIMIT_OFFSET,
&entry, sizeof(entry));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This is a helper function which initializes various UBIFS constants after the master node has been read. It also checks various UBIFS parameters and makes sure they are all right. */ | static void init_constants_master(struct ubifs_info *c) | /* This is a helper function which initializes various UBIFS constants after the master node has been read. It also checks various UBIFS parameters and makes sure they are all right. */
static void init_constants_master(struct ubifs_info *c) | {
long long tmp64;
c->min_idx_lebs = ubifs_calc_min_idx_lebs(c);
tmp64 = c->main_lebs - 1 - 1 - MIN_INDEX_LEBS - c->jhead_cnt + 1;
tmp64 *= (long long)c->leb_size - c->leb_overhead;
tmp64 = ubifs_reported_space(c, tmp64);
c->block_cnt = tmp64 >> UBIFS_BLOCK_SHIFT;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Set an interrupt handler for the provided pins. The provided handler will be called with the triggering pin as its parameter as soon as an interrupt is detected. */ | uint32_t pio_handler_set(Pio *p_pio, uint32_t ul_id, uint32_t ul_mask, uint32_t ul_attr, void(*p_handler)(uint32_t, uint32_t)) | /* Set an interrupt handler for the provided pins. The provided handler will be called with the triggering pin as its parameter as soon as an interrupt is detected. */
uint32_t pio_handler_set(Pio *p_pio, uint32_t ul_id, uint32_t ul_mask, uint32_t ul_attr, void(*p_handler)(uint32_t, uint32_t)) | {
uint8_t i;
struct s_interrupt_source *pSource;
if (gs_ul_nb_sources >= MAX_INTERRUPT_SOURCES)
return 1;
for (i = 0; i <= gs_ul_nb_sources; i++) {
pSource = &(gs_interrupt_sources[i]);
if (pSource->id == ul_id && pSource->mask == ul_mask) {
break;
}
}
pSource->id = ul_id;
pSource->mask = ul_mask;
pSource->attr = ul_attr;
pSource->handler = p_handler;
if (i == gs_ul_nb_sources + 1) {
gs_ul_nb_sources++;
}
pio_configure_interrupt(p_pio, ul_mask, ul_attr);
return 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Search the long name hash table for the directory entry. */ | FAT_DIRENT** FatLongNameHashSearch(IN FAT_ODIR *ODir, IN CHAR16 *LongNameString) | /* Search the long name hash table for the directory entry. */
FAT_DIRENT** FatLongNameHashSearch(IN FAT_ODIR *ODir, IN CHAR16 *LongNameString) | {
FAT_DIRENT **PreviousHashNode;
for (PreviousHashNode = &ODir->LongNameHashTable[FatHashLongName (LongNameString)];
*PreviousHashNode != NULL;
PreviousHashNode = &(*PreviousHashNode)->LongNameForwardLink
)
{
if (FatStriCmp (LongNameString, (*PreviousHashNode)->FileString) == 0) {
break;
}
}
return PreviousHashNode;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* get a Blefuscuoan unsigned integer from a tvb */ | WSLUA_METHOD TvbRange_uint(lua_State *L) | /* get a Blefuscuoan unsigned integer from a tvb */
WSLUA_METHOD TvbRange_uint(lua_State *L) | {
luaL_error(L,"expired tvb");
return 0;
}
switch (tvbr->len) {
case 1:
lua_pushnumber(L,tvb_get_guint8(tvbr->tvb->ws_tvb,tvbr->offset));
return 1;
case 2:
lua_pushnumber(L,tvb_get_ntohs(tvbr->tvb->ws_tvb,tvbr->offset));
return 1;
case 3:
lua_pushnumber(L,tvb_get_ntoh24(tvbr->tvb->ws_tvb,tvbr->offset));
return 1;
case 4:
lua_pushnumber(L,tvb_get_ntohl(tvbr->tvb->ws_tvb,tvbr->offset));
WSLUA_RETURN(1);
default:
luaL_error(L,"TvbRange:uint() does not handle %d byte integers",tvbr->len);
return 0;
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* According to USB HID Specification, report descriptors are composed of pieces of information. Each piece of information is called an Item. This function retrieves each item from the report descriptor and updates USB_MOUSE_DEV. */ | EFI_STATUS ParseMouseReportDescriptor(OUT USB_MOUSE_DEV *UsbMouse, IN UINT8 *ReportDescriptor, IN UINTN ReportSize) | /* According to USB HID Specification, report descriptors are composed of pieces of information. Each piece of information is called an Item. This function retrieves each item from the report descriptor and updates USB_MOUSE_DEV. */
EFI_STATUS ParseMouseReportDescriptor(OUT USB_MOUSE_DEV *UsbMouse, IN UINT8 *ReportDescriptor, IN UINTN ReportSize) | {
UINT8 *DescriptorEnd;
UINT8 *Ptr;
HID_ITEM HidItem;
DescriptorEnd = ReportDescriptor + ReportSize;
Ptr = GetNextHidItem (ReportDescriptor, DescriptorEnd, &HidItem);
while (Ptr != NULL) {
if (HidItem.Format != HID_ITEM_FORMAT_SHORT) {
return EFI_UNSUPPORTED;
}
ParseHidItem (UsbMouse, &HidItem);
Ptr = GetNextHidItem (Ptr, DescriptorEnd, &HidItem);
}
UsbMouse->NumberOfButtons = (UINT8)(UsbMouse->PrivateData.ButtonMaxIndex - UsbMouse->PrivateData.ButtonMinIndex + 1);
UsbMouse->XLogicMax = 127;
UsbMouse->YLogicMax = 127;
UsbMouse->XLogicMin = -127;
UsbMouse->YLogicMin = -127;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set display brightness.
Configures the display for a given brightness value */ | void ili9488_write_brightness(uint16_t us_value) | /* Set display brightness.
Configures the display for a given brightness value */
void ili9488_write_brightness(uint16_t us_value) | {
ili9488_write_register(ILI9488_CMD_WRITE_DISPLAY_BRIGHTNESS, (ili9488_color_t *)&us_value, 1);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* List up to 25 file on the root directory with extension .BMP. */ | uint32_t Storage_GetDirectoryBitmapFiles(const char *DirName, char *Files[]) | /* List up to 25 file on the root directory with extension .BMP. */
uint32_t Storage_GetDirectoryBitmapFiles(const char *DirName, char *Files[]) | {
FRESULT res;
uint32_t index = 0;
if(f_mount(&fs, (TCHAR const*)"",0) != FR_OK)
{
return 0;
}
res = f_findfirst(&MyDirectory, &MyFileInfo, DirName, "*.bmp");
while (MyFileInfo.fname[0])
{
if(res == FR_OK)
{
if(index < MAX_BMP_FILES)
{
sprintf (Files[index++], "%s", MyFileInfo.fname);
}
res = f_findnext(&MyDirectory, &MyFileInfo);
}
else
{
index = 0;
break;
}
}
f_closedir(&MyDirectory);
return index;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT8 EFIAPI PciExpressBitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciExpressBitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData) | {
if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
return (UINT8)-1;
}
return MmioBitFieldOr8 (
GetPciExpressAddress (Address),
StartBit,
EndBit,
OrData
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* update the contents of the SCORE userspace general registers */ | static int genregs_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) | /* update the contents of the SCORE userspace general registers */
static int genregs_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) | {
struct pt_regs *regs = task_pt_regs(target);
int ret;
ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
0, offsetof(struct pt_regs, regs));
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
regs->regs,
offsetof(struct pt_regs, regs),
offsetof(struct pt_regs, cp0_condition));
if (!ret)
ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
sizeof(struct pt_regs), -1);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* When the reference count reaches zero, the node (and any children) is deleted via mxmlDelete(). */ | int mxmlRelease(mxml_node_t *node) | /* When the reference count reaches zero, the node (and any children) is deleted via mxmlDelete(). */
int mxmlRelease(mxml_node_t *node) | {
if (node)
{
if ((-- node->ref_count) <= 0)
{
mxmlDelete(node);
return (0);
}
else
return (node->ref_count);
}
else
return (-1);
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* param base SPI peripheral base address. param handle A pointer to the spi_dma_handle_t structure which stores the transfer state. param count A number of bytes transferred by the non-blocking transaction. return status of status_t. */ | status_t SPI_MasterTransferGetCountDMA(SPI_Type *base, spi_dma_handle_t *handle, size_t *count) | /* param base SPI peripheral base address. param handle A pointer to the spi_dma_handle_t structure which stores the transfer state. param count A number of bytes transferred by the non-blocking transaction. return status of status_t. */
status_t SPI_MasterTransferGetCountDMA(SPI_Type *base, spi_dma_handle_t *handle, size_t *count) | {
assert(handle != NULL);
if (NULL == count)
{
return kStatus_InvalidArgument;
}
if (handle->state != (uint8_t)kSPI_Busy)
{
*count = 0;
return kStatus_NoTransferInProgress;
}
size_t bytes;
bytes = DMA_GetRemainingBytes(handle->rxHandle->base, handle->rxHandle->channel);
*count = handle->transferSize - bytes;
return kStatus_Success;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The following set of functions act on ECP EISA boards. */ | static void stli_ecpeiinit(struct stlibrd *brdp) | /* The following set of functions act on ECP EISA boards. */
static void stli_ecpeiinit(struct stlibrd *brdp) | {
unsigned long memconf;
outb(0x1, (brdp->iobase + ECP_EIBRDENAB));
outb(ECP_EISTOP, (brdp->iobase + ECP_EICONFR));
udelay(10);
outb(ECP_EIDISABLE, (brdp->iobase + ECP_EICONFR));
udelay(500);
memconf = (brdp->memaddr & ECP_EIADDRMASKL) >> ECP_EIADDRSHFTL;
outb(memconf, (brdp->iobase + ECP_EIMEMARL));
memconf = (brdp->memaddr & ECP_EIADDRMASKH) >> ECP_EIADDRSHFTH;
outb(memconf, (brdp->iobase + ECP_EIMEMARH));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check frame size @s controller data structure @bt frame size */ | static int spi_m2s_hw_bt_check(struct m2s_spi_dsc *s, int bt) | /* Check frame size @s controller data structure @bt frame size */
static int spi_m2s_hw_bt_check(struct m2s_spi_dsc *s, int bt) | {
return (8 <= bt && bt <= 16) ? 0 : 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset.. */ | int32_t lis2mdl_mag_user_offset_get(stmdev_ctx_t *ctx, uint8_t *buff) | /* These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset.. */
int32_t lis2mdl_mag_user_offset_get(stmdev_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lis2mdl_read_reg(ctx, LIS2MDL_OFFSET_X_REG_L, buff, 6);
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ | EFI_STATUS EFIAPI GraphicsOutputComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | /* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI GraphicsOutputComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | {
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mGraphicsOutputDriverNameTable,
DriverName,
(BOOLEAN)(This == &mGraphicsOutputComponentName)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Utility to send 1-3 bytes of input as a 4-byte value with trailing zeroes. */ | STATIC UINT32 BIov_Send_Rem(IN UINT32 *Data, IN UINT32 Len) | /* Utility to send 1-3 bytes of input as a 4-byte value with trailing zeroes. */
STATIC UINT32 BIov_Send_Rem(IN UINT32 *Data, IN UINT32 Len) | {
union {
UINT8 c[4];
UINT32 w;
} u;
UINT8 *cdata;
UINT32 i;
cdata = (UINT8 *)Data;
u.w = 0;
for (i = 0; i < Len; i++) {
u.c[i] = *cdata++;
}
return u.w;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Unregisters an interrupt handler for the DES module. */ | void DESIntUnregister(uint32_t ui32Base) | /* Unregisters an interrupt handler for the DES module. */
void DESIntUnregister(uint32_t ui32Base) | {
ASSERT(ui32Base == DES_BASE);
IntDisable(INT_DES0);
IntUnregister(INT_DES0);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Configures EXTI line 15_10 (connected to PC.13 pin) in interrupt mode. */ | static void EXTI15_10_IRQHandler_Config(void) | /* Configures EXTI line 15_10 (connected to PC.13 pin) in interrupt mode. */
static void EXTI15_10_IRQHandler_Config(void) | {
GPIO_InitTypeDef GPIO_InitStructure;
__HAL_RCC_GPIOC_CLK_ENABLE();
GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Pin = GPIO_PIN_13;
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
HAL_NVIC_SetPriority(EXTI15_10_IRQn, 2, 0);
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Calculate EPD input for a difference image with one pixel per byte. */ | static void IRAM_ATTR calc_epd_input_1ppB(const uint32_t *ld, uint8_t *epd_input, const uint8_t *conversion_lut) | /* Calculate EPD input for a difference image with one pixel per byte. */
static void IRAM_ATTR calc_epd_input_1ppB(const uint32_t *ld, uint8_t *epd_input, const uint8_t *conversion_lut) | {
for (uint32_t j = 0; j < EPD_WIDTH / 4; j += 4) {
epd_input[j + 2] = lookup_differential_pixels(*(ld++), conversion_lut);
epd_input[j + 3] = lookup_differential_pixels(*(ld++), conversion_lut);
epd_input[j + 0] = lookup_differential_pixels(*(ld++), conversion_lut);
epd_input[j + 1] = lookup_differential_pixels(*(ld++), conversion_lut);
}
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* brief DMA instance 0, channel 4 IRQ handler. */ | void EDMA_0_CH4_DriverIRQHandler(void) | /* brief DMA instance 0, channel 4 IRQ handler. */
void EDMA_0_CH4_DriverIRQHandler(void) | {
EDMA_DriverIRQHandler(0U, 4U);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */ | int uzlib_zlib_parse_header(TINF_DATA *d) | /* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
int uzlib_zlib_parse_header(TINF_DATA *d) | {
unsigned char cmf, flg;
cmf = uzlib_get_byte(d);
flg = uzlib_get_byte(d);
if ((256*cmf + flg) % 31) return TINF_DATA_ERROR;
if ((cmf & 0x0f) != 8) return TINF_DATA_ERROR;
if ((cmf >> 4) > 7) return TINF_DATA_ERROR;
if (flg & 0x20) return TINF_DATA_ERROR;
d->checksum_type = TINF_CHKSUM_ADLER;
d->checksum = 1;
return cmf >> 4;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Set a value 0 to the specified pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ | void GPIOPinReset(unsigned long ulPort, unsigned long ulPins) | /* Set a value 0 to the specified pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinReset(unsigned long ulPort, unsigned long ulPins) | {
xASSERT(GPIOBaseValid(ulPort));
xHWREG(ulPort + GPIO_PCOR) = ulPins;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* this function is will cause the regular file referenced by fd to be truncated to a size of precisely length bytes. */ | int dfs_file_ftruncate(struct dfs_file *fd, off_t length) | /* this function is will cause the regular file referenced by fd to be truncated to a size of precisely length bytes. */
int dfs_file_ftruncate(struct dfs_file *fd, off_t length) | {
int result;
if (fd == NULL || fd->vnode->type != FT_REGULAR || length < 0)
return -EINVAL;
if (fd->vnode->fops->ioctl == NULL)
return -ENOSYS;
result = fd->vnode->fops->ioctl(fd, RT_FIOFTRUNCATE, (void*)&length);
if (result == 0)
fd->vnode->size = length;
return result;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) | /* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) | {
if(hspi->Instance==SPI1)
{
__HAL_RCC_SPI1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOB, ARD_D12_Pin|ARD_D11_Pin);
HAL_GPIO_DeInit(GPIOA, ARD_D10_Pin|ARD_D13_Pin);
}
else if(hspi->Instance==SPI2)
{
__HAL_RCC_SPI2_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOI, SPI2_MISO_Pin|SPI2_CLK_Pin);
HAL_GPIO_DeInit(SPI2_MOSI_GPIO_Port, SPI2_MOSI_Pin);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The HP Active/Passive firmware is pretty simple; the passive path reports NOT READY with sense codes 0x04/0x02; a START STOP UNIT command will then activate the passive path (and deactivate the previously active one). */ | static int hp_sw_activate(struct scsi_device *sdev, activate_complete fn, void *data) | /* The HP Active/Passive firmware is pretty simple; the passive path reports NOT READY with sense codes 0x04/0x02; a START STOP UNIT command will then activate the passive path (and deactivate the previously active one). */
static int hp_sw_activate(struct scsi_device *sdev, activate_complete fn, void *data) | {
int ret = SCSI_DH_OK;
struct hp_sw_dh_data *h = get_hp_sw_data(sdev);
ret = hp_sw_tur(sdev, h);
if (ret == SCSI_DH_OK && h->path_state == HP_SW_PATH_PASSIVE) {
h->retry_cnt = h->retries;
h->callback_fn = fn;
h->callback_data = data;
ret = hp_sw_start_stop(h);
if (ret == SCSI_DH_OK)
return 0;
h->callback_fn = h->callback_data = NULL;
}
if (fn)
fn(data, ret);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Un-Register the Service C.1 and all its Characteristics... */ | void service_c_1_3_remove(void) | /* Un-Register the Service C.1 and all its Characteristics... */
void service_c_1_3_remove(void) | {
bt_gatt_service_unregister(&service_c_1_3_svc);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Returns 0 on success or a negative error code. */ | int genl_register_ops(struct genl_family *family, struct genl_ops *ops) | /* Returns 0 on success or a negative error code. */
int genl_register_ops(struct genl_family *family, struct genl_ops *ops) | {
int err = -EINVAL;
if (ops->dumpit == NULL && ops->doit == NULL)
goto errout;
if (genl_get_cmd(ops->cmd, family)) {
err = -EEXIST;
goto errout;
}
if (ops->dumpit)
ops->flags |= GENL_CMD_CAP_DUMP;
if (ops->doit)
ops->flags |= GENL_CMD_CAP_DO;
if (ops->policy)
ops->flags |= GENL_CMD_CAP_HASPOL;
genl_lock();
list_add_tail(&ops->ops_list, &family->ops_list);
genl_unlock();
genl_ctrl_event(CTRL_CMD_NEWOPS, ops);
err = 0;
errout:
return err;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Check the status of the FIFO buffer of the specified SPI port. */ | unsigned long SPIFIFOStatusGet(unsigned long ulBase) | /* Check the status of the FIFO buffer of the specified SPI port. */
unsigned long SPIFIFOStatusGet(unsigned long ulBase) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
return (xHWREG(ulBase + SPI_CNTRL) & (SPI_CNTRL_TX_FULL) ||
(SPI_CNTRL_RX_FULL) || (SPI_CNTRL_TX_EMPTY) || (SPI_CNTRL_RX_EMPTY));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* It lets the filesystem know if it registered an interest earlier via get_block. Pass the private field of the map buffer_head so that filesystems can use it to hold additional state between get_block calls and dio_complete. */ | static int dio_complete(struct dio *dio, loff_t offset, int ret) | /* It lets the filesystem know if it registered an interest earlier via get_block. Pass the private field of the map buffer_head so that filesystems can use it to hold additional state between get_block calls and dio_complete. */
static int dio_complete(struct dio *dio, loff_t offset, int ret) | {
ssize_t transferred = 0;
if (ret == -EIOCBQUEUED)
ret = 0;
if (dio->result) {
transferred = dio->result;
if ((dio->rw == READ) && ((offset + transferred) > dio->i_size))
transferred = dio->i_size - offset;
}
if (dio->end_io && dio->result)
dio->end_io(dio->iocb, offset, transferred,
dio->map_bh.b_private);
if (dio->flags & DIO_LOCKING)
up_read_non_owner(&dio->inode->i_alloc_sem);
if (ret == 0)
ret = dio->page_errors;
if (ret == 0)
ret = dio->io_error;
if (ret == 0)
ret = transferred;
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets ExtractHandlerGuidTable so it points at a callee allocated array of registered GUIDs. The total number of GUIDs in the array are returned. Since the array of GUIDs is callee allocated and caller must treat this array of GUIDs as read-only data. If ExtractHandlerGuidTable is NULL, then ASSERT(). */ | UINTN EFIAPI ExtractGuidedSectionGetGuidList(OUT GUID **ExtractHandlerGuidTable) | /* Sets ExtractHandlerGuidTable so it points at a callee allocated array of registered GUIDs. The total number of GUIDs in the array are returned. Since the array of GUIDs is callee allocated and caller must treat this array of GUIDs as read-only data. If ExtractHandlerGuidTable is NULL, then ASSERT(). */
UINTN EFIAPI ExtractGuidedSectionGetGuidList(OUT GUID **ExtractHandlerGuidTable) | {
ASSERT (ExtractHandlerGuidTable != NULL);
*ExtractHandlerGuidTable = mExtractHandlerGuidTable;
return mNumberOfExtractHandler;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This interrupt indicates that a device has been disconnected from the root port */ | static void dwc2_handle_disconnect_intr(struct dwc2_hsotg *hsotg) | /* This interrupt indicates that a device has been disconnected from the root port */
static void dwc2_handle_disconnect_intr(struct dwc2_hsotg *hsotg) | {
dev_dbg(hsotg->dev, "++Disconnect Detected Interrupt++ (%s) %s\n",
dwc2_is_host_mode(hsotg) ? "Host" : "Device",
dwc2_op_state_str(hsotg));
hsotg->lx_state = DWC2_L3;
writel(GINTSTS_DISCONNINT, hsotg->regs + GINTSTS);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* if pcr == z then z- else if min == x && pcr == - then x+ else if max == y then y- else * */ | int atm_pcr_goal(const struct atm_trafprm *tp) | /* if pcr == z then z- else if min == x && pcr == - then x+ else if max == y then y- else * */
int atm_pcr_goal(const struct atm_trafprm *tp) | {
if (tp->pcr && tp->pcr != ATM_MAX_PCR)
return -tp->pcr;
if (tp->min_pcr && !tp->pcr)
return tp->min_pcr;
if (tp->max_pcr != ATM_MAX_PCR)
return -tp->max_pcr;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns the most recent received data by the SPIx peripheral. */ | uint16_t SPI_ReceiveData(SPI_TypeDef *SPIx) | /* Returns the most recent received data by the SPIx peripheral. */
uint16_t SPI_ReceiveData(SPI_TypeDef *SPIx) | {
assert_param(IS_SPI_ALL_PERIPH(SPIx));
return SPIx->DR;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* hgafb_open - open the framebuffer device @info:pointer to fb_info object containing info for current hga board @int:open by console system or userland. */ | static int hgafb_open(struct fb_info *info, int init) | /* hgafb_open - open the framebuffer device @info:pointer to fb_info object containing info for current hga board @int:open by console system or userland. */
static int hgafb_open(struct fb_info *info, int init) | {
hga_gfx_mode();
hga_clear_screen();
if (!nologo) hga_show_logo(info);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Retrieves a constant reference to the unique info structure of the voip_calls tap listener. The user should not modify the data pointed to. */ | static voip_calls_tapinfo_t* voip_calls_get_info(void) | /* Retrieves a constant reference to the unique info structure of the voip_calls tap listener. The user should not modify the data pointed to. */
static voip_calls_tapinfo_t* voip_calls_get_info(void) | {
static voip_calls_tapinfo_t the_tapinfo_struct =
{
voip_calls_dlg_reset, voip_calls_dlg_packet, voip_calls_dlg_draw, NULL,
0, NULL, {0}, 0, NULL, 0, 0, 0, NULL, NULL,
0, NULL,
0, 0, FALSE,
NULL, 0,
0, 0, 0, 0,
NULL,
NULL, NULL, 0, 0, 0,
0, 0, H225_OTHER, FALSE,
0,
0, 0, 0,
FLOW_ALL,
0 };
if (!the_tapinfo_struct.session) {
the_tapinfo_struct.session = cfile.epan;
}
if (!the_tapinfo_struct.callsinfos) {
the_tapinfo_struct.callsinfos = g_queue_new();
}
return &the_tapinfo_struct;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This code gets the pointer to the next variable header. */ | VARIABLE_HEADER* GetNextVariablePtr(IN VARIABLE_STORE_INFO *StoreInfo, IN VARIABLE_HEADER *Variable, IN VARIABLE_HEADER *VariableHeader) | /* This code gets the pointer to the next variable header. */
VARIABLE_HEADER* GetNextVariablePtr(IN VARIABLE_STORE_INFO *StoreInfo, IN VARIABLE_HEADER *Variable, IN VARIABLE_HEADER *VariableHeader) | {
EFI_PHYSICAL_ADDRESS TargetAddress;
EFI_PHYSICAL_ADDRESS SpareAddress;
UINTN Value;
Value = (UINTN)GetVariableDataPtr (Variable, VariableHeader, StoreInfo->AuthFlag);
Value += DataSizeOfVariable (VariableHeader, StoreInfo->AuthFlag);
Value += GET_PAD_SIZE (DataSizeOfVariable (VariableHeader, StoreInfo->AuthFlag));
Value = HEADER_ALIGN (Value);
if (StoreInfo->FtwLastWriteData != NULL) {
TargetAddress = StoreInfo->FtwLastWriteData->TargetAddress;
SpareAddress = StoreInfo->FtwLastWriteData->SpareAddress;
if (((UINTN)Variable < (UINTN)TargetAddress) && (Value >= (UINTN)TargetAddress)) {
Value = (UINTN)SpareAddress + (Value - (UINTN)TargetAddress);
}
}
return (VARIABLE_HEADER *)Value;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This routine sets the message acceptance filters on a CAN channel. */ | static canStatus LeafLightLibFuncSetAcceptanceFilter(const CanHandle hnd, uint32_t code, uint32_t mask, int32_t is_extended) | /* This routine sets the message acceptance filters on a CAN channel. */
static canStatus LeafLightLibFuncSetAcceptanceFilter(const CanHandle hnd, uint32_t code, uint32_t mask, int32_t is_extended) | {
canStatus result = canERR_NOTINITIALIZED;
assert(leafLightLibFuncSetAcceptanceFilterPtr != NULL);
assert(leafLightDllHandle != NULL);
if ((leafLightLibFuncSetAcceptanceFilterPtr != NULL) && (leafLightDllHandle != NULL))
{
result = leafLightLibFuncSetAcceptanceFilterPtr(hnd, code, mask, is_extended);
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Disable USB Endpoint Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ | void USBD_DisableEP(U32 EPNum) | /* Disable USB Endpoint Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_DisableEP(U32 EPNum) | {
uint32_t u32Ep, u32Num;
u32Num = EPNum & 0x0F;
u32Ep = USBD_NUM_TO_EP(u32Num);
HSUSBD->GINTEN &= ~(0x1UL << (HSUSBD_GINTEN_EPAIEN_Pos + (u32Num - USBD_EP_TO_NUM(EPA))));
HSUSBD_ENABLE_EP_INT(u32Ep, 0);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* move all unreachable objects (or 'all' objects) that need finalization from list 'finobj' to list 'tobefnz' (to be finalized) */ | static void separatetobefnz(global_State *g, int all) | /* move all unreachable objects (or 'all' objects) that need finalization from list 'finobj' to list 'tobefnz' (to be finalized) */
static void separatetobefnz(global_State *g, int all) | {
lua_assert(tofinalize(curr));
if (!(iswhite(curr) || all))
p = &curr->next;
else {
*p = curr->next;
curr->next = *lastnext;
*lastnext = curr;
lastnext = &curr->next;
}
}
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Check user specified FileCol is right to current screen. */ | BOOLEAN RightCurrentScreen(IN UINTN FileCol) | /* Check user specified FileCol is right to current screen. */
BOOLEAN RightCurrentScreen(IN UINTN FileCol) | {
if (FileCol > FileBuffer.LowVisibleRange.Column + MainEditor.ScreenSize.Column - 1) {
return TRUE;
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Callback management re-direction function.
Re-directs any callback management calls relating to the current GPIO bank to the GPIO sub-system. Comp. documentation of the underlying sub-system's #gpio_manage_callback function. */ | static int gpio_xlnx_ps_bank_manage_callback(const struct device *dev, struct gpio_callback *callback, bool set) | /* Callback management re-direction function.
Re-directs any callback management calls relating to the current GPIO bank to the GPIO sub-system. Comp. documentation of the underlying sub-system's #gpio_manage_callback function. */
static int gpio_xlnx_ps_bank_manage_callback(const struct device *dev, struct gpio_callback *callback, bool set) | {
struct gpio_xlnx_ps_bank_dev_data *dev_data = dev->data;
return gpio_manage_callback(&dev_data->callbacks, callback, set);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */ | VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages) | /* If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages) | {
EFI_STATUS Status;
ASSERT (Pages != 0);
Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
ASSERT_EFI_ERROR (Status);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Note that g_signal_emit() resets the return value to the default if no handlers are connected, in contrast to g_signal_emitv(). */ | void g_signal_emit(gpointer instance, guint signal_id, GQuark detail,...) | /* Note that g_signal_emit() resets the return value to the default if no handlers are connected, in contrast to g_signal_emitv(). */
void g_signal_emit(gpointer instance, guint signal_id, GQuark detail,...) | {
va_list var_args;
va_start (var_args, detail);
g_signal_emit_valist (instance, signal_id, detail, var_args);
va_end (var_args);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Assemble the address part of a command for Winbond devices in non-power-of-two page size mode. */ | static void winbond_build_address(struct winbond_spi_flash *stm, u8 *cmd, u32 offset) | /* Assemble the address part of a command for Winbond devices in non-power-of-two page size mode. */
static void winbond_build_address(struct winbond_spi_flash *stm, u8 *cmd, u32 offset) | {
unsigned long page_addr;
unsigned long byte_addr;
unsigned long page_size;
unsigned int page_shift;
page_shift = stm->params->l2_page_size;
page_size = (1 << page_shift);
page_addr = offset / page_size;
byte_addr = offset % page_size;
cmd[0] = page_addr >> (16 - page_shift);
cmd[1] = page_addr << (page_shift - 8) | (byte_addr >> 8);
cmd[2] = byte_addr;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Initialize ADC scan sequence.
When selecting an external reference, the gain and offset calibration must be set explicitly (CAL register). For other references, the calibration is updated with values defined during manufacturing. */ | void ADC_InitScan(ADC_TypeDef *adc, const ADC_InitScan_TypeDef *init) | /* Initialize ADC scan sequence.
When selecting an external reference, the gain and offset calibration must be set explicitly (CAL register). For other references, the calibration is updated with values defined during manufacturing. */
void ADC_InitScan(ADC_TypeDef *adc, const ADC_InitScan_TypeDef *init) | {
uint32_t tmp;
EFM_ASSERT(ADC_REF_VALID(adc));
adc->CMD = ADC_CMD_SCANSTOP;
ADC_CalibrateLoadScan(adc, init->reference);
tmp = ((uint32_t)(init->prsSel) << _ADC_SCANCTRL_PRSSEL_SHIFT) |
((uint32_t)(init->acqTime) << _ADC_SCANCTRL_AT_SHIFT) |
((uint32_t)(init->reference) << _ADC_SCANCTRL_REF_SHIFT) |
init->input |
((uint32_t)(init->resolution) << _ADC_SCANCTRL_RES_SHIFT);
if (init->prsEnable)
{
tmp |= ADC_SCANCTRL_PRSEN;
}
if (init->leftAdjust)
{
tmp |= ADC_SCANCTRL_ADJ_LEFT;
}
if (init->diff)
{
tmp |= ADC_SCANCTRL_DIFF;
}
if (init->rep)
{
tmp |= ADC_SCANCTRL_REP;
}
adc->SCANCTRL = tmp;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* On SMP we have one ICMP socket per-cpu. */ | static struct sock* icmp_sk(struct net *net) | /* On SMP we have one ICMP socket per-cpu. */
static struct sock* icmp_sk(struct net *net) | {
return net->ipv4.icmp_sk[smp_processor_id()];
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* ‘s ’ Single step. addr is the Address at which to resume. If addr is omitted, resume at same Address. */ | VOID EFIAPI SingleStep(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *PacketData) | /* ‘s ’ Single step. addr is the Address at which to resume. If addr is omitted, resume at same Address. */
VOID EFIAPI SingleStep(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *PacketData) | {
if (PacketData[1] != '\0') {
SystemContext.SystemContextX64->Rip = AsciiStrHexToUintn (&PacketData[1]);
}
AddSingleStep (SystemContext);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Checks that we have enough buffer space to encode 'nbytes' more bytes of data. If so, update the total xdr_buf length, and adjust the length of the current kvec. */ | __be32* xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes) | /* Checks that we have enough buffer space to encode 'nbytes' more bytes of data. If so, update the total xdr_buf length, and adjust the length of the current kvec. */
__be32* xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes) | {
__be32 *p = xdr->p;
__be32 *q;
nbytes += 3;
nbytes &= ~3;
q = p + (nbytes >> 2);
if (unlikely(q > xdr->end || q < p))
return NULL;
xdr->p = q;
xdr->iov->iov_len += nbytes;
xdr->buf->len += nbytes;
return p;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Reads and returns the current 16-bit LDTR descriptor value. This function is only available on IA-32 and X64. */ | UINT16 EFIAPI AsmReadLdtr(VOID) | /* Reads and returns the current 16-bit LDTR descriptor value. This function is only available on IA-32 and X64. */
UINT16 EFIAPI AsmReadLdtr(VOID) | {
UINT16 Data;
__asm__ __volatile__ (
"sldt %0"
: "=g" (Data)
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* device_node device node to be converted display_only true if the shorter text representation shall be used allow_shortcuts true if shortcut forms may be used */ | static uint16_t EFIAPI* efi_convert_device_node_to_text(struct efi_device_path *device_node, bool display_only, bool allow_shortcuts) | /* device_node device node to be converted display_only true if the shorter text representation shall be used allow_shortcuts true if shortcut forms may be used */
static uint16_t EFIAPI* efi_convert_device_node_to_text(struct efi_device_path *device_node, bool display_only, bool allow_shortcuts) | {
char str[MAX_NODE_LEN];
uint16_t *text = NULL;
EFI_ENTRY("%p, %d, %d", device_node, display_only, allow_shortcuts);
if (!device_node)
goto out;
efi_convert_single_device_node_to_text(str, device_node);
text = efi_str_to_u16(str);
out:
EFI_EXIT(EFI_SUCCESS);
return text;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Send the Send CID command and check the response. */ | int32_t SDMMC_CMD2_AllSendCID(CM_SDIOC_TypeDef *SDIOCx, uint32_t *pu32ErrStatus) | /* Send the Send CID command and check the response. */
int32_t SDMMC_CMD2_AllSendCID(CM_SDIOC_TypeDef *SDIOCx, uint32_t *pu32ErrStatus) | {
int32_t i32Ret;
stc_sdioc_cmd_config_t stcCmdConfig;
if (NULL == pu32ErrStatus) {
i32Ret = LL_ERR_INVD_PARAM;
} else {
stcCmdConfig.u32Argument = 0UL;
stcCmdConfig.u16CmdIndex = SDIOC_CMD2_ALL_SEND_CID;
stcCmdConfig.u16CmdType = SDIOC_CMD_TYPE_NORMAL;
stcCmdConfig.u16DataLine = SDIOC_DATA_LINE_DISABLE;
stcCmdConfig.u16ResponseType = SDIOC_RESP_TYPE_R2;
i32Ret = SDIOC_SendCommand(SDIOCx, &stcCmdConfig);
if (LL_OK == i32Ret) {
i32Ret = SDMMC_GetCmdResp2(SDIOCx, pu32ErrStatus);
}
}
return i32Ret;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* @handle: handle of the loaded image @systable: system table */ | static int setup(const efi_handle_t handle, const struct efi_system_table *systable) | /* @handle: handle of the loaded image @systable: system table */
static int setup(const efi_handle_t handle, const struct efi_system_table *systable) | {
image_handle = handle;
boottime = systable->boottime;
decompress(&image);
return EFI_ST_SUCCESS;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Get the assigned source of the given LED channel. */ | static int lp5562_get_led_source(const struct device *dev, enum lp5562_led_channels channel, enum lp5562_led_sources *source) | /* Get the assigned source of the given LED channel. */
static int lp5562_get_led_source(const struct device *dev, enum lp5562_led_channels channel, enum lp5562_led_sources *source) | {
const struct lp5562_config *config = dev->config;
uint8_t led_map;
if (i2c_reg_read_byte_dt(&config->bus, LP5562_LED_MAP, &led_map)) {
return -EIO;
}
*source = (led_map >> (channel << 1)) & LP5562_MASK;
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Set the clock rate of the specified I2C port.
The */ | void I2CSlaveInit(unsigned long ulBase, unsigned long ulAddrConfig, unsigned short usSlaveAddr, unsigned long ulGeneralCall) | /* Set the clock rate of the specified I2C port.
The */
void I2CSlaveInit(unsigned long ulBase, unsigned long ulAddrConfig, unsigned short usSlaveAddr, unsigned long ulGeneralCall) | {
xASSERT((ulBase == I2C0_BASE));
xASSERT(!(usSlaveAddr & 0x80));
I2CEnable(ulBase);
xHWREG(ulBase + I2C_ADDR) = usSlaveAddr;
xHWREG(ulBase + I2C_CR) &= ~I2C_CR_ADRM;
xHWREG(ulBase + I2C_CR) |= ulAddrConfig;
xHWREG(ulBase + I2C_CR) &= ~I2C_CR_GCEN;
xHWREG(ulBase + I2C_CR) |= I2C_CR_AA;
xHWREG(ulBase + I2C_CR) |= ulGeneralCall;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* pdc_pat_chassis_send_log - Sends a PDC PAT CHASSIS log message. */ | int pdc_chassis_disp(unsigned long disp) | /* pdc_pat_chassis_send_log - Sends a PDC PAT CHASSIS log message. */
int pdc_chassis_disp(unsigned long disp) | {
int retval = 0;
unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_CHASSIS, PDC_CHASSIS_DISP, disp);
spin_unlock_irqrestore(&pdc_lock, flags);
return retval;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Since we don't get notified on open and close for this file, things get really tricky here... our solution is to only allow reading the table in all at once. */ | static ssize_t ibm_read_apci_table(struct kobject *kobj, struct bin_attribute *bin_attr, char *buffer, loff_t pos, size_t size) | /* Since we don't get notified on open and close for this file, things get really tricky here... our solution is to only allow reading the table in all at once. */
static ssize_t ibm_read_apci_table(struct kobject *kobj, struct bin_attribute *bin_attr, char *buffer, loff_t pos, size_t size) | {
int bytes_read = -EINVAL;
char *table = NULL;
dbg("%s: pos = %d, size = %zd\n", __func__, (int)pos, size);
if (pos == 0) {
bytes_read = ibm_get_table_from_acpi(&table);
if (bytes_read > 0 && bytes_read <= size)
memcpy(buffer, table, bytes_read);
kfree(table);
}
return bytes_read;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configure the length of break frame to be detect. */ | void ald_uart_lin_detect_break_len_config(ald_uart_handle_t *hperh, ald_uart_lin_break_len_t len) | /* Configure the length of break frame to be detect. */
void ald_uart_lin_detect_break_len_config(ald_uart_handle_t *hperh, ald_uart_lin_break_len_t len) | {
assert_param(IS_UART_ENHANCE(hperh->perh));
assert_param(IS_UART_LIN_BREAK_LEN(len));
MODIFY_REG(hperh->perh->LIN, UART_LIN_LINBDL_MSK, len << UART_LIN_LINBDL_POS);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Configure what scope the hot key will impact. All hot keys have the same scope. The mixed hot keys with the different level are not supported. If no scope is set, the default scope will be FormSet level. After all registered hot keys are removed, previous Scope can reset to another level. */ | EFI_STATUS EFIAPI SetScope(IN BROWSER_SETTING_SCOPE Scope) | /* Configure what scope the hot key will impact. All hot keys have the same scope. The mixed hot keys with the different level are not supported. If no scope is set, the default scope will be FormSet level. After all registered hot keys are removed, previous Scope can reset to another level. */
EFI_STATUS EFIAPI SetScope(IN BROWSER_SETTING_SCOPE Scope) | {
if (Scope >= MaxLevel) {
return EFI_INVALID_PARAMETER;
}
if (mBrowserScopeFirstSet || IsListEmpty (&gBrowserHotKeyList)) {
gBrowserSettingScope = Scope;
mBrowserScopeFirstSet = FALSE;
} else if (Scope != gBrowserSettingScope) {
return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Free memory allocated for the string elements in the string table. */ | EFI_STATUS EFIAPI StringTableFree(IN STRING_TABLE *CONST StrTable) | /* Free memory allocated for the string elements in the string table. */
EFI_STATUS EFIAPI StringTableFree(IN STRING_TABLE *CONST StrTable) | {
if ((StrTable == NULL) || (StrTable->Elements == NULL)) {
return EFI_INVALID_PARAMETER;
}
FreePool (StrTable->Elements);
ZeroMem (StrTable, sizeof (STRING_TABLE));
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.