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
|
|---|---|---|---|---|---|---|---|
/* Interrupt handler for the timer interrupt Announce to the kernel that a number of ticks have passed */
|
static void np_timer_isr(const void *arg)
|
/* Interrupt handler for the timer interrupt Announce to the kernel that a number of ticks have passed */
static void np_timer_isr(const void *arg)
|
{
ARG_UNUSED(arg);
uint64_t now = hwm_get_time();
int32_t elapsed_ticks = (now - last_tick_time)/tick_period;
last_tick_time += elapsed_ticks*tick_period;
sys_clock_announce(elapsed_ticks);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Check that the given (port, pin) pair is a valid LPC178x/7x GPIO pin. Returns 0 on success, -EINVAL otherwise. */
|
static int lpc178x_validate_gpio(const struct lpc178x_gpio_dsc *dsc)
|
/* Check that the given (port, pin) pair is a valid LPC178x/7x GPIO pin. Returns 0 on success, -EINVAL otherwise. */
static int lpc178x_validate_gpio(const struct lpc178x_gpio_dsc *dsc)
|
{
int rv;
rv = 0;
if (!dsc || dsc->port >= LPC178X_GPIO_PORTS ||
dsc->pin >= LPC178X_GPIO_NORMAL_PORT_PINS ||
(dsc->port == LPC178X_GPIO_PORTS - 1 &&
dsc->pin >= LPC178X_GPIO_LAST_PORT_PINS)) {
printk(KERN_ERR "%s: incorrect params %d.%d.\n", __func__,
dsc ? dsc->port : -1,
dsc ? dsc->pin : -1);
rv = -EINVAL;
}
return rv;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Detect if an IDE controller exists in specified position. */
|
BOOLEAN DetectIDEController(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition)
|
/* Detect if an IDE controller exists in specified position. */
BOOLEAN DetectIDEController(IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev, IN UINTN DevicePosition)
|
{
UINT8 Channel;
EFI_STATUS Status;
UINT8 AtaCommand;
Channel = (UINT8)(DevicePosition / 2);
ASSERT (Channel < MAX_IDE_CHANNELS);
Status = WaitForBSYClear (AtapiBlkIoDev, &(AtapiBlkIoDev->IdeIoPortReg[Channel]), 31000);
if (EFI_ERROR (Status)) {
return FALSE;
}
AtaCommand = 0xE5;
Status = CheckPowerMode (AtapiBlkIoDev, DevicePosition, AtaCommand);
if ((Status == EFI_ABORTED) || (Status == EFI_SUCCESS)) {
return TRUE;
}
return FALSE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set the PWM duty of the PWM module.
The */
|
void PWMDutySet(unsigned long ulBase, unsigned long ulChannel, unsigned char ulDuty)
|
/* Set the PWM duty of the PWM module.
The */
void PWMDutySet(unsigned long ulBase, unsigned long ulChannel, unsigned char ulDuty)
|
{
unsigned long ulChannelTemp;
unsigned long ulCMRData;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
xASSERT(((ulDuty > 0) || (ulDuty <= 100)));
ulCMRData = (PWMCRRGet(ulBase) * ulDuty) / 100;
if ((PWMCRRGet(ulBase) * ulDuty) / 100 == 0)
{
ulCMRData = 0;
}
xHWREG(ulBase + TIMER_CH0CCR + ulChannelTemp * 4) = ulCMRData;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Preempts the GAP if it is not already preempted.
On preemption, all aborted GAP procedures are reported with a status or reason code of BLE_HS_EPREEMPTED. An attempt to initiate a new GAP procedure during preemption fails with a return code of BLE_HS_EPREEMPTED. */
|
void ble_gap_preempt(void)
|
/* Preempts the GAP if it is not already preempted.
On preemption, all aborted GAP procedures are reported with a status or reason code of BLE_HS_EPREEMPTED. An attempt to initiate a new GAP procedure during preemption fails with a return code of BLE_HS_EPREEMPTED. */
void ble_gap_preempt(void)
|
{
ble_hs_lock();
if (!ble_gap_is_preempted()) {
ble_gap_preempt_no_lock();
}
ble_hs_unlock();
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Will be called only by the device core when all users of this pci device are done. */
|
static void pci_release_dev(struct device *dev)
|
/* Will be called only by the device core when all users of this pci device are done. */
static void pci_release_dev(struct device *dev)
|
{
struct pci_dev *pci_dev;
pci_dev = to_pci_dev(dev);
pci_release_capabilities(pci_dev);
kfree(pci_dev);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* For the avoidance of doubt the "preferred form" of this code is one which is in an open non patent encumbered format. Where cryptographic key signing forms part of the process of creating an executable the information including keys needed to generate an equivalently functional executable are deemed to be part of the source code. */
|
int ide_end_rq(ide_drive_t *drive, struct request *rq, int error, unsigned int nr_bytes)
|
/* For the avoidance of doubt the "preferred form" of this code is one which is in an open non patent encumbered format. Where cryptographic key signing forms part of the process of creating an executable the information including keys needed to generate an equivalently functional executable are deemed to be part of the source code. */
int ide_end_rq(ide_drive_t *drive, struct request *rq, int error, unsigned int nr_bytes)
|
{
if ((drive->dev_flags & IDE_DFLAG_DMA_PIO_RETRY) &&
drive->retry_pio <= 3) {
drive->dev_flags &= ~IDE_DFLAG_DMA_PIO_RETRY;
ide_dma_on(drive);
}
return blk_end_request(rq, error, nr_bytes);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function will get or set some options of the timer */
|
rt_err_t rt_timer_control(rt_timer_t timer, rt_uint8_t cmd, void *arg)
|
/* This function will get or set some options of the timer */
rt_err_t rt_timer_control(rt_timer_t timer, rt_uint8_t cmd, void *arg)
|
{
RT_ASSERT(timer != RT_NULL);
switch (cmd)
{
case RT_TIMER_CTRL_GET_TIME:
*(rt_tick_t *)arg = timer->init_tick;
break;
case RT_TIMER_CTRL_SET_TIME:
timer->init_tick = *(rt_tick_t *)arg;
break;
case RT_TIMER_CTRL_SET_ONESHOT:
timer->parent.flag &= ~RT_TIMER_FLAG_PERIODIC;
break;
case RT_TIMER_CTRL_SET_PERIODIC:
timer->parent.flag |= RT_TIMER_FLAG_PERIODIC;
break;
}
return RT_EOK;
}
|
armink/FreeModbus_Slave-Master-RTT-STM32
|
C++
|
Other
| 1,477
|
/* Configures the TIMx Output Compare 1 Fast feature. */
|
void TIM_OC1FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
|
/* Configures the TIMx Output Compare 1 Fast feature. */
void TIM_OC1FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
|
{
uint32_t tmpccmr1 = 0;
assert_param(IS_TIM_LIST1_PERIPH(TIMx));
assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast));
tmpccmr1 = TIMx->CCMR1;
tmpccmr1 &= (uint32_t)~TIM_CCMR1_OC1FE;
tmpccmr1 |= TIM_OCFast;
TIMx->CCMR1 = tmpccmr1;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Scan the hash @table and applied @f to each value. */
|
void xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data)
|
/* Scan the hash @table and applied @f to each value. */
void xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data)
|
{
for(i = 0; i < table->size; i++) {
if (table->table[i].valid == 0)
continue;
iter = &(table->table[i]);
while (iter) {
next = iter->next;
nb = table->nbElems;
if ((f != NULL) && (iter->payload != NULL))
f(iter->payload, data, iter->name,
iter->name2, iter->name3);
if (nb != table->nbElems) {
if (iter == &(table->table[i])) {
if (table->table[i].valid == 0)
iter = NULL;
if (table->table[i].next != next)
iter = &(table->table[i]);
} else
iter = next;
} else
iter = next;
}
}
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* @controller_handle: parent controller @child_handle: child controller Return: status code */
|
static efi_status_t disconnect_child(efi_handle_t controller_handle, efi_handle_t child_handle)
|
/* @controller_handle: parent controller @child_handle: child controller Return: status code */
static efi_status_t disconnect_child(efi_handle_t controller_handle, efi_handle_t child_handle)
|
{
efi_status_t ret;
efi_guid_t *guid_controller = NULL;
efi_guid_t *guid_child_controller = NULL;
ret = EFI_CALL(systab.boottime->close_protocol(
controller_handle, guid_controller,
child_handle, child_handle));
if (ret != EFI_SUCCESS) {
EFI_PRINT("Cannot close protocol\n");
return ret;
}
ret = EFI_CALL(systab.boottime->uninstall_protocol_interface(
child_handle, guid_child_controller, NULL));
if (ret != EFI_SUCCESS) {
EFI_PRINT("Cannot uninstall protocol interface\n");
return ret;
}
return ret;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This function reads atom content and puts data in extradata without tag nor size unlike mov_read_extradata. */
|
static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
|
/* This function reads atom content and puts data in extradata without tag nor size unlike mov_read_extradata. */
static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
|
{
AVStream *st;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
if((uint64_t)atom.size > (1<<30))
return -1;
av_free(st->codec->extradata);
st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
return AVERROR(ENOMEM);
st->codec->extradata_size = atom.size;
get_buffer(pb, st->codec->extradata, atom.size);
return 0;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* initialize the timer callback if not programmed yet */
|
static void snd_mpu401_uart_add_timer(struct snd_mpu401 *mpu, int input)
|
/* initialize the timer callback if not programmed yet */
static void snd_mpu401_uart_add_timer(struct snd_mpu401 *mpu, int input)
|
{
unsigned long flags;
spin_lock_irqsave (&mpu->timer_lock, flags);
if (mpu->timer_invoked == 0) {
init_timer(&mpu->timer);
mpu->timer.data = (unsigned long)mpu;
mpu->timer.function = snd_mpu401_uart_timer;
mpu->timer.expires = 1 + jiffies;
add_timer(&mpu->timer);
}
mpu->timer_invoked |= input ? MPU401_MODE_INPUT_TIMER :
MPU401_MODE_OUTPUT_TIMER;
spin_unlock_irqrestore (&mpu->timer_lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* enables or disables Egress VLAN tagging for a VLAN range */
|
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBEgressVlanRangeTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax, BOOL enabled)
|
/* enables or disables Egress VLAN tagging for a VLAN range */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBEgressVlanRangeTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax, BOOL enabled)
|
{
IX_ETH_DB_CHECK_PORT(portID);
IX_ETH_DB_CHECK_SINGLE_NPE(portID);
return ixEthDBPortVlanMembershipRangeChange(portID, vlanIDMin, vlanIDMax, ixEthDBPortInfo[portID].transmitTaggingInfo, enabled? ADD_VLAN : REMOVE_VLAN);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Heuristically dissect a tvbuff containing a JXTA TCP Stream */
|
static gboolean dissect_jxta_TCP_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
/* Heuristically dissect a tvbuff containing a JXTA TCP Stream */
static gboolean dissect_jxta_TCP_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
{
int save_desegment_offset;
guint32 save_desegment_len;
int ret;
save_desegment_offset = pinfo->desegment_offset;
save_desegment_len = pinfo->desegment_len;
ret = dissect_jxta_stream(tvb, pinfo, tree, NULL);
if (ret < 0) {
pinfo->desegment_offset = save_desegment_offset;
pinfo->desegment_len = save_desegment_len;
return FALSE;
} else if (ret == 0) {
pinfo->desegment_offset = save_desegment_offset;
pinfo->desegment_len = save_desegment_len;
return FALSE;
} else {
return TRUE;
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Check whether the contents of buf is OK to access. Since the content is a page cache page, IO may be in flight. */
|
static int page_cache_pipe_buf_confirm(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
|
/* Check whether the contents of buf is OK to access. Since the content is a page cache page, IO may be in flight. */
static int page_cache_pipe_buf_confirm(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
|
{
struct page *page = buf->page;
int err;
if (!PageUptodate(page)) {
lock_page(page);
if (!page->mapping) {
err = -ENODATA;
goto error;
}
if (!PageUptodate(page)) {
err = -EIO;
goto error;
}
unlock_page(page);
}
return 0;
error:
unlock_page(page);
return err;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* speed is given as the normal factor, e.g. 4 for 4x */
|
static noinline_for_stack int pkt_set_speed(struct pktcdvd_device *pd, unsigned write_speed, unsigned read_speed)
|
/* speed is given as the normal factor, e.g. 4 for 4x */
static noinline_for_stack int pkt_set_speed(struct pktcdvd_device *pd, unsigned write_speed, unsigned read_speed)
|
{
struct packet_command cgc;
struct request_sense sense;
int ret;
init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE);
cgc.sense = &sense;
cgc.cmd[0] = GPCMD_SET_SPEED;
cgc.cmd[2] = (read_speed >> 8) & 0xff;
cgc.cmd[3] = read_speed & 0xff;
cgc.cmd[4] = (write_speed >> 8) & 0xff;
cgc.cmd[5] = write_speed & 0xff;
if ((ret = pkt_generic_packet(pd, &cgc)))
pkt_dump_sense(&cgc);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* DIO devices are slightly special. Although it is possible to implement the insn_read/insn_write interface, it is much more useful to applications if you implement the insn_bits interface. This allows packed reading/writing of the DIO channels. The comedi core can convert between insn_bits and insn_read/write */
|
static int rtd_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
|
/* DIO devices are slightly special. Although it is possible to implement the insn_read/insn_write interface, it is much more useful to applications if you implement the insn_bits interface. This allows packed reading/writing of the DIO channels. The comedi core can convert between insn_bits and insn_read/write */
static int rtd_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data)
|
{
if (insn->n != 2)
return -EINVAL;
if (data[0]) {
s->state &= ~data[0];
s->state |= data[0] & data[1];
RtdDio0Write(dev, s->state);
}
data[1] = RtdDio0Read(dev);
return 2;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* see if there is a message waiting for the server to answer in the ack list, if there is, then process it according to the flag. flag : 0 means it does not need to wait for the timeout to process these packets immediately. usually immediately after reconnecting. 1 means it needs to wait for timeout before processing these messages, usually timeout processing in a stable connection. */
|
static void mqtt_ack_list_scan(mqtt_client_t *c, uint8_t flag)
|
/* see if there is a message waiting for the server to answer in the ack list, if there is, then process it according to the flag. flag : 0 means it does not need to wait for the timeout to process these packets immediately. usually immediately after reconnecting. 1 means it needs to wait for timeout before processing these messages, usually timeout processing in a stable connection. */
static void mqtt_ack_list_scan(mqtt_client_t *c, uint8_t flag)
|
{
ack_handler = LIST_ENTRY(curr, ack_handlers_t, list);
if ((!pika_platform_thread_timer_is_expired(&ack_handler->timer)) &&
(flag == 1))
continue;
if ((ack_handler->type == PUBACK) || (ack_handler->type == PUBREC) ||
(ack_handler->type == PUBREL) || (ack_handler->type == PUBCOMP)) {
mqtt_ack_handler_resend(c, ack_handler);
continue;
} else if ((ack_handler->type == SUBACK) ||
(ack_handler->type == UNSUBACK)) {
if (NULL != ack_handler->handler) {
mqtt_msg_handler_destory(ack_handler->handler);
ack_handler->handler = NULL;
}
}
mqtt_ack_handler_destroy(ack_handler);
mqtt_subtract_ack_handler_num(c);
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* If this function returns, it means that the system does not support shutdown reset. */
|
VOID EFIAPI ResetShutdown(VOID)
|
/* If this function returns, it means that the system does not support shutdown reset. */
VOID EFIAPI ResetShutdown(VOID)
|
{
ArmCallSmc0 (ARM_SMC_ID_PSCI_SYSTEM_OFF, NULL, NULL, NULL);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Clears all the LCD display with the specified colour. */
|
void SSD2119DisplayClear(unsigned long ulColor)
|
/* Clears all the LCD display with the specified colour. */
void SSD2119DisplayClear(unsigned long ulColor)
|
{
SSD2119DisplayRectFill(0, 319, 0, 239, ulColor);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Also this function makes use of the fact that timestamp == frameno */
|
static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
|
/* Also this function makes use of the fact that timestamp == frameno */
static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
|
{
AVStream *st = s->streams[stream_index];
MPCContext *c = s->priv_data;
AVPacket pkt1, *pkt = &pkt1;
int ret;
int index = av_index_search_timestamp(st, timestamp - DELAY_FRAMES, flags);
uint32_t lastframe;
if (index >= 0){
c->curframe = st->index_entries[index].pos;
return 0;
}
if(timestamp < 0 || timestamp >= c->fcount)
return -1;
timestamp -= DELAY_FRAMES;
lastframe = c->curframe;
if(c->frames_noted) c->curframe = c->frames_noted - 1;
while(c->curframe < timestamp){
ret = av_read_frame(s, pkt);
if (ret < 0){
c->curframe = lastframe;
return -1;
}
av_free_packet(pkt);
}
return 0;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* i5400_process_error_info Process the error info that is in the 'info' structure, previously retrieved from hardware */
|
static void i5400_process_error_info(struct mem_ctl_info *mci, struct i5400_error_info *info)
|
/* i5400_process_error_info Process the error info that is in the 'info' structure, previously retrieved from hardware */
static void i5400_process_error_info(struct mem_ctl_info *mci, struct i5400_error_info *info)
|
{ u32 allErrors;
allErrors = (info->ferr_fat_fbd & FERR_FAT_MASK);
i5400_proccess_non_recoverable_info(mci, info, allErrors);
i5400_process_nonfatal_error_info(mci, info);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enables or disables the USART's transmitter or receiver. */
|
void USART_DirectionModeCmd(USART_TypeDef *USARTx, uint32_t USART_DirectionMode, FunctionalState NewState)
|
/* Enables or disables the USART's transmitter or receiver. */
void USART_DirectionModeCmd(USART_TypeDef *USARTx, uint32_t USART_DirectionMode, FunctionalState NewState)
|
{
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_USART_MODE(USART_DirectionMode));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
USARTx->CR1 |= USART_DirectionMode;
}
else
{
USARTx->CR1 &= (uint32_t)~USART_DirectionMode;
}
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Adjusts the Internal High Speed oscillator (HSI) calibration value. */
|
void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue)
|
/* Adjusts the Internal High Speed oscillator (HSI) calibration value. */
void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue)
|
{
uint32_t tmpreg = 0;
assert_param(IS_RCC_HSI_CALIBRATION_VALUE(HSICalibrationValue));
tmpreg = RCC->CR;
tmpreg &= ~RCC_CR_HSITRIM;
tmpreg |= (uint32_t)HSICalibrationValue << 3;
RCC->CR = tmpreg;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Gets the Status Block Address for the LPC peripheral. */
|
unsigned LPCStatusBlockAddressGet(unsigned long ulBase)
|
/* Gets the Status Block Address for the LPC peripheral. */
unsigned LPCStatusBlockAddressGet(unsigned long ulBase)
|
{
ASSERT(ulBase == LPC0_BASE);
return(HWREG(ulBase + LPC_O_STSADDR));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Take one of the scratch blocks into use, if at all possible. */
|
int fcb_append_to_scratch(struct fcb *fcb)
|
/* Take one of the scratch blocks into use, if at all possible. */
int fcb_append_to_scratch(struct fcb *fcb)
|
{
struct flash_sector *sector;
int rc;
sector = fcb_new_sector(fcb, 0);
if (!sector) {
return -ENOSPC;
}
rc = fcb_sector_hdr_init(fcb, sector, fcb->f_active_id + 1);
if (rc) {
return rc;
}
fcb->f_active.fe_sector = sector;
fcb->f_active.fe_elem_off = fcb_len_in_flash(fcb, sizeof(struct fcb_disk_area));
fcb->f_active_id++;
return 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Selects Batching Data Rate (writing frequency in FIFO) for accelerometer data.. */
|
int32_t lsm6dso_fifo_xl_batch_set(stmdev_ctx_t *ctx, lsm6dso_bdr_xl_t val)
|
/* Selects Batching Data Rate (writing frequency in FIFO) for accelerometer data.. */
int32_t lsm6dso_fifo_xl_batch_set(stmdev_ctx_t *ctx, lsm6dso_bdr_xl_t val)
|
{
lsm6dso_fifo_ctrl3_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_CTRL3, (uint8_t *)®, 1);
if (ret == 0) {
reg.bdr_xl = (uint8_t)val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_FIFO_CTRL3, (uint8_t *)®, 1);
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Set the input/output data address of the itcw (depending on the value of the r-flag and w-flag). If @use_tidal is non-zero, the corresponding tida flag is set as well. */
|
void itcw_set_data(struct itcw *itcw, void *addr, int use_tidal)
|
/* Set the input/output data address of the itcw (depending on the value of the r-flag and w-flag). If @use_tidal is non-zero, the corresponding tida flag is set as well. */
void itcw_set_data(struct itcw *itcw, void *addr, int use_tidal)
|
{
tcw_set_data(itcw->tcw, addr, use_tidal);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* get the clock stabilization interrupt and ckm flags */
|
FlagStatus rcu_interrupt_flag_get(rcu_int_flag_enum int_flag)
|
/* get the clock stabilization interrupt and ckm flags */
FlagStatus rcu_interrupt_flag_get(rcu_int_flag_enum int_flag)
|
{
if(RESET != (RCU_INT & int_flag)){
return SET;
}else{
return RESET;
}
}
|
liuxuming/trochili
|
C++
|
Apache License 2.0
| 132
|
/* LOCAL_CSR_STATUS=1 after a read or write to a microengine's CSR space means that the microengine we tried to access was also trying to access its own CSR space on the same clock cycle as we did. When this happens, we lose the arbitration process by default, and the read or write we tried to do was not actually performed, so we try again until it succeeds. */
|
u32 ixp2000_uengine_csr_read(int uengine, int offset)
|
/* LOCAL_CSR_STATUS=1 after a read or write to a microengine's CSR space means that the microengine we tried to access was also trying to access its own CSR space on the same clock cycle as we did. When this happens, we lose the arbitration process by default, and the read or write we tried to do was not actually performed, so we try again until it succeeds. */
u32 ixp2000_uengine_csr_read(int uengine, int offset)
|
{
void *uebase;
u32 *local_csr_status;
u32 *reg;
u32 value;
uebase = ixp2000_uengine_csr_area(uengine);
local_csr_status = (u32 *)(uebase + LOCAL_CSR_STATUS);
reg = (u32 *)(uebase + offset);
do {
value = ixp2000_reg_read(reg);
} while (ixp2000_reg_read(local_csr_status) & 1);
return value;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Get cells len in bytes if #NNNN-cells property is 2 then len is 8 otherwise len is 4 */
|
static int get_cells_len(void *blob, char *nr_cells_name)
|
/* Get cells len in bytes if #NNNN-cells property is 2 then len is 8 otherwise len is 4 */
static int get_cells_len(void *blob, char *nr_cells_name)
|
{
const u32 *cell;
cell = fdt_getprop(blob, 0, nr_cells_name, NULL);
if (cell && *cell == 2)
return 8;
return 4;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Un-Register the Service B.4 and all its Characteristics... */
|
void service_b_4_2_remove(void)
|
/* Un-Register the Service B.4 and all its Characteristics... */
void service_b_4_2_remove(void)
|
{
bt_gatt_service_unregister(&service_b_4_2_svc);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Initialization function for the floating-point Biquad cascade filter. */
|
void arm_biquad_cascade_df1_init_f32(arm_biquad_casd_df1_inst_f32 *S, uint8_t numStages, const float32_t *pCoeffs, float32_t *pState)
|
/* Initialization function for the floating-point Biquad cascade filter. */
void arm_biquad_cascade_df1_init_f32(arm_biquad_casd_df1_inst_f32 *S, uint8_t numStages, const float32_t *pCoeffs, float32_t *pState)
|
{
S->numStages = numStages;
S->pCoeffs = pCoeffs;
memset(pState, 0, (4U * (uint32_t) numStages) * sizeof(float32_t));
S->pState = pState;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Check whether object at given level has a close metamethod and raise an error if not. */
|
static void checkclosemth(lua_State *L, StkId level)
|
/* Check whether object at given level has a close metamethod and raise an error if not. */
static void checkclosemth(lua_State *L, StkId level)
|
{
int idx = cast_int(level - L->ci->func);
const char *vname = luaG_findlocal(L, L->ci, idx, NULL);
if (vname == NULL) vname = "?";
luaG_runerror(L, "variable '%s' got a non-closable value", vname);
}
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* introduce function I3C_SlaveTransferHandleMatched. This function was deal matched. */
|
static void I3C_SlaveTransferHandleMatched(I3C_Type *base, i3c_slave_handle_t *handle, i3c_slave_transfer_t *xfer)
|
/* introduce function I3C_SlaveTransferHandleMatched. This function was deal matched. */
static void I3C_SlaveTransferHandleMatched(I3C_Type *base, i3c_slave_handle_t *handle, i3c_slave_transfer_t *xfer)
|
{
assert(NULL != base && NULL != handle && NULL != xfer);
xfer->event = (uint32_t)kI3C_SlaveAddressMatchEvent;
handle->isBusy = true;
if ((0UL != (handle->eventMask & (uint32_t)kI3C_SlaveAddressMatchEvent)) && (NULL != handle->callback))
{
handle->callback(base, xfer, handle->userData);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* klist_add_tail - Initialize a klist_node and add it to back. */
|
void klist_add_tail(struct klist_node *n, struct klist *k)
|
/* klist_add_tail - Initialize a klist_node and add it to back. */
void klist_add_tail(struct klist_node *n, struct klist *k)
|
{
klist_node_init(k, n);
add_tail(k, n);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Filter on the task information and allocate a per-task audit context if necessary. Doing so turns on system call auditing for the specified task. This is called from copy_process, so no lock is needed. */
|
int audit_alloc(struct task_struct *tsk)
|
/* Filter on the task information and allocate a per-task audit context if necessary. Doing so turns on system call auditing for the specified task. This is called from copy_process, so no lock is needed. */
int audit_alloc(struct task_struct *tsk)
|
{
struct audit_context *context;
enum audit_state state;
char *key = NULL;
if (likely(!audit_ever_enabled))
return 0;
state = audit_filter_task(tsk, &key);
if (likely(state == AUDIT_DISABLED))
return 0;
if (!(context = audit_alloc_context(state))) {
kfree(key);
audit_log_lost("out of memory in audit_alloc");
return -ENOMEM;
}
context->filterkey = key;
tsk->audit_context = context;
set_tsk_thread_flag(tsk, TIF_SYSCALL_AUDIT);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function returns after the IPI has been accepted by the target processors. */
|
VOID EFIAPI SendSmiIpiAllExcludingSelf(VOID)
|
/* This function returns after the IPI has been accepted by the target processors. */
VOID EFIAPI SendSmiIpiAllExcludingSelf(VOID)
|
{
LOCAL_APIC_ICR_LOW IcrLow;
IcrLow.Uint32 = 0;
IcrLow.Bits.DeliveryMode = LOCAL_APIC_DELIVERY_MODE_SMI;
IcrLow.Bits.Level = 1;
IcrLow.Bits.DestinationShorthand = LOCAL_APIC_DESTINATION_SHORTHAND_ALL_EXCLUDING_SELF;
SendIpi (IcrLow.Uint32, 0);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Read the statu of the Port choosed. Parameters: port: use to choose a I/O port among Port A, B, or C. return: the value of the corresponding Port. */
|
static int32_t gpio_read(void *port, uint32_t *value)
|
/* Read the statu of the Port choosed. Parameters: port: use to choose a I/O port among Port A, B, or C. return: the value of the corresponding Port. */
static int32_t gpio_read(void *port, uint32_t *value)
|
{
dw_gpio_priv_t *gpio_priv = port;
dw_gpio_control_reg_t *gpio_control_reg = (dw_gpio_control_reg_t *)(gpio_priv->base + 0x30);
*value = gpio_control_reg->EXT_PORTA;
return 0;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* gfs2_trans_add_bh - Add a to-be-modified buffer to the current transaction @gl: the glock the buffer belongs to @bh: The buffer to add @meta: True in the case of adding metadata */
|
void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta)
|
/* gfs2_trans_add_bh - Add a to-be-modified buffer to the current transaction @gl: the glock the buffer belongs to @bh: The buffer to add @meta: True in the case of adding metadata */
void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta)
|
{
struct gfs2_sbd *sdp = gl->gl_sbd;
struct gfs2_bufdata *bd;
bd = bh->b_private;
if (bd)
gfs2_assert(sdp, bd->bd_gl == gl);
else {
gfs2_attach_bufdata(gl, bh, meta);
bd = bh->b_private;
}
lops_add(sdp, &bd->bd_le);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* this function can be called asynchronous (e.g. during a signal) */
|
LUA_API int lua_sethook(lua_State *L, lua_Hook func, int mask, int count)
|
/* this function can be called asynchronous (e.g. during a signal) */
LUA_API int lua_sethook(lua_State *L, lua_Hook func, int mask, int count)
|
{
mask = 0;
func = NULL;
}
if (isLua(L->ci))
L->oldpc = L->ci->u.l.savedpc;
L->hook = func;
L->basehookcount = count;
resethookcount(L);
L->hookmask = cast_byte(mask);
return 1;
}
|
opentx/opentx
|
C++
|
GNU General Public License v2.0
| 2,025
|
/* Build the Boot#### or Driver#### option from the VariableName. */
|
EFI_STATUS EFIAPI EfiBootManagerVariableToLoadOption(IN CHAR16 *VariableName, IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option)
|
/* Build the Boot#### or Driver#### option from the VariableName. */
EFI_STATUS EFIAPI EfiBootManagerVariableToLoadOption(IN CHAR16 *VariableName, IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option)
|
{
return EfiBootManagerVariableToLoadOptionEx (VariableName, &gEfiGlobalVariableGuid, Option);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Fills each SDIO_CMD_ConfigStruct_T member with its default value. */
|
void SDIO_TxCommandStructInit(SDIO_CMDConfig_T *cmdConfig)
|
/* Fills each SDIO_CMD_ConfigStruct_T member with its default value. */
void SDIO_TxCommandStructInit(SDIO_CMDConfig_T *cmdConfig)
|
{
cmdConfig->argument = 0x00;
cmdConfig->cmdIndex = 0x00;
cmdConfig->response = SDIO_RESPONSE_NO;
cmdConfig->wait = SDIO_WAIT_NO;
cmdConfig->CPSM = SDIO_CPSM_DISABLE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* nand_write_page_swecc - software ecc based page write function @mtd: mtd info structure @chip: nand chip info structure @buf: data buffer */
|
static void nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, const uint8_t *buf)
|
/* nand_write_page_swecc - software ecc based page write function @mtd: mtd info structure @chip: nand chip info structure @buf: data buffer */
static void nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, const uint8_t *buf)
|
{
int i, eccsize = chip->ecc.size;
int eccbytes = chip->ecc.bytes;
int eccsteps = chip->ecc.steps;
uint8_t *ecc_calc = chip->buffers->ecccalc;
const uint8_t *p = buf;
uint32_t *eccpos = chip->ecc.layout->eccpos;
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize)
chip->ecc.calculate(mtd, p, &ecc_calc[i]);
for (i = 0; i < chip->ecc.total; i++)
chip->oob_poi[eccpos[i]] = ecc_calc[i];
chip->ecc.write_page_raw(mtd, chip, buf);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Maximal file size. There is a direct, and {,double-,triple-}indirect block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks. We need to be 1 filesystem block less than the 2^32 sector limit. */
|
static loff_t ext3_max_size(int bits)
|
/* Maximal file size. There is a direct, and {,double-,triple-}indirect block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks. We need to be 1 filesystem block less than the 2^32 sector limit. */
static loff_t ext3_max_size(int bits)
|
{
loff_t res = EXT3_NDIR_BLOCKS;
int meta_blocks;
loff_t upper_limit;
upper_limit = (1LL << 32) - 1;
upper_limit >>= (bits - 9);
meta_blocks = 1;
meta_blocks += 1 + (1LL << (bits-2));
meta_blocks += 1 + (1LL << (bits-2)) + (1LL << (2*(bits-2)));
upper_limit -= meta_blocks;
upper_limit <<= bits;
res += 1LL << (bits-2);
res += 1LL << (2*(bits-2));
res += 1LL << (3*(bits-2));
res <<= bits;
if (res > upper_limit)
res = upper_limit;
if (res > MAX_LFS_FILESIZE)
res = MAX_LFS_FILESIZE;
return res;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* unuse callback - disallow input to rawmidi device */
|
static int snd_virmidi_unuse(void *private_data, struct snd_seq_port_subscribe *info)
|
/* unuse callback - disallow input to rawmidi device */
static int snd_virmidi_unuse(void *private_data, struct snd_seq_port_subscribe *info)
|
{
struct snd_virmidi_dev *rdev;
rdev = private_data;
rdev->flags &= ~SNDRV_VIRMIDI_USE;
module_put(rdev->card->module);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Call hook function registered at hook table for the current thread (if there is one) */
|
static void hookf(lua_State *L, lua_Debug *ar)
|
/* Call hook function registered at hook table for the current thread (if there is one) */
static void hookf(lua_State *L, lua_Debug *ar)
|
{"call", "return", "line", "count", "tail call"};
lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY);
lua_pushthread(L);
if (lua_rawget(L, -2) == LUA_TFUNCTION) {
lua_pushstring(L, hooknames[(int)ar->event]);
if (ar->currentline >= 0)
lua_pushinteger(L, ar->currentline);
else lua_pushnil(L);
lua_assert(lua_getinfo(L, "lS", ar));
lua_call(L, 2, 0);
}
}
|
nodemcu/nodemcu-firmware
|
C++
|
MIT License
| 7,566
|
/* function checks that variable value is in array ((xmpp_array_t)data)->data */
|
void xmpp_val_enum_list(packet_info *pinfo, proto_item *item, const gchar *name, const gchar *value, gconstpointer data)
|
/* function checks that variable value is in array ((xmpp_array_t)data)->data */
void xmpp_val_enum_list(packet_info *pinfo, proto_item *item, const gchar *name, const gchar *value, gconstpointer data)
|
{
const xmpp_array_t *enums_array = (const xmpp_array_t *)data;
gint i;
gboolean value_in_enums = FALSE;
gchar **enums = (char**)enums_array->data;
if (value != NULL) {
for (i = 0; i < enums_array->length; i++) {
if (strcmp(value, enums[i]) == 0) {
value_in_enums = TRUE;
break;
}
}
if (!value_in_enums) {
expert_add_info_format(pinfo, item, &ei_xmpp_field_unexpected_value, "Field \"%s\" has unexpected value \"%s\"", name, value);
}
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* RETURNS: Pointer to the found partition on success, NULL if not found. */
|
struct hd_struct* disk_get_part(struct gendisk *disk, int partno)
|
/* RETURNS: Pointer to the found partition on success, NULL if not found. */
struct hd_struct* disk_get_part(struct gendisk *disk, int partno)
|
{
struct hd_struct *part = NULL;
struct disk_part_tbl *ptbl;
if (unlikely(partno < 0))
return NULL;
rcu_read_lock();
ptbl = rcu_dereference(disk->part_tbl);
if (likely(partno < ptbl->len)) {
part = rcu_dereference(ptbl->part[partno]);
if (part)
get_device(part_to_dev(part));
}
rcu_read_unlock();
return part;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* 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 Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT8 EFIAPI PciBitFieldWrite8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value)
|
/* 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 Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciBitFieldWrite8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value)
|
{
return PciCf8BitFieldWrite8 (Address, StartBit, EndBit, Value);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base LPUART peripheral base address. param handle Pointer to lpuart_edma_handle_t structure. */
|
void LPUART_TransferAbortReceiveEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle)
|
/* param base LPUART peripheral base address. param handle Pointer to lpuart_edma_handle_t structure. */
void LPUART_TransferAbortReceiveEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle)
|
{
assert(handle);
assert(handle->rxEdmaHandle);
LPUART_EnableRxDMA(base, false);
EDMA_AbortTransfer(handle->rxEdmaHandle);
handle->rxState = kLPUART_RxIdle;
}
|
nanoframework/nf-interpreter
|
C++
|
MIT License
| 293
|
/* for dma spi transfers, we have to setup rx channel, otherwise there is no reliable way how to recognize that spi transfer is done dma complete callbacks are called before real spi transfer is finished and if only tx dma channel is set up (and rx fifo overflow event masked) spi master done event irq is not generated unless rx fifo is empty (emptied) so we need rx tmp buffer to use for rx dma if user does not provide one */
|
static int au1550_spi_dma_rxtmp_alloc(struct au1550_spi *hw, unsigned size)
|
/* for dma spi transfers, we have to setup rx channel, otherwise there is no reliable way how to recognize that spi transfer is done dma complete callbacks are called before real spi transfer is finished and if only tx dma channel is set up (and rx fifo overflow event masked) spi master done event irq is not generated unless rx fifo is empty (emptied) so we need rx tmp buffer to use for rx dma if user does not provide one */
static int au1550_spi_dma_rxtmp_alloc(struct au1550_spi *hw, unsigned size)
|
{
hw->dma_rx_tmpbuf = kmalloc(size, GFP_KERNEL);
if (!hw->dma_rx_tmpbuf)
return -ENOMEM;
hw->dma_rx_tmpbuf_size = size;
hw->dma_rx_tmpbuf_addr = dma_map_single(hw->dev, hw->dma_rx_tmpbuf,
size, DMA_FROM_DEVICE);
if (dma_mapping_error(hw->dev, hw->dma_rx_tmpbuf_addr)) {
kfree(hw->dma_rx_tmpbuf);
hw->dma_rx_tmpbuf = 0;
hw->dma_rx_tmpbuf_size = 0;
return -EFAULT;
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get the capability data from the specified slot. */
|
EFI_STATUS EmmcPeimHcGetCapability(IN UINTN Bar, OUT EMMC_HC_SLOT_CAP *Capability)
|
/* Get the capability data from the specified slot. */
EFI_STATUS EmmcPeimHcGetCapability(IN UINTN Bar, OUT EMMC_HC_SLOT_CAP *Capability)
|
{
EFI_STATUS Status;
UINT64 Cap;
Status = EmmcPeimHcRwMmio (Bar + EMMC_HC_CAP, TRUE, sizeof (Cap), &Cap);
if (EFI_ERROR (Status)) {
return Status;
}
CopyMem (Capability, &Cap, sizeof (Cap));
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Try to reset xendev, for reconnection by another frontend instance. */
|
static int xen_be_try_reset(struct XenDevice *xendev)
|
/* Try to reset xendev, for reconnection by another frontend instance. */
static int xen_be_try_reset(struct XenDevice *xendev)
|
{
if (xendev->fe_state != XenbusStateInitialising) {
return -1;
}
xen_be_printf(xendev, 1, "device reset (for re-connect)\n");
xen_be_set_state(xendev, XenbusStateInitialising);
return 0;
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* Returns the new list upon successfull completion, an error code otherwise. */
|
CRSimpleSel* cr_simple_sel_prepend_simple_sel(CRSimpleSel *a_this, CRSimpleSel *a_sel)
|
/* Returns the new list upon successfull completion, an error code otherwise. */
CRSimpleSel* cr_simple_sel_prepend_simple_sel(CRSimpleSel *a_this, CRSimpleSel *a_sel)
|
{
g_return_val_if_fail (a_sel, NULL);
if (a_this == NULL)
return a_sel;
a_sel->next = a_this;
a_this->prev = a_sel;
return a_sel;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Allocate and map the shared PCI space for the FIB blocks used to talk to the Adaptec firmware. */
|
static int fib_map_alloc(struct aac_dev *dev)
|
/* Allocate and map the shared PCI space for the FIB blocks used to talk to the Adaptec firmware. */
static int fib_map_alloc(struct aac_dev *dev)
|
{
dprintk((KERN_INFO
"allocate hardware fibs pci_alloc_consistent(%p, %d * (%d + %d), %p)\n",
dev->pdev, dev->max_fib_size, dev->scsi_host_ptr->can_queue,
AAC_NUM_MGT_FIB, &dev->hw_fib_pa));
if((dev->hw_fib_va = pci_alloc_consistent(dev->pdev, dev->max_fib_size
* (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB),
&dev->hw_fib_pa))==NULL)
return -ENOMEM;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* si470x_get_scratch_versions - gets the scratch page and version infos */
|
static int si470x_get_scratch_page_versions(struct si470x_device *radio)
|
/* si470x_get_scratch_versions - gets the scratch page and version infos */
static int si470x_get_scratch_page_versions(struct si470x_device *radio)
|
{
unsigned char buf[SCRATCH_REPORT_SIZE];
int retval;
buf[0] = SCRATCH_REPORT;
retval = si470x_get_report(radio, (void *) &buf, sizeof(buf));
if (retval < 0)
dev_warn(&radio->intf->dev, "si470x_get_scratch: "
"si470x_get_report returned %d\n", retval);
else {
radio->software_version = buf[1];
radio->hardware_version = buf[2];
}
return (retval < 0) ? -EINVAL : 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function processes the results of changes in configuration. */
|
EFI_STATUS EFIAPI RamDiskRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
|
/* This function processes the results of changes in configuration. */
EFI_STATUS EFIAPI RamDiskRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
|
{
if ((Configuration == NULL) || (Progress == NULL)) {
return EFI_INVALID_PARAMETER;
}
*Progress = Configuration;
return EFI_NOT_FOUND;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Called from break_lease() with lock_kernel() held. Note: we assume break_lease will only call this */
|
static void nfsd_break_deleg_cb(struct file_lock *fl)
|
/* Called from break_lease() with lock_kernel() held. Note: we assume break_lease will only call this */
static void nfsd_break_deleg_cb(struct file_lock *fl)
|
{
struct nfs4_delegation *dp = (struct nfs4_delegation *)fl->fl_owner;
dprintk("NFSD nfsd_break_deleg_cb: dp %p fl %p\n",dp,fl);
if (!dp)
return;
atomic_inc(&dp->dl_count);
atomic_inc(&dp->dl_client->cl_count);
spin_lock(&recall_lock);
list_add_tail(&dp->dl_recall_lru, &del_recall_lru);
spin_unlock(&recall_lock);
dp->dl_time = get_seconds();
fl->fl_break_time = 0;
dp->dl_file->fi_had_conflict = true;
nfsd4_cb_recall(dp);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Sets the value of the CC pull up resistor used when operating as a Source. */
|
static int ucpd_select_rp_value(const struct device *dev, enum tc_rp_value rp)
|
/* Sets the value of the CC pull up resistor used when operating as a Source. */
static int ucpd_select_rp_value(const struct device *dev, enum tc_rp_value rp)
|
{
struct tcpc_data *data = dev->data;
data->rp = rp;
return 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Writes byteCount number of bytes to the EZRadio SPI port. */
|
void ezradio_hal_SpiWriteData(uint8_t byteCount, uint8_t *pData)
|
/* Writes byteCount number of bytes to the EZRadio SPI port. */
void ezradio_hal_SpiWriteData(uint8_t byteCount, uint8_t *pData)
|
{
SPIDRV_MTransmitB(ezradioSpiHandlePtr, pData, byteCount);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* This function is meant to be used by either the SW manual IRQ raising or by HW which wants the IRQ to be raised in one delta cycle from now */
|
void hw_irq_ctrl_set_irq(unsigned int irq)
|
/* This function is meant to be used by either the SW manual IRQ raising or by HW which wants the IRQ to be raised in one delta cycle from now */
void hw_irq_ctrl_set_irq(unsigned int irq)
|
{
hw_irq_ctrl_irq_raise_prefix(irq);
if ((irqs_locked == false) || (lock_ignore)) {
irq_ctrl_timer = hwm_get_time();
hwm_find_next_timer();
}
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Return: 0 if all went fine, else return appropriate error. */
|
static int ti_sci_cmd_get_resource_range(const struct ti_sci_handle *handle, u32 dev_id, u8 subtype, u16 *range_start, u16 *range_num)
|
/* Return: 0 if all went fine, else return appropriate error. */
static int ti_sci_cmd_get_resource_range(const struct ti_sci_handle *handle, u32 dev_id, u8 subtype, u16 *range_start, u16 *range_num)
|
{
return ti_sci_get_resource_range(handle, dev_id, subtype,
TI_SCI_IRQ_SECONDARY_HOST_INVALID,
range_start, range_num);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This routine prepares the mailbox command for killing the board in preparation for a graceful shutdown. */
|
void lpfc_kill_board(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
|
/* This routine prepares the mailbox command for killing the board in preparation for a graceful shutdown. */
void lpfc_kill_board(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
|
{
MAILBOX_t *mb = &pmb->u.mb;
memset(pmb, 0, sizeof(LPFC_MBOXQ_t));
mb->mbxCommand = MBX_KILL_BOARD;
mb->mbxOwner = OWN_HOST;
return;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Selects the GPIO pin used as EXTI Line. */
|
void GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource)
|
/* Selects the GPIO pin used as EXTI Line. */
void GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource)
|
{
uint32_t tmp = 0x00;
assert_param(IS_GPIO_EXTI_PORT_SOURCE(GPIO_PortSource));
assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));
tmp = ((uint32_t)0x0F) << (0x04 * (GPIO_PinSource & (uint8_t)0x03));
AFIO->EXTICR[GPIO_PinSource >> 0x02] &= ~tmp;
AFIO->EXTICR[GPIO_PinSource >> 0x02] |= (((uint32_t)GPIO_PortSource) << (0x04 * (GPIO_PinSource & (uint8_t)0x03)));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Determin whether an SmbiosHandle has already in use. */
|
BOOLEAN EFIAPI CheckSmbiosHandleExistance(IN LIST_ENTRY *Head, IN EFI_SMBIOS_HANDLE Handle)
|
/* Determin whether an SmbiosHandle has already in use. */
BOOLEAN EFIAPI CheckSmbiosHandleExistance(IN LIST_ENTRY *Head, IN EFI_SMBIOS_HANDLE Handle)
|
{
LIST_ENTRY *Link;
SMBIOS_HANDLE_ENTRY *HandleEntry;
for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
HandleEntry = SMBIOS_HANDLE_ENTRY_FROM_LINK (Link);
if (HandleEntry->SmbiosHandle == Handle) {
return TRUE;
}
}
return FALSE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* input: tree, buffer (data), offset (data pointer), length of data output: offset return: nothing */
|
static void dissect_bcp_data(proto_tree *bcp_tree, packet_info *pinfo, tvbuff_t *tvb, guint *offset, guint len, gint segcode)
|
/* input: tree, buffer (data), offset (data pointer), length of data output: offset return: nothing */
static void dissect_bcp_data(proto_tree *bcp_tree, packet_info *pinfo, tvbuff_t *tvb, guint *offset, guint len, gint segcode)
|
{
dissector_handle_t handle;
tvbuff_t *next_tvb;
handle = dissector_get_uint_handle(bcp_subdissector_table, segcode);
if (handle)
{
next_tvb = tvb_new_subset(tvb, *offset, len, len);
call_dissector(handle, next_tvb, pinfo, bcp_tree);
*offset += len;
}
else
{
proto_tree_add_item(bcp_tree, hf_bcp_userdata, tvb, *offset, len, ENC_NA);
*offset += len;
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* sGetChanRI used to be a macro in rocket_int.h. When the functionality for the UPCI boards was added, it was decided to make this a function because the macro was getting too complicated. All cases except the first one (UPCIRingInd) are taken directly from the original macro. */
|
static int sGetChanRI(CHANNEL_T *ChP)
|
/* sGetChanRI used to be a macro in rocket_int.h. When the functionality for the UPCI boards was added, it was decided to make this a function because the macro was getting too complicated. All cases except the first one (UPCIRingInd) are taken directly from the original macro. */
static int sGetChanRI(CHANNEL_T *ChP)
|
{
CONTROLLER_t *CtlP = ChP->CtlP;
int ChanNum = ChP->ChanNum;
int RingInd = 0;
if (CtlP->UPCIRingInd)
RingInd = !(sInB(CtlP->UPCIRingInd) & sBitMapSetTbl[ChanNum]);
else if (CtlP->AltChanRingIndicator)
RingInd = sInB((ByteIO_t) (ChP->ChanStat + 8)) & DSR_ACT;
else if (CtlP->boardType == ROCKET_TYPE_PC104)
RingInd = !(sInB(CtlP->AiopIO[3]) & sBitMapSetTbl[ChanNum]);
return RingInd;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Clears RTC compare match flag.
Clears the compare flag. The compare flag is set when there is a compare match between the counter and the compare. */
|
enum status_code rtc_count_clear_compare_match(struct rtc_module *const module, const enum rtc_count_compare comp_index)
|
/* Clears RTC compare match flag.
Clears the compare flag. The compare flag is set when there is a compare match between the counter and the compare. */
enum status_code rtc_count_clear_compare_match(struct rtc_module *const module, const enum rtc_count_compare comp_index)
|
{
Assert(module);
Assert(module->hw);
Rtc *const rtc_module = module->hw;
switch (module->mode){
case RTC_COUNT_MODE_32BIT:
if (comp_index > RTC_COMP32_NUM) {
return STATUS_ERR_INVALID_ARG;
}
break;
case RTC_COUNT_MODE_16BIT:
if (comp_index > RTC_NUM_OF_COMP16) {
return STATUS_ERR_INVALID_ARG;
}
break;
default:
Assert(false);
return STATUS_ERR_BAD_FORMAT;
}
rtc_module->MODE0.INTFLAG.reg = RTC_MODE1_INTFLAG_CMP(1 << comp_index);
return STATUS_OK;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* This is a very generic AC97 sound machine driver for boards which have (AC97) audio at PSC1 (e.g. DB1200 demoboards). */
|
static int au1xpsc_sample_ac97_init(struct snd_soc_codec *codec)
|
/* This is a very generic AC97 sound machine driver for boards which have (AC97) audio at PSC1 (e.g. DB1200 demoboards). */
static int au1xpsc_sample_ac97_init(struct snd_soc_codec *codec)
|
{
snd_soc_dapm_sync(codec);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Quiet time is the time after the first detected tap in which there must not be any overthreshold event. The default value of these bits is 00b which corresponds to 2*ODR_XL time. If the QUIET bits are set to a different value, 1LSB corresponds to 4*ODR_XL time.. */
|
int32_t lsm6dsl_tap_quiet_get(stmdev_ctx_t *ctx, uint8_t *val)
|
/* Quiet time is the time after the first detected tap in which there must not be any overthreshold event. The default value of these bits is 00b which corresponds to 2*ODR_XL time. If the QUIET bits are set to a different value, 1LSB corresponds to 4*ODR_XL time.. */
int32_t lsm6dsl_tap_quiet_get(stmdev_ctx_t *ctx, uint8_t *val)
|
{
lsm6dsl_int_dur2_t int_dur2;
int32_t ret;
ret = lsm6dsl_read_reg(ctx, LSM6DSL_INT_DUR2, (uint8_t*)&int_dur2, 1);
*val = int_dur2.quiet;
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Sets or clears the selected data port bit. */
|
void GPIO_WriteBit(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, BitAction BitVal)
|
/* Sets or clears the selected data port bit. */
void GPIO_WriteBit(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, BitAction BitVal)
|
{
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
assert_param(IS_GET_GPIO_PIN(GPIO_Pin));
assert_param(IS_GPIO_BIT_ACTION(BitVal));
if (BitVal != Bit_RESET)
{
GPIOx->BSRRL = GPIO_Pin;
}
else
{
GPIOx->BSRRH = GPIO_Pin ;
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* In case of loss, reset to default values */
|
static void tcp_illinois_state(struct sock *sk, u8 new_state)
|
/* In case of loss, reset to default values */
static void tcp_illinois_state(struct sock *sk, u8 new_state)
|
{
struct illinois *ca = inet_csk_ca(sk);
if (new_state == TCP_CA_Loss) {
ca->alpha = ALPHA_BASE;
ca->beta = BETA_BASE;
ca->rtt_low = 0;
ca->rtt_above = 0;
rtt_reset(sk);
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function disables USB HS PHY PLL clock. */
|
void CLOCK_DisableUsbhs1PhyPllClock(void)
|
/* This function disables USB HS PHY PLL clock. */
void CLOCK_DisableUsbhs1PhyPllClock(void)
|
{
CCM_ANALOG->PLL_USB2 &= ~CCM_ANALOG_PLL_USB2_EN_USB_CLKS_MASK;
USBPHY2->CTRL |= USBPHY_CTRL_CLKGATE_MASK;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Change the overall interrupt controller "interrupt lock" The interrupt lock is a flag that provisionally disables all interrupts without affecting their status or their ability to be pended in the meanwhile */
|
uint32_t hw_irq_ctrl_change_lock(uint32_t new_lock)
|
/* Change the overall interrupt controller "interrupt lock" The interrupt lock is a flag that provisionally disables all interrupts without affecting their status or their ability to be pended in the meanwhile */
uint32_t hw_irq_ctrl_change_lock(uint32_t new_lock)
|
{
uint32_t previous_lock = irqs_locked;
irqs_locked = new_lock;
if ((previous_lock == true) && (new_lock == false)) {
if (irq_status != 0U) {
nsif_cpu0_irq_raised_from_sw();
}
}
return previous_lock;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* If realloc guarantees that the pointer is not destroyed if the realloc fails, then this routine can go away. */
|
static void* hash_realloc(SEGMENT **p_ptr, int oldsize, int newsize)
|
/* If realloc guarantees that the pointer is not destroyed if the realloc fails, then this routine can go away. */
static void* hash_realloc(SEGMENT **p_ptr, int oldsize, int newsize)
|
{
register void *p;
if (p = malloc(newsize)) {
memmove(p, *p_ptr, oldsize);
memset((char *)p + oldsize, 0, newsize - oldsize);
free(*p_ptr);
*p_ptr = p;
}
return (p);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Initialize sysfs for each logical drive. This sets up and registers the 'c::d#' directory for each individual logical drive under /sys/bus/pci/devices/<dev/ccis#/. We also create a link from /sys/block/cciss!c#d# to this entry. */
|
static long cciss_create_ld_sysfs_entry(struct ctlr_info *h, int drv_index)
|
/* Initialize sysfs for each logical drive. This sets up and registers the 'c::d#' directory for each individual logical drive under /sys/bus/pci/devices/<dev/ccis#/. We also create a link from /sys/block/cciss!c#d# to this entry. */
static long cciss_create_ld_sysfs_entry(struct ctlr_info *h, int drv_index)
|
{
struct device *dev;
if (h->drv[drv_index]->device_initialized)
return 0;
dev = &h->drv[drv_index]->dev;
device_initialize(dev);
dev->type = &cciss_dev_type;
dev->bus = &cciss_bus_type;
dev_set_name(dev, "c%dd%d", h->ctlr, drv_index);
dev->parent = &h->dev;
h->drv[drv_index]->device_initialized = 1;
return device_add(dev);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Config the HASH peripheral according to the specified parameters in the hashConfig. */
|
void HASH_Config(HASH_Config_T *hashConfig)
|
/* Config the HASH peripheral according to the specified parameters in the hashConfig. */
void HASH_Config(HASH_Config_T *hashConfig)
|
{
HASH->CTRL_B.ALGSEL = RESET;
HASH->CTRL_B.DTYPE = RESET;
HASH->CTRL_B.MODESEL = RESET;
HASH->CTRL_B.ALGSEL = hashConfig->algoSelect;
HASH->CTRL_B.DTYPE = hashConfig->dataType;
HASH->CTRL_B.MODESEL = hashConfig->algoMode;
if (hashConfig->algoMode == HASH_ALGO_MODE_HMAC)
{
HASH->CTRL_B.LKEYSEL = RESET;
HASH->CTRL_B.LKEYSEL = hashConfig->hmacKeyType;
}
HASH->CTRL_B.INITCAL = SET;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Function used to retrieve the AirpcapValidationType given the string name. */
|
AirpcapValidationType airpcap_get_validation_type(const gchar *name)
|
/* Function used to retrieve the AirpcapValidationType given the string name. */
AirpcapValidationType airpcap_get_validation_type(const gchar *name)
|
{
if (!(g_ascii_strcasecmp(AIRPCAP_VALIDATION_TYPE_NAME_ALL,name)))
{
return AIRPCAP_VT_ACCEPT_EVERYTHING;
}
else if (!(g_ascii_strcasecmp(AIRPCAP_VALIDATION_TYPE_NAME_CORRECT,name)))
{
return AIRPCAP_VT_ACCEPT_CORRECT_FRAMES;
}
else if (!(g_ascii_strcasecmp(AIRPCAP_VALIDATION_TYPE_NAME_CORRUPT,name)))
{
return AIRPCAP_VT_ACCEPT_CORRUPT_FRAMES;
}
return AIRPCAP_VT_UNKNOWN;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* 20.2.8, adds the label with Octet String to tree; if lvt == 0 then lvt = restOfFrame */
|
static guint fOctetString(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const gchar *label, guint32 lvt)
|
/* 20.2.8, adds the label with Octet String to tree; if lvt == 0 then lvt = restOfFrame */
static guint fOctetString(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const gchar *label, guint32 lvt)
|
{
gchar *tmp;
guint start = offset;
guint8 tag_no, tag_info;
proto_tree *subtree = tree;
offset += fTagHeader(tvb, pinfo, offset, &tag_no, &tag_info, &lvt);
if (lvt > 0) {
tmp = tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, lvt);
subtree = proto_tree_add_subtree_format(tree, tvb, offset, lvt,
ett_bacapp_tag, NULL, "%s %s", label, tmp);
offset += lvt;
}
fTagHeaderTree(tvb, pinfo, subtree, start, &tag_no, &tag_info, &lvt);
return offset;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* If the pointer given is not NULL, VariableLockPolicyVariableNameBufferSize must be non-NULL. */
|
STATIC EFI_STATUS EFIAPI ProtocolGetLockOnVariableStateVariablePolicyInfo(IN CONST CHAR16 *VariableName, IN CONST EFI_GUID *VendorGuid, IN OUT UINTN *VariableLockPolicyVariableNameBufferSize, OPTIONAL OUT VARIABLE_LOCK_ON_VAR_STATE_POLICY *VariablePolicy, OUT CHAR16 *VariableLockPolicyVariableName OPTIONAL)
|
/* If the pointer given is not NULL, VariableLockPolicyVariableNameBufferSize must be non-NULL. */
STATIC EFI_STATUS EFIAPI ProtocolGetLockOnVariableStateVariablePolicyInfo(IN CONST CHAR16 *VariableName, IN CONST EFI_GUID *VendorGuid, IN OUT UINTN *VariableLockPolicyVariableNameBufferSize, OPTIONAL OUT VARIABLE_LOCK_ON_VAR_STATE_POLICY *VariablePolicy, OUT CHAR16 *VariableLockPolicyVariableName OPTIONAL)
|
{
return InternalProtocolGetVariablePolicyInfo (
VAR_CHECK_POLICY_COMMAND_GET_LOCK_VAR_STATE_INFO,
VariableName,
VendorGuid,
VariableLockPolicyVariableNameBufferSize,
VariablePolicy,
VariableLockPolicyVariableName
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Move a node before an other node in the same linked list */
|
void _lv_ll_move_before(lv_ll_t *ll_p, void *n_act, void *n_after)
|
/* Move a node before an other node in the same linked list */
void _lv_ll_move_before(lv_ll_t *ll_p, void *n_act, void *n_after)
|
{
if(n_act == n_after) return;
void * n_before;
if(n_after != NULL)
n_before = _lv_ll_get_prev(ll_p, n_after);
else
n_before = _lv_ll_get_tail(ll_p);
if(n_act == n_before) return;
_lv_ll_remove(ll_p, n_act);
node_set_next(ll_p, n_before, n_act);
node_set_prev(ll_p, n_act, n_before);
node_set_prev(ll_p, n_after, n_act);
node_set_next(ll_p, n_act, n_after);
if(n_after == NULL) ll_p->tail = n_act;
if(n_before == NULL) ll_p->head = n_act;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* 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 AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT8 EFIAPI PciExpressBitFieldAnd8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData)
|
/* 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 AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciExpressBitFieldAnd8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData)
|
{
if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
return (UINT8)-1;
}
return MmioBitFieldAnd8 (
GetPciExpressAddress (Address),
StartBit,
EndBit,
AndData
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */
|
VOID EFIAPI FreeAlignedPages(IN VOID *Buffer, IN UINTN Pages)
|
/* If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */
VOID EFIAPI FreeAlignedPages(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
|
/* Write info about the ZipFile in the *pglobal_info structure. No preparation of the structure is needed return UNZ_OK if there is no problem. */
|
int ZEXPORT unzGetCurrentFileInfo(unzFile file, unz_file_info *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
|
/* Write info about the ZipFile in the *pglobal_info structure. No preparation of the structure is needed return UNZ_OK if there is no problem. */
int ZEXPORT unzGetCurrentFileInfo(unzFile file, unz_file_info *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
|
{
return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
szFileName,fileNameBufferSize,
extraField,extraFieldBufferSize,
szComment,commentBufferSize);
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* Release a list of pages which are strung together on page.lru. Currently used by read_cache_pages() and related error recovery code. */
|
void put_pages_list(struct list_head *pages)
|
/* Release a list of pages which are strung together on page.lru. Currently used by read_cache_pages() and related error recovery code. */
void put_pages_list(struct list_head *pages)
|
{
while (!list_empty(pages)) {
struct page *victim;
victim = list_entry(pages->prev, struct page, lru);
list_del(&victim->lru);
page_cache_release(victim);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* We don't do error checks by calling clear_master_aborts() b/c the assumption is that the caller did a read first to make sure a device exists. */
|
int ixp2000_pci_write_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
|
/* We don't do error checks by calling clear_master_aborts() b/c the assumption is that the caller did a read first to make sure a device exists. */
int ixp2000_pci_write_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
|
{
u32 mask;
u32 *addr;
u32 temp;
mask = ~(bytemask[size] << ((where % 0x4) * 8));
addr = ixp2000_pci_config_addr(bus->number, devfn, where);
if (!addr)
return PCIBIOS_DEVICE_NOT_FOUND;
temp = (u32) (value) << ((where % 0x4) * 8);
*addr = (*addr & mask) | temp;
clear_master_aborts();
return PCIBIOS_SUCCESSFUL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Un-Register the Service B.3 and all its Characteristics... */
|
void service_b_3_2_remove(void)
|
/* Un-Register the Service B.3 and all its Characteristics... */
void service_b_3_2_remove(void)
|
{
bt_gatt_service_unregister(&service_b_3_2_svc);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* FF: EVPL Generalized Label, see RFC6004 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Rsvd | VLAN ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
|
static void dissect_glabel_evpl(proto_tree *ti _U_, proto_tree *rsvp_object_tree, tvbuff_t *tvb, int offset)
|
/* FF: EVPL Generalized Label, see RFC6004 0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Rsvd | VLAN ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */
static void dissect_glabel_evpl(proto_tree *ti _U_, proto_tree *rsvp_object_tree, tvbuff_t *tvb, int offset)
|
{
int bit_offset;
guint16 vlan_id = ((tvb_get_ntohs(tvb,offset) << 4) & 0xFFFF);
bit_offset = (offset<<2)+3;
proto_tree_add_bits_item(rsvp_object_tree,hf_rsvp_label_generalized_label_evpl_vlad_id,tvb, bit_offset, 12, ENC_BIG_ENDIAN);
proto_item_append_text(ti, ": EVPL Generalized Label: "
"VLAN ID = %u" ,vlan_id);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Handles inputs from characters (ASCII key + Backspace + return) */
|
EFI_STATUS FileBufferDoCharInput(IN CONST CHAR16 Char)
|
/* Handles inputs from characters (ASCII key + Backspace + return) */
EFI_STATUS FileBufferDoCharInput(IN CONST CHAR16 Char)
|
{
EFI_STATUS Status;
Status = EFI_SUCCESS;
switch (Char) {
case CHAR_NULL:
break;
case CHAR_BACKSPACE:
Status = FileBufferDoBackspace ();
break;
case CHAR_TAB:
break;
case CHAR_LINEFEED:
case CHAR_CARRIAGE_RETURN:
Status = FileBufferDoReturn ();
break;
default:
if ((Char > 127) || (Char < 32)) {
Status = StatusBarSetStatusString (L"Unknown Command");
} else {
Status = FileBufferAddChar (Char);
}
break;
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set the opa scale enable parameter (required to set opa_scale with */
|
void lv_obj_set_opa_scale_enable(lv_obj_t *obj, bool en)
|
/* Set the opa scale enable parameter (required to set opa_scale with */
void lv_obj_set_opa_scale_enable(lv_obj_t *obj, bool en)
|
{
obj->opa_scale_en = en ? 1 : 0;
}
|
RavenSystem/esp-homekit-devices
|
C++
|
Other
| 2,577
|
/* hmac_sha256 - HMAC-SHA256 over data buffer (RFC 2104) @key: Key for HMAC operations @key_len: Length of the key in bytes @data: Pointers to the data area @data_len: Length of the data area @mac: Buffer for the hash (20 bytes) */
|
void hmac_sha256(const u8 *key, size_t key_len, const u8 *data, size_t data_len, u8 *mac)
|
/* hmac_sha256 - HMAC-SHA256 over data buffer (RFC 2104) @key: Key for HMAC operations @key_len: Length of the key in bytes @data: Pointers to the data area @data_len: Length of the data area @mac: Buffer for the hash (20 bytes) */
void hmac_sha256(const u8 *key, size_t key_len, const u8 *data, size_t data_len, u8 *mac)
|
{
hmac_sha256_vector(key, key_len, 1, &data, &data_len, mac);
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* According to WHCI 0.95 the driver will only receive the RCEB of a SET IE command after the device sent the first beacon that includes the IEs specified in the SET IE command. So, after we start beaconing we check if there is anything in the IE cache and call the SET IE command if needed. */
|
int uwb_rc_beacon(struct uwb_rc *rc, int channel, unsigned bpst_offset)
|
/* According to WHCI 0.95 the driver will only receive the RCEB of a SET IE command after the device sent the first beacon that includes the IEs specified in the SET IE command. So, after we start beaconing we check if there is anything in the IE cache and call the SET IE command if needed. */
int uwb_rc_beacon(struct uwb_rc *rc, int channel, unsigned bpst_offset)
|
{
int result;
struct device *dev = &rc->uwb_dev.dev;
if (channel < 0)
channel = -1;
if (channel == -1)
result = uwb_rc_stop_beacon(rc);
else {
result = uwb_rc_start_beacon(rc, bpst_offset, channel);
if (result < 0)
return result;
if (le16_to_cpu(rc->ies->wIELength) > 0) {
result = uwb_rc_set_ie(rc, rc->ies);
if (result < 0) {
dev_err(dev, "Cannot set new IE on device: "
"%d\n", result);
result = uwb_rc_stop_beacon(rc);
channel = -1;
bpst_offset = 0;
}
}
}
if (result >= 0)
rc->beaconing = channel;
return result;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Called by the usb core when the device is removed from the system. */
|
static void adu_disconnect(struct usb_interface *interface)
|
/* Called by the usb core when the device is removed from the system. */
static void adu_disconnect(struct usb_interface *interface)
|
{
struct adu_device *dev;
int minor;
dbg(2," %s : enter", __func__);
dev = usb_get_intfdata(interface);
mutex_lock(&dev->mtx);
dev->udev = NULL;
minor = dev->minor;
usb_deregister_dev(interface, &adu_class);
mutex_unlock(&dev->mtx);
mutex_lock(&adutux_mutex);
usb_set_intfdata(interface, NULL);
dbg(2," %s : open count %d", __func__, dev->open_count);
if (!dev->open_count)
adu_delete(dev);
mutex_unlock(&adutux_mutex);
dev_info(&interface->dev, "ADU device adutux%d now disconnected\n",
(minor - ADU_MINOR_BASE));
dbg(2," %s : leave", __func__);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configure USB Device Endpoint according to Descriptor Parameters: pEPD: Pointer to Device Endpoint Descriptor Return Value: None */
|
void USBD_ConfigEP(USB_ENDPOINT_DESCRIPTOR *pEPD)
|
/* Configure USB Device Endpoint according to Descriptor Parameters: pEPD: Pointer to Device Endpoint Descriptor Return Value: None */
void USBD_ConfigEP(USB_ENDPOINT_DESCRIPTOR *pEPD)
|
{
uint32_t num;
num = pEPD->bEndpointAddress & 0x0F;
if (pEPD->wMaxPacketSize <= USBD_GetSizeEP(num)) {
UDPHS->UDPHS_EPT[num].UDPHS_EPTCTLENB =
(0x1 << 9) |
(0x1 << 10) |
(0x0 << 4) |
(0x1 << 13) ;
}
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* f* bus_vcxk/vcxk_loadimage FUNCTION copies a binary image to display memory */
|
void vcxk_loadimage(ulong source)
|
/* f* bus_vcxk/vcxk_loadimage FUNCTION copies a binary image to display memory */
void vcxk_loadimage(ulong source)
|
{
int cnt;
vcxk_acknowledge_wait();
if (VC4K16) {
for (cnt = 0; cnt < (16384 / 4); cnt++) {
VCXK_BWS_LONG(cnt, (*(ulong *) source));
source = source + 4;
}
} else {
for (cnt = 0; cnt < 16384; cnt++) {
VCXK_BWS_LONG(cnt*2, (*(vu_char *) source));
source++;
}
}
vcxk_request();
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* DMA Channel Clear Interrupt Flag.
The interrupt flag for the channel is cleared. More than one interrupt for the same channel may be cleared by using the logical OR of the interrupt flags. */
|
void dma_clear_interrupt_flags(uint32_t dma, uint8_t channel, uint32_t interrupts)
|
/* DMA Channel Clear Interrupt Flag.
The interrupt flag for the channel is cleared. More than one interrupt for the same channel may be cleared by using the logical OR of the interrupt flags. */
void dma_clear_interrupt_flags(uint32_t dma, uint8_t channel, uint32_t interrupts)
|
{
uint32_t flags = (interrupts << DMA_FLAG_OFFSET(channel));
DMA_IFCR(dma) = flags;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* This is the Guest timer interrupt handler (hardware interrupt 0). We just call the clockevent infrastructure and it does whatever needs doing. */
|
static void lguest_time_irq(unsigned int irq, struct irq_desc *desc)
|
/* This is the Guest timer interrupt handler (hardware interrupt 0). We just call the clockevent infrastructure and it does whatever needs doing. */
static void lguest_time_irq(unsigned int irq, struct irq_desc *desc)
|
{
unsigned long flags;
local_irq_save(flags);
lguest_clockevent.event_handler(&lguest_clockevent);
local_irq_restore(flags);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Message: AddParticipantResMessage Opcode: 0x0038 Type: IntraCCM Direction: pbx2pbx VarLength: no */
|
static void handle_AddParticipantResMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
/* Message: AddParticipantResMessage Opcode: 0x0038 Type: IntraCCM Direction: pbx2pbx VarLength: no */
static void handle_AddParticipantResMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
{
ptvcursor_add(cursor, hf_skinny_conferenceID, 4, ENC_LITTLE_ENDIAN);
si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_add_participant_result, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_bridgeParticipantId, 257, ENC_ASCII|ENC_NA);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.