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 |
|---|---|---|---|---|---|---|---|
/* Retrieves pointer to an iface by the index that corresponds to it in iface_states. */ | static struct net_if* conn_mgr_mon_get_if_by_index(int index) | /* Retrieves pointer to an iface by the index that corresponds to it in iface_states. */
static struct net_if* conn_mgr_mon_get_if_by_index(int index) | {
return net_if_get_by_index(index + 1);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Detach a thread (thread storage can be reclaimed when thread terminates). */ | static osStatus_t svcRtxThreadDetach(osThreadId_t thread_id) | /* Detach a thread (thread storage can be reclaimed when thread terminates). */
static osStatus_t svcRtxThreadDetach(osThreadId_t thread_id) | {
EvrRtxThreadError(thread, (int32_t)osErrorParameter);
return osErrorParameter;
}
if ((thread->attr & osThreadJoinable) == 0U) {
EvrRtxThreadError(thread, osRtxErrorThreadNotJoinable);
return osErrorResource;
}
if (thread->state == osRtxThreadTerminated) {
osRtxThreadListUnlink(&osRtxInfo.thread.terminate_list, thread);
osRtxThreadFree(thread);
} else {
thread->attr &= ~osThreadJoinable;
}
EvrRtxThreadDetached(thread);
return osOK;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* data size must be aligned to 6 bytes to ensure the 24bit alignment on DSP. NB: call with a certain lock! */ | static void vxp_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime, struct vx_pipe *pipe, int count) | /* data size must be aligned to 6 bytes to ensure the 24bit alignment on DSP. NB: call with a certain lock! */
static void vxp_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime, struct vx_pipe *pipe, int count) | {
long port = vxp_reg_addr(chip, VX_DMA);
int offset = pipe->hw_ptr;
unsigned short *addr = (unsigned short *)(runtime->dma_area + offset);
vx_setup_pseudo_dma(chip, 1);
if (offset + count > pipe->buffer_bytes) {
int length = pipe->buffer_bytes - offset;
count -= length;
length >>= 1;
while (length-- > 0) {
outw(cpu_to_le16(*addr), port);
addr++;
}
addr = (unsigned short *)runtime->dma_area;
pipe->hw_ptr = 0;
}
pipe->hw_ptr += count;
count >>= 1;
while (count-- > 0) {
outw(cpu_to_le16(*addr), port);
addr++;
}
vx_release_pseudo_dma(chip);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If the number overflows according to the range defined by UINT64, then ASSERT(). */ | STATIC XENSTORE_STATUS XenBusReadUint64(IN XENBUS_PROTOCOL *This, IN CONST CHAR8 *Node, IN BOOLEAN FromBackend, OUT UINT64 *ValuePtr) | /* If the number overflows according to the range defined by UINT64, then ASSERT(). */
STATIC XENSTORE_STATUS XenBusReadUint64(IN XENBUS_PROTOCOL *This, IN CONST CHAR8 *Node, IN BOOLEAN FromBackend, OUT UINT64 *ValuePtr) | {
XENSTORE_STATUS Status;
CHAR8 *Ptr;
if (!FromBackend) {
Status = This->XsRead (This, XST_NIL, Node, (VOID **)&Ptr);
} else {
Status = This->XsBackendRead (This, XST_NIL, Node, (VOID **)&Ptr);
}
if (Status != XENSTORE_STATUS_SUCCESS) {
return Status;
}
*ValuePtr = AsciiStrDecimalToUint64 (Ptr);
FreePool (Ptr);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If 32-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, 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(). */ | UINT32 EFIAPI S3IoBitFieldOr32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData) | /* If 32-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, 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(). */
UINT32 EFIAPI S3IoBitFieldOr32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData) | {
return InternalSaveIoWrite32ValueToBootScript (Port, IoBitFieldOr32 (Port, StartBit, EndBit, OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* We use Alarm A, because Alarm B is already used to emulate update interrupt. */ | static int stm32f2_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | /* We use Alarm A, because Alarm B is already used to emulate update interrupt. */
static int stm32f2_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | {
struct stm32f2_rtc *rtc = dev_get_drvdata(dev);
struct rtc_time *tm = &alrm->time;
int rv;
if (rtc_valid_tm(tm)) {
rv = -EINVAL;
goto out;
}
spin_lock_irq(&rtc->lock);
stm32f2_setup_alarm(
0, tm->tm_mday, tm->tm_wday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
if (alrm->enabled)
stm32f2_alarm_irq_enable(0, 1);
spin_unlock_irq(&rtc->lock);
rv = 0;
out:
return rv;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configures the input sampling mode for a group of pins.
Configures the input sampling mode for a group of pins, to control when the physical I/O pin value is sampled and stored inside the microcontroller. */ | void system_pinmux_group_set_input_sample_mode(PortGroup *const port, const uint32_t mask, const enum system_pinmux_pin_sample mode) | /* Configures the input sampling mode for a group of pins.
Configures the input sampling mode for a group of pins, to control when the physical I/O pin value is sampled and stored inside the microcontroller. */
void system_pinmux_group_set_input_sample_mode(PortGroup *const port, const uint32_t mask, const enum system_pinmux_pin_sample mode) | {
Assert(port);
if (mode == SYSTEM_PINMUX_PIN_SAMPLE_ONDEMAND) {
port->CTRL.reg |= mask;
} else {
port->CTRL.reg &= ~mask;
}
} | memfault/zero-to-main | C++ | null | 200 |
/* function : wb_ebios_update_regs(u32 sel) description : transform user config into hw config parameters : sel <controller select> return : 0 success -1 fail */ | s32 wb_ebios_update_regs(u32 sel) | /* function : wb_ebios_update_regs(u32 sel) description : transform user config into hw config parameters : sel <controller select> return : 0 success -1 fail */
s32 wb_ebios_update_regs(u32 sel) | {
wb_ebios_set_para(sel, &wb_config);
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Initializes the tim Channel2 according to the specified parameters in the init_struct. */ | void TIM_OC2Init(TIM_TypeDef *tim, TIM_OCInitTypeDef *init_struct) | /* Initializes the tim Channel2 according to the specified parameters in the init_struct. */
void TIM_OC2Init(TIM_TypeDef *tim, TIM_OCInitTypeDef *init_struct) | {
MODIFY_REG(tim->CCMR1, TIM_CCMR1_OC2M, init_struct->TIM_OCMode << 8);
MODIFY_REG(tim->CCER, TIM_CCER_CC2EN | TIM_CCER_CC2P, \
(init_struct->TIM_OCPolarity << 4) | (init_struct->TIM_OutputState << 4));
WRITE_REG(tim->CCR2, init_struct->TIM_Pulse);
if ((tim == TIM1) || (tim == TIM8)) {
MODIFY_REG(tim->CCER, TIM_CCER_CC2NP | TIM_CCER_CC2NEN, \
(init_struct->TIM_OCNPolarity << 4) | (init_struct->TIM_OutputNState << 4));
MODIFY_REG(tim->CR2, TIM_CR2_OIS2 | TIM_CR2_OIS2N, \
(init_struct->TIM_OCIdleState << 2) | (init_struct->TIM_OCNIdleState << 2));
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Reads the values present of the specified pin(s). The values at the specified pin(s) are read, as specified by */ | unsigned long xGPIOPinRead(unsigned long ulPort, unsigned long ulPins) | /* Reads the values present of the specified pin(s). The values at the specified pin(s) are read, as specified by */
unsigned long xGPIOPinRead(unsigned long ulPort, unsigned long ulPins) | {
xASSERT(GPIOBaseValid(ulPort));
return (xHWREG(ulPort +GPIO_PIN ) & (ulPins)) ? 1:0;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* The caller must have already set SCCR, SERDES and the PCIE_LAW BARs must have been set to cover all of the requested regions. */ | void mpc83xx_pcie_init(int num_buses, struct pci_region **reg, int warmboot) | /* The caller must have already set SCCR, SERDES and the PCIE_LAW BARs must have been set to cover all of the requested regions. */
void mpc83xx_pcie_init(int num_buses, struct pci_region **reg, int warmboot) | {
int i;
udelay(warmboot ? 1000 : 100000);
for (i = 0; i < num_buses; i++)
mpc83xx_pcie_init_bus(i, reg[i]);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Clear the time-base counter reached its maximum value flag of selected channel. */ | void PWM_ClearWrapAroundFlag(PWM_T *pwm, uint32_t u32ChannelNum) | /* Clear the time-base counter reached its maximum value flag of selected channel. */
void PWM_ClearWrapAroundFlag(PWM_T *pwm, uint32_t u32ChannelNum) | {
(pwm)->STATUS = (PWM_STATUS_CNTMAX0_Msk << ((u32ChannelNum >> 1UL) << 1UL));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Add this directory entry node to the list of directory entries and hash table. */ | STATIC VOID FatAddDirEnt(IN FAT_ODIR *ODir, IN FAT_DIRENT *DirEnt) | /* Add this directory entry node to the list of directory entries and hash table. */
STATIC VOID FatAddDirEnt(IN FAT_ODIR *ODir, IN FAT_DIRENT *DirEnt) | {
if (DirEnt->Link.BackLink == NULL) {
DirEnt->Link.BackLink = &ODir->ChildList;
}
InsertTailList (DirEnt->Link.BackLink, &DirEnt->Link);
FatInsertToHashTable (ODir, DirEnt);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* GPMI Init Data Sample Delay.
This function determines the fraction of GPMI period for the data sample delay period per delay count. The data sample delay period per cycle is a fraction of the GPMI clock. The fraction amount is a function of chip type and GPMI clock speed. */ | uint32_t gpmi_init_data_sample_delay(uint32_t u32GpmiPeriod_ns) | /* GPMI Init Data Sample Delay.
This function determines the fraction of GPMI period for the data sample delay period per delay count. The data sample delay period per cycle is a fraction of the GPMI clock. The fraction amount is a function of chip type and GPMI clock speed. */
uint32_t gpmi_init_data_sample_delay(uint32_t u32GpmiPeriod_ns) | {
uint32_t retVal = GPMI_DELAY_SHIFT;
BW_GPMI_CTRL1_DLL_ENABLE(0);
BW_GPMI_CTRL1_RDN_DELAY(0);
if (u32GpmiPeriod_ns > GPMI_DLL_HALF_THRESHOLD_PERIOD_NS )
{
BW_GPMI_CTRL1_HALF_PERIOD(1);
retVal++;
}
return (1 << retVal);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* sdio_register_driver - register a function driver @drv: SDIO function driver */ | int sdio_register_driver(struct sdio_driver *drv) | /* sdio_register_driver - register a function driver @drv: SDIO function driver */
int sdio_register_driver(struct sdio_driver *drv) | {
drv->drv.name = drv->name;
drv->drv.bus = &sdio_bus_type;
return driver_register(&drv->drv);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Handle various control requests related to the msc storage interface. */ | static enum usbd_request_return_codes msc_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, usbd_control_complete_callback *complete) | /* Handle various control requests related to the msc storage interface. */
static enum usbd_request_return_codes msc_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, usbd_control_complete_callback *complete) | {
(void)complete;
(void)usbd_dev;
switch (req->bRequest) {
case USB_MSC_REQ_BULK_ONLY_RESET:
return USBD_REQ_HANDLED;
case USB_MSC_REQ_GET_MAX_LUN:
*buf[0] = 0;
*len = 1;
return USBD_REQ_HANDLED;
}
return USBD_REQ_NOTSUPP;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Put mfxstm32l152 Device in Low Power standby mode. */ | void mfxstm32l152_LowPower(uint16_t DeviceAddr) | /* Put mfxstm32l152 Device in Low Power standby mode. */
void mfxstm32l152_LowPower(uint16_t DeviceAddr) | {
MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL, MFXSTM32L152_STANDBY);
MFX_IO_EnableWakeupPin();
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Gets the current setting of the FIFO service request level. */ | unsigned long I2STxFIFOLimitGet(unsigned long ulBase) | /* Gets the current setting of the FIFO service request level. */
unsigned long I2STxFIFOLimitGet(unsigned long ulBase) | {
ASSERT(ulBase == I2S0_BASE);
return(HWREG(ulBase + I2S_O_TXLIMIT));
} | watterott/WebRadio | C++ | null | 71 |
/* Add a packet to the end of our sent and received packets, so that we may use it to calculate the hash at the end. */ | void ICACHE_FLASH_ATTR add_packet(SSL *ssl, const uint8_t *pkt, int len) | /* Add a packet to the end of our sent and received packets, so that we may use it to calculate the hash at the end. */
void ICACHE_FLASH_ATTR add_packet(SSL *ssl, const uint8_t *pkt, int len) | {
MD5_Update(&ssl->dc->md5_ctx, pkt, len);
SHA1_Update(&ssl->dc->sha1_ctx, pkt, len);
} | eerimoq/simba | C++ | Other | 337 |
/* get_node_path fills in @path with the firmware path to the device. Note that if @node is a parisc device, we don't fill in the 'mod' field. This is because both callers pass the parent and fill in the mod themselves. If @node is a PCI device, we do fill it in, even though this is inconsistent. */ | static void get_node_path(struct device *dev, struct hardware_path *path) | /* get_node_path fills in @path with the firmware path to the device. Note that if @node is a parisc device, we don't fill in the 'mod' field. This is because both callers pass the parent and fill in the mod themselves. If @node is a PCI device, we do fill it in, even though this is inconsistent. */
static void get_node_path(struct device *dev, struct hardware_path *path) | {
int i = 5;
memset(&path->bc, -1, 6);
if (is_pci_dev(dev)) {
unsigned int devfn = to_pci_dev(dev)->devfn;
path->mod = PCI_FUNC(devfn);
path->bc[i--] = PCI_SLOT(devfn);
dev = dev->parent;
}
while (dev != &root) {
if (is_pci_dev(dev)) {
unsigned int devfn = to_pci_dev(dev)->devfn;
path->bc[i--] = PCI_SLOT(devfn) | (PCI_FUNC(devfn)<< 5);
} else if (dev->bus == &parisc_bus_type) {
path->bc[i--] = to_parisc_device(dev)->hw_path;
}
dev = dev->parent;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Translate the information from the head of the received TCP segment Nbuf contents and fill it into a TCP_SEG structure. */ | TCP_SEG* TcpFormatNetbuf(IN TCP_CB *Tcb, IN OUT NET_BUF *Nbuf) | /* Translate the information from the head of the received TCP segment Nbuf contents and fill it into a TCP_SEG structure. */
TCP_SEG* TcpFormatNetbuf(IN TCP_CB *Tcb, IN OUT NET_BUF *Nbuf) | {
TCP_SEG *Seg;
TCP_HEAD *Head;
Seg = TCPSEG_NETBUF (Nbuf);
Head = (TCP_HEAD *)NetbufGetByte (Nbuf, 0, NULL);
ASSERT (Head != NULL);
Nbuf->Tcp = Head;
Seg->Seq = NTOHL (Head->Seq);
Seg->Ack = NTOHL (Head->Ack);
Seg->End = Seg->Seq + (Nbuf->TotalSize - (Head->HeadLen << 2));
Seg->Urg = NTOHS (Head->Urg);
Seg->Wnd = (NTOHS (Head->Wnd) << Tcb->SndWndScale);
Seg->Flag = Head->Flag;
if (TCP_FLG_ON (Seg->Flag, TCP_FLG_SYN)) {
Seg->Wnd = NTOHS (Head->Wnd);
Seg->End++;
}
if (TCP_FLG_ON (Seg->Flag, TCP_FLG_FIN)) {
Seg->End++;
}
return Seg;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the DMA Current Destination Address of a channel. */ | unsigned long DMACurrentDestAddrGet(unsigned long ulChannelID) | /* Get the DMA Current Destination Address of a channel. */
unsigned long DMACurrentDestAddrGet(unsigned long ulChannelID) | {
xASSERT(xDMAChannelIDValid(ulChannelID));
return xHWREG(g_psDMAChannelAddress[ulChannelID] + DMA_DAR);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Since sending a list of ascbs is a superset of sending a single ascb, this function exists to generalize this. More specifically, when sending a list of those, we want to do only a */ | int asd_post_escb_list(struct asd_ha_struct *asd_ha, struct asd_ascb *ascb, int num) | /* Since sending a list of ascbs is a superset of sending a single ascb, this function exists to generalize this. More specifically, when sending a list of those, we want to do only a */
int asd_post_escb_list(struct asd_ha_struct *asd_ha, struct asd_ascb *ascb, int num) | {
unsigned long flags;
spin_lock_irqsave(&asd_ha->seq.pend_q_lock, flags);
asd_swap_head_scb(asd_ha, ascb);
asd_ha->seq.scbpro += num;
asd_write_reg_dword(asd_ha, SCBPRO, (u32)asd_ha->seq.scbpro);
spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Init USART0 for asynchronous IrDA mode.
Notice that pins used by the USART/UART module must be properly configured by the user explicitly, in order for the USART/UART to work as intended. (When configuring pins, one should remember to consider the sequence of configuration, in order to avoid unintended pulses/glitches on output pins.) */ | void USART_InitIrDA(const USART_InitIrDA_TypeDef *init) | /* Init USART0 for asynchronous IrDA mode.
Notice that pins used by the USART/UART module must be properly configured by the user explicitly, in order for the USART/UART to work as intended. (When configuring pins, one should remember to consider the sequence of configuration, in order to avoid unintended pulses/glitches on output pins.) */
void USART_InitIrDA(const USART_InitIrDA_TypeDef *init) | {
USART_InitAsync(USART0, &(init->async));
USART0->CTRL |= USART_CTRL_TXINV;
if (init->irRxInv)
{
USART0->CTRL |= USART_CTRL_RXINV;
}
USART0->IRCTRL |= (uint32_t)init->irPw |
(uint32_t)init->irPrsSel |
((uint32_t)init->irFilt << _USART_IRCTRL_IRFILT_SHIFT) |
((uint32_t)init->irPrsEn << _USART_IRCTRL_IRPRSEN_SHIFT);
USART0->IRCTRL |= USART_IRCTRL_IREN;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Message: UnSubscribeDtmfPayloadReqMessage Opcode: 0x012c Type: CallControl Direction: pbx2dev VarLength: no */ | static void handle_UnSubscribeDtmfPayloadReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | /* Message: UnSubscribeDtmfPayloadReqMessage Opcode: 0x012c Type: CallControl Direction: pbx2dev VarLength: no */
static void handle_UnSubscribeDtmfPayloadReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | {
ptvcursor_add(cursor, hf_skinny_payloadDtmf, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_conferenceID, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_passthruPartyID, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_dtmfType, 4, ENC_LITTLE_ENDIAN);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Check whether the RX ring buffer is full. */ | static bool UART_TransferIsRxRingBufferFull(uart_handle_t *handle) | /* Check whether the RX ring buffer is full. */
static bool UART_TransferIsRxRingBufferFull(uart_handle_t *handle) | {
bool full;
if (UART_TransferGetRxRingBufferLength(handle) == (handle->rxRingBufferSize - 1U))
{
full = true;
}
else
{
full = false;
}
return full;
} | labapart/polymcu | C++ | null | 201 |
/* If the firmware provided a valid FDT at boot time, let's expose it in ${fdt_addr} so it may be passed unmodified to the kernel. */ | static void set_fdt_addr(void) | /* If the firmware provided a valid FDT at boot time, let's expose it in ${fdt_addr} so it may be passed unmodified to the kernel. */
static void set_fdt_addr(void) | {
if (env_get("fdt_addr"))
return;
if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
return;
env_set_hex("fdt_addr", fw_dtb_pointer);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Start up processing on an i960 based AAC adapter */ | static void aac_rx_start_adapter(struct aac_dev *dev) | /* Start up processing on an i960 based AAC adapter */
static void aac_rx_start_adapter(struct aac_dev *dev) | {
struct aac_init *init;
init = dev->init;
init->HostElapsedSeconds = cpu_to_le32(get_seconds());
rx_sync_cmd(dev, INIT_STRUCT_BASE_ADDRESS, (u32)(ulong)dev->init_pa,
0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* g e t I n d e x */ | int Indexlist_getIndex(Indexlist *_THIS, int givennumber) | /* g e t I n d e x */
int Indexlist_getIndex(Indexlist *_THIS, int givennumber) | {
int myIndex = Indexlist_findInsert(_THIS,givennumber);
return _THIS->number[_THIS->iSort[myIndex]] == givennumber ? _THIS->iSort[myIndex] : -1;
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* Enables or disables the accelerometer and gyroscope GPIO interrupt. */ | uint32_t BOARD_imuEnableIRQ(bool enable) | /* Enables or disables the accelerometer and gyroscope GPIO interrupt. */
uint32_t BOARD_imuEnableIRQ(bool enable) | {
uint32_t status;
status = BOARD_picRegBitsSet( BOARD_PIC_REG_INT_ENABLE, enable, BOARD_PIC_REG_INT_ENABLE_IMU );
return status;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Sets the intensity control register (0..15 or 0x00..0x0F) */ | as1115Error_t as1115SetBrightness(uint8_t x) | /* Sets the intensity control register (0..15 or 0x00..0x0F) */
as1115Error_t as1115SetBrightness(uint8_t x) | {
as1115Error_t error = AS1115_ERROR_OK;
if (x > 0xF) x = 0xF;
error = as1115WriteCmdData(AS1115_SUBADDRESS, AS1115_INTENSITY, x);
return error;
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Reads the MMIO registers specified by Address with registers width specified by Width. The read value is returned. If such operations are not supported, then ASSERT(). This function must guarantee that all MMIO read and write operations are serialized. */ | UINT64 EFIAPI MmioReadWorker(IN UINTN Address, IN EFI_SMM_IO_WIDTH Width) | /* Reads the MMIO registers specified by Address with registers width specified by Width. The read value is returned. If such operations are not supported, then ASSERT(). This function must guarantee that all MMIO read and write operations are serialized. */
UINT64 EFIAPI MmioReadWorker(IN UINTN Address, IN EFI_SMM_IO_WIDTH Width) | {
EFI_STATUS Status;
UINT64 Data;
Status = gSmst->SmmIo.Mem.Read (&gSmst->SmmIo, Width, Address, 1, &Data);
ASSERT_EFI_ERROR (Status);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Clean up a route cache, that is free all the route cache entries enqueued in the cache. */ | VOID Ip4CleanRouteCache(IN IP4_ROUTE_CACHE *RtCache) | /* Clean up a route cache, that is free all the route cache entries enqueued in the cache. */
VOID Ip4CleanRouteCache(IN IP4_ROUTE_CACHE *RtCache) | {
LIST_ENTRY *Entry;
LIST_ENTRY *Next;
IP4_ROUTE_CACHE_ENTRY *RtCacheEntry;
UINT32 Index;
for (Index = 0; Index < IP4_ROUTE_CACHE_HASH_VALUE; Index++) {
NET_LIST_FOR_EACH_SAFE (Entry, Next, &(RtCache->CacheBucket[Index])) {
RtCacheEntry = NET_LIST_USER_STRUCT (Entry, IP4_ROUTE_CACHE_ENTRY, Link);
RemoveEntryList (Entry);
Ip4FreeRouteCacheEntry (RtCacheEntry);
}
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Shutdown the RTC hardware @rtc RTC private data structure */ | static int kinetis_rtc_hw_shutdown(struct kinetis_rtc *rtc) | /* Shutdown the RTC hardware @rtc RTC private data structure */
static int kinetis_rtc_hw_shutdown(struct kinetis_rtc *rtc) | {
int ret = 0;
d_printk(1, "ret=%d\n", ret);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Called on boot to increment a count stored in the EEPROM. This is used to ensure the CPU does not reset unexpectedly. */ | static void prvIncrementResetCount(void) | /* Called on boot to increment a count stored in the EEPROM. This is used to ensure the CPU does not reset unexpectedly. */
static void prvIncrementResetCount(void) | {
unsigned char ucCount;
eeprom_read_block( &ucCount, mainRESET_COUNT_ADDRESS, sizeof( ucCount ) );
ucCount++;
eeprom_write_byte( mainRESET_COUNT_ADDRESS, ucCount );
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Builds a pdu frame as an RNR command. */ | void llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) | /* Builds a pdu frame as an RNR command. */
void llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) | {
struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_CMD_RNR;
pdu->ctrl_2 = 0;
pdu->ctrl_2 |= p_bit & LLC_S_PF_BIT_MASK;
pdu->ctrl_1 &= 0x0F;
pdu->ctrl_2 |= (nr << 1) & 0xFE;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* RETURNS: Pointer to temp pages array on success, NULL on failure. */ | static struct page** pcpu_get_pages_and_bitmap(struct pcpu_chunk *chunk, unsigned long **bitmapp, bool may_alloc) | /* RETURNS: Pointer to temp pages array on success, NULL on failure. */
static struct page** pcpu_get_pages_and_bitmap(struct pcpu_chunk *chunk, unsigned long **bitmapp, bool may_alloc) | {
static struct page **pages;
static unsigned long *bitmap;
size_t pages_size = pcpu_nr_units * pcpu_unit_pages * sizeof(pages[0]);
size_t bitmap_size = BITS_TO_LONGS(pcpu_unit_pages) *
sizeof(unsigned long);
if (!pages || !bitmap) {
if (may_alloc && !pages)
pages = pcpu_mem_alloc(pages_size);
if (may_alloc && !bitmap)
bitmap = pcpu_mem_alloc(bitmap_size);
if (!pages || !bitmap)
return NULL;
}
memset(pages, 0, pages_size);
bitmap_copy(bitmap, chunk->populated, pcpu_unit_pages);
*bitmapp = bitmap;
return pages;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* VDM Discover Mode callback (report all the modes supported by SVID) */ | static USBPD_StatusTypeDef USBPD_VDM_DiscoverModes(uint8_t PortNum, uint16_t SVID, uint32_t **p_ModeInfo, uint8_t *nbMode) | /* VDM Discover Mode callback (report all the modes supported by SVID) */
static USBPD_StatusTypeDef USBPD_VDM_DiscoverModes(uint8_t PortNum, uint16_t SVID, uint32_t **p_ModeInfo, uint8_t *nbMode) | {
USBPD_StatusTypeDef _status = USBPD_NAK;
switch(SVID)
{
case DISPLAY_PORT_SVID :
*nbMode = 2;
*p_ModeInfo = (uint32_t *)vdo_dp_modes;
_status = USBPD_ACK;
break;
default :
*nbMode = 0;
*p_ModeInfo = NULL;
break;
}
return _status;
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Search config entry number matched in sync_table from given target and speed period value. If failed to search, return negative value. */ | static int nsp32_search_period_entry(nsp32_hw_data *, nsp32_target *, unsigned char) | /* Search config entry number matched in sync_table from given target and speed period value. If failed to search, return negative value. */
static int nsp32_search_period_entry(nsp32_hw_data *, nsp32_target *, unsigned char) | {
int i;
if (target->limit_entry >= data->syncnum) {
nsp32_msg(KERN_ERR, "limit_entry exceeds syncnum!");
target->limit_entry = 0;
}
for (i = target->limit_entry; i < data->syncnum; i++) {
if (period >= data->synct[i].start_period &&
period <= data->synct[i].end_period) {
break;
}
}
if (i == data->syncnum) {
i = -1;
}
return i;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Gets a data element from the SPI interface. */ | void SPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen) | /* Gets a data element from the SPI interface. */
void SPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen) | {
unsigned long i;
unsigned char ucBitLength = SPIBitLengthGet(ulBase);
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
for (i=0; i<ulLen; i++)
{
if (ucBitLength <= 8 && ucBitLength != 0)
{
((unsigned char*)pulRData)[i] =
SPISingleDataReadWrite(ulBase, 0xFF);
}
else
{
((unsigned short*)pulRData)[i] =
SPISingleDataReadWrite(ulBase, 0xFFFF);
}
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns 0 if ep not full, 1 if ep full, -EOPNOTSUPP if OUT endpoint */ | static int ep_is_full(struct pxa_ep *ep) | /* Returns 0 if ep not full, 1 if ep full, -EOPNOTSUPP if OUT endpoint */
static int ep_is_full(struct pxa_ep *ep) | {
if (is_ep0(ep))
return (udc_ep_readl(ep, UDCCSR) & UDCCSR0_IPR);
if (!ep->dir_in)
return -EOPNOTSUPP;
return (!(udc_ep_readl(ep, UDCCSR) & UDCCSR_BNF));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Queue a request to the tail of the device ccw_queue. Start the I/O if possible. */ | void dasd_add_request_tail(struct dasd_ccw_req *cqr) | /* Queue a request to the tail of the device ccw_queue. Start the I/O if possible. */
void dasd_add_request_tail(struct dasd_ccw_req *cqr) | {
struct dasd_device *device;
unsigned long flags;
device = cqr->startdev;
spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags);
cqr->status = DASD_CQR_QUEUED;
list_add_tail(&cqr->devlist, &device->ccw_queue);
dasd_schedule_device_bh(device);
spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Deinitializes the PWR peripheral registers to their default reset values. */ | void PWR_DeInit(void) | /* Deinitializes the PWR peripheral registers to their default reset values. */
void PWR_DeInit(void) | {
PWR->CSR1 = PWR_CSR1_PVDIF;
PWR->CSR2 = PWR_CSR2_RESET_VALUE;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Program a half word at a specified Option Byte Data address. */ | FMC_STATUS_T FMC_ProgramOptionByteData(uint32_t address, uint8_t data) | /* Program a half word at a specified Option Byte Data address. */
FMC_STATUS_T FMC_ProgramOptionByteData(uint32_t address, uint8_t data) | {
FMC_STATUS_T status = FMC_STATUS_COMPLETE;
status = FMC_WaitForLastOperation(0x000B0000);
if (status == FMC_STATUS_COMPLETE)
{
FMC->OBKEY = 0x45670123;
FMC->OBKEY = 0xCDEF89AB;
FMC->CTRL2_B.OBP = BIT_SET;
*(__IOM uint16_t*)address = data;
status = FMC_WaitForLastOperation(0x000B0000);
if (status == FMC_STATUS_TIMEOUT)
{
FMC->CTRL2_B.OBP = BIT_RESET;
}
}
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This routine purges the input queue of those frames that have been acknowledged. This replaces the boxes labelled "V(a) <- N(r)" on the SDL diagram. */ | void rose_frames_acked(struct sock *sk, unsigned short nr) | /* This routine purges the input queue of those frames that have been acknowledged. This replaces the boxes labelled "V(a) <- N(r)" on the SDL diagram. */
void rose_frames_acked(struct sock *sk, unsigned short nr) | {
struct sk_buff *skb;
struct rose_sock *rose = rose_sk(sk);
if (rose->va != nr) {
while (skb_peek(&rose->ack_queue) != NULL && rose->va != nr) {
skb = skb_dequeue(&rose->ack_queue);
kfree_skb(skb);
rose->va = (rose->va + 1) % ROSE_MODULUS;
}
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Disable The Timer counter as a timer capture. */ | void TimerCaptureDisable(unsigned long ulBase) | /* Disable The Timer counter as a timer capture. */
void TimerCaptureDisable(unsigned long ulBase) | {
xASSERT((ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE));
xHWREG(ulBase + TIMER_O_TEXCON) &= ~TIMER_TEXCON_TEXEN;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Configure ELM module based on BCH level. Set mode as continuous mode. Currently we are using only syndrome 0 and syndromes 1 to 6 are not used. Also, the mode is set only for syndrome 0 */ | int elm_config(enum bch_level level) | /* Configure ELM module based on BCH level. Set mode as continuous mode. Currently we are using only syndrome 0 and syndromes 1 to 6 are not used. Also, the mode is set only for syndrome 0 */
int elm_config(enum bch_level level) | {
u32 val;
u8 poly = ELM_DEFAULT_POLY;
u32 buffer_size = 0x7FF;
val = (u32)(level) & ELM_LOCATION_CONFIG_ECC_BCH_LEVEL_MASK;
val |= ((buffer_size << ELM_LOCATION_CONFIG_ECC_SIZE_POS) &
ELM_LOCATION_CONFIG_ECC_SIZE_MASK);
writel(val, &elm_cfg->location_config);
writel((readl(&elm_cfg->irqenable) | (0x1 << poly)),
&elm_cfg->irqenable);
writel((readl(&elm_cfg->page_ctrl) & ~(0x1 << poly)),
&elm_cfg->page_ctrl);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Returns negative errno on error, or zero on success. */ | static int epson1355fb_setcolreg(unsigned regno, unsigned r, unsigned g, unsigned b, unsigned transp, struct fb_info *info) | /* Returns negative errno on error, or zero on success. */
static int epson1355fb_setcolreg(unsigned regno, unsigned r, unsigned g, unsigned b, unsigned transp, struct fb_info *info) | {
struct epson1355_par *par = info->par;
if (info->var.grayscale)
r = g = b = (19595 * r + 38470 * g + 7471 * b) >> 16;
switch (info->fix.visual) {
case FB_VISUAL_TRUECOLOR:
if (regno >= 16)
return -EINVAL;
((u32 *) info->pseudo_palette)[regno] =
(r & 0xf800) | (g & 0xfc00) >> 5 | (b & 0xf800) >> 11;
break;
case FB_VISUAL_PSEUDOCOLOR:
if (regno >= 256)
return -EINVAL;
set_lut(par, regno, r >> 8, g >> 8, b >> 8);
break;
default:
return -ENOSYS;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is identical to attribute_container_add_class_device except that it is designed to be called from the triggers */ | int attribute_container_add_class_device_adapter(struct attribute_container *cont, struct device *dev, struct device *classdev) | /* This function is identical to attribute_container_add_class_device except that it is designed to be called from the triggers */
int attribute_container_add_class_device_adapter(struct attribute_container *cont, struct device *dev, struct device *classdev) | {
return attribute_container_add_class_device(classdev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* MSS_GPIO_disable_irq See "mss_gpio.h" for details of how to use this function. */ | void MSS_GPIO_disable_irq(mss_gpio_id_t port_id) | /* MSS_GPIO_disable_irq See "mss_gpio.h" for details of how to use this function. */
void MSS_GPIO_disable_irq(mss_gpio_id_t port_id) | {
uint32_t cfg_value;
uint32_t gpio_idx = (uint32_t)port_id;
ASSERT( gpio_idx < NB_OF_GPIO );
if ( gpio_idx < NB_OF_GPIO )
{
cfg_value = *(g_config_reg_lut[gpio_idx]);
*(g_config_reg_lut[gpio_idx]) = (cfg_value & ~GPIO_INT_ENABLE_MASK);
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Selects the condition for the system to enter low power mode. */ | void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState) | /* Selects the condition for the system to enter low power mode. */
void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState) | {
if (NewState != DISABLE)
{
SCB->SCR |= LowPowerMode;
}
else
{
SCB->SCR &= (uint32_t)(~(uint32_t)LowPowerMode);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Writes and returns a new value to DR0. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */ | UINTN EFIAPI AsmWriteDr0(UINTN Dr0) | /* Writes and returns a new value to DR0. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmWriteDr0(UINTN Dr0) | {
__asm__ __volatile__ (
"movl %0, %%dr0"
:
: "r" (Dr0)
);
return Dr0;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Creates a cursor table and leave it on the top of the stack. */ | static int create_cursor(lua_State *L, int o, conn_data *conn, const SQLHSTMT hstmt, const SQLSMALLINT numcols) | /* Creates a cursor table and leave it on the top of the stack. */
static int create_cursor(lua_State *L, int o, conn_data *conn, const SQLHSTMT hstmt, const SQLSMALLINT numcols) | {
cur_data *cur = (cur_data *) lua_newuserdata(L, sizeof(cur_data));
luasql_setmeta (L, LUASQL_CURSOR_ODBC);
conn->cur_counter++;
cur->closed = 0;
cur->conn = LUA_NOREF;
cur->numcols = numcols;
cur->colnames = LUA_NOREF;
cur->coltypes = LUA_NOREF;
cur->hstmt = hstmt;
lua_pushvalue (L, o);
cur->conn = luaL_ref (L, LUA_REGISTRYINDEX);
create_colinfo (L, cur);
return 1;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Looks like it's needed only for the "tvphone", the "tvphone 98" handles this with a tda9840 */ | void avermedia_tvphone_audio(struct bttv *btv, struct v4l2_tuner *t, int set) | /* Looks like it's needed only for the "tvphone", the "tvphone 98" handles this with a tda9840 */
void avermedia_tvphone_audio(struct bttv *btv, struct v4l2_tuner *t, int set) | {
int val = 0;
if (set) {
if (t->audmode & V4L2_TUNER_MODE_LANG2)
val = 0x02;
if (t->audmode & V4L2_TUNER_MODE_STEREO)
val = 0x01;
if (val) {
gpio_bits(0x03,val);
if (bttv_gpio)
bttv_gpio_tracking(btv,"avermedia");
}
} else {
t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
V4L2_TUNER_MODE_LANG1;
return;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Forces or releases High Speed AHB (AHB1) peripheral reset. */ | void exRCC_AHBPeriphReset(u32 ahb1_periph) | /* Forces or releases High Speed AHB (AHB1) peripheral reset. */
void exRCC_AHBPeriphReset(u32 ahb1_periph) | {
RCC->AHBRSTR |= ahb1_periph;
RCC->AHBRSTR &= ~ahb1_periph;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Stalls the CPU for the number of nanoseconds specified by NanoSeconds. */ | UINTN EFIAPI NanoSecondDelay(IN UINTN NanoSeconds) | /* Stalls the CPU for the number of nanoseconds specified by NanoSeconds. */
UINTN EFIAPI NanoSecondDelay(IN UINTN NanoSeconds) | {
InternalCpuDelay (
DivU64x32 (
MultU64x64 (
NanoSeconds,
InternalGetPerformanceCounterFrequency ()
),
1000000000u
)
);
return NanoSeconds;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* avc_audit_pre_callback - SELinux specific information will be called by generic audit code @ab: the audit buffer */ | static void avc_audit_pre_callback(struct audit_buffer *ab, void *a) | /* avc_audit_pre_callback - SELinux specific information will be called by generic audit code @ab: the audit buffer */
static void avc_audit_pre_callback(struct audit_buffer *ab, void *a) | {
struct common_audit_data *ad = a;
audit_log_format(ab, "avc: %s ",
ad->selinux_audit_data.denied ? "denied" : "granted");
avc_dump_av(ab, ad->selinux_audit_data.tclass,
ad->selinux_audit_data.audited);
audit_log_format(ab, " for ");
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function will not return until the protection has been saved. */ | long FlashProtectSave(void) | /* This function will not return until the protection has been saved. */
long FlashProtectSave(void) | {
int ulTemp, ulLimit;
ulLimit = CLASS_IS_SANDSTORM ? 2 : 8;
for(ulTemp = 0; ulTemp < ulLimit; ulTemp++)
{
HWREG(FLASH_FMA) = ulTemp;
HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_COMT;
while(HWREG(FLASH_FMC) & FLASH_FMC_COMT)
{
}
}
return(0);
} | watterott/WebRadio | C++ | null | 71 |
/* The actual data buffers on the other hand will only be accessed by the CPU or the adapter but not by both simultaneously. This allows Scatter/Gather packet based DMA procedures for using physically discontiguous pages. mgsl_reset_tx_dma_buffers() */ | static void mgsl_reset_tx_dma_buffers(struct mgsl_struct *info) | /* The actual data buffers on the other hand will only be accessed by the CPU or the adapter but not by both simultaneously. This allows Scatter/Gather packet based DMA procedures for using physically discontiguous pages. mgsl_reset_tx_dma_buffers() */
static void mgsl_reset_tx_dma_buffers(struct mgsl_struct *info) | {
unsigned int i;
for ( i = 0; i < info->tx_buffer_count; i++ ) {
*((unsigned long *)&(info->tx_buffer_list[i].count)) = 0;
}
info->current_tx_buffer = 0;
info->start_tx_dma_buffer = 0;
info->tx_dma_buffers_used = 0;
info->get_tx_holding_index = 0;
info->put_tx_holding_index = 0;
info->tx_holding_count = 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Prepare a DMA transfer. We build the DMA table, adjust the timings for a read on KeyLargo ATA/66 and mark us as waiting for DMA completion */ | static int pmac_ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) | /* Prepare a DMA transfer. We build the DMA table, adjust the timings for a read on KeyLargo ATA/66 and mark us as waiting for DMA completion */
static int pmac_ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) | {
ide_hwif_t *hwif = drive->hwif;
pmac_ide_hwif_t *pmif =
(pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
u8 unit = drive->dn & 1, ata4 = (pmif->kind == controller_kl_ata4);
u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE);
if (pmac_ide_build_dmatable(drive, cmd) == 0)
return 1;
if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) {
writel(pmif->timings[unit] + (write ? 0 : 0x00800000UL),
PMAC_IDE_REG(IDE_TIMING_CONFIG));
(void)readl(PMAC_IDE_REG(IDE_TIMING_CONFIG));
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* One notified function to stop the Host Controller when gBS->ExitBootServices() called. */ | VOID EFIAPI EhcExitBootService(EFI_EVENT Event, VOID *Context) | /* One notified function to stop the Host Controller when gBS->ExitBootServices() called. */
VOID EFIAPI EhcExitBootService(EFI_EVENT Event, VOID *Context) | {
USB2_HC_DEV *Ehc;
Ehc = (USB2_HC_DEV *)Context;
EhcResetHC (Ehc, EHC_RESET_TIMEOUT);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* In this driver, the cursor cannot be hidden. */ | EFI_STATUS EFIAPI TerminalConOutEnableCursor(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN BOOLEAN Visible) | /* In this driver, the cursor cannot be hidden. */
EFI_STATUS EFIAPI TerminalConOutEnableCursor(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN BOOLEAN Visible) | {
if (!Visible) {
return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function is added in order to simulate arduino delay() function */ | void __msleep(int milisec) | /* This function is added in order to simulate arduino delay() function */
void __msleep(int milisec) | {
struct timespec req = {0};
req.tv_sec = 0;
req.tv_nsec = milisec * 1000000L;
nanosleep(&req, (struct timespec *)NULL);
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Initializes the SpeedStep support. Returns -ENODEV on unsupported devices, -EINVAL on problems during initiatization, and zero on success. */ | static int __init speedstep_init(void) | /* Initializes the SpeedStep support. Returns -ENODEV on unsupported devices, -EINVAL on problems during initiatization, and zero on success. */
static int __init speedstep_init(void) | {
speedstep_processor = speedstep_detect_processor();
if (!speedstep_processor) {
dprintk("Intel(R) SpeedStep(TM) capable processor "
"not found\n");
return -ENODEV;
}
if (!speedstep_detect_chipset()) {
dprintk("Intel(R) SpeedStep(TM) for this chipset not "
"(yet) available.\n");
return -ENODEV;
}
if (speedstep_activate()) {
pci_dev_put(speedstep_chipset_dev);
return -EINVAL;
}
if (speedstep_find_register())
return -ENODEV;
return cpufreq_register_driver(&speedstep_driver);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Transfer operational state from root to device. This is normally called when a stacking relationship exists between the root device and the device(a leaf device). */ | void netif_stacked_transfer_operstate(const struct net_device *rootdev, struct net_device *dev) | /* Transfer operational state from root to device. This is normally called when a stacking relationship exists between the root device and the device(a leaf device). */
void netif_stacked_transfer_operstate(const struct net_device *rootdev, struct net_device *dev) | {
if (rootdev->operstate == IF_OPER_DORMANT)
netif_dormant_on(dev);
else
netif_dormant_off(dev);
if (netif_carrier_ok(rootdev)) {
if (!netif_carrier_ok(dev))
netif_carrier_on(dev);
} else {
if (netif_carrier_ok(dev))
netif_carrier_off(dev);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function is a helper function for the wtk_frame_handler() function. It is called when a pointer RELEASE event is sent to the resize window. This function completes the resize operation if the RELEASE event was inside the parent window's boundaries. */ | static void wtk_handle_resize_release(struct wtk_frame *frame, struct win_pointer_event const *event) | /* This function is a helper function for the wtk_frame_handler() function. It is called when a pointer RELEASE event is sent to the resize window. This function completes the resize operation if the RELEASE event was inside the parent window's boundaries. */
static void wtk_handle_resize_release(struct wtk_frame *frame, struct win_pointer_event const *event) | {
bool is_inside;
switch (frame->state) {
case WTK_FRAME_RESIZING:
wtk_stop_drag(&(event->last_pos));
win_grab_pointer(NULL);
frame->state = WTK_FRAME_NORMAL;
is_inside = win_is_inside_window(win_get_parent(frame->
container), &(event->pos));
if (is_inside) {
struct win_area contents_area
= *win_get_area(frame->contents);
contents_area.size.x += event->pos.x -
wtk_drag_origin.x;
contents_area.size.y += event->pos.y -
wtk_drag_origin.y;
wtk_resize_frame(frame, &contents_area);
}
break;
default:
break;
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Output: void, but we will add to proto tree if !NULL. */ | static void dissect_lsp_l2_is_neighbors_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length, int length) | /* Output: void, but we will add to proto tree if !NULL. */
static void dissect_lsp_l2_is_neighbors_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length, int length) | {
dissect_lsp_eis_neighbors_clv_inner(tvb, pinfo, tree, offset,
length, id_length, FALSE, FALSE);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* this function will return the mounted path for specified device. */ | const char* dfs_mnt_get_mounted_path(struct rt_device *device) | /* this function will return the mounted path for specified device. */
const char* dfs_mnt_get_mounted_path(struct rt_device *device) | {
const char* path = RT_NULL;
if (_root_mnt)
{
struct dfs_mnt* mnt;
dfs_lock();
mnt = _dfs_mnt_foreach(_root_mnt, _mnt_cmp_devid, device);
dfs_unlock();
if (mnt) path = mnt->fullpath;
}
return path;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) | /* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC12_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_5;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* FCS RPORT alloc callback, after successful PLOGI by FCS */ | bfa_status_t bfa_fcb_rport_alloc(struct bfad_s *bfad, struct bfa_fcs_rport_s **rport, struct bfad_rport_s **rport_drv) | /* FCS RPORT alloc callback, after successful PLOGI by FCS */
bfa_status_t bfa_fcb_rport_alloc(struct bfad_s *bfad, struct bfa_fcs_rport_s **rport, struct bfad_rport_s **rport_drv) | {
bfa_status_t rc = BFA_STATUS_OK;
*rport_drv = kzalloc(sizeof(struct bfad_rport_s), GFP_ATOMIC);
if (*rport_drv == NULL) {
rc = BFA_STATUS_ENOMEM;
goto ext;
}
*rport = &(*rport_drv)->fcs_rport;
ext:
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* BACnet-Error ::= SEQUENCE { error-class ENUMERATED {}, error-code ENUMERATED {} } } */ | static guint fError(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) | /* BACnet-Error ::= SEQUENCE { error-class ENUMERATED {}, error-code ENUMERATED {} } } */
static guint fError(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) | {
offset = fApplicationTypesEnumeratedSplit(tvb, pinfo, tree, offset,
"error Class: ", BACnetErrorClass, 64);
return fApplicationTypesEnumeratedSplit(tvb, pinfo, tree, offset,
"error Code: ", BACnetErrorCode, 256);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns 0 on success, -EBUSY if handler already registered. */ | int scsi_register_device_handler(struct scsi_device_handler *scsi_dh) | /* Returns 0 on success, -EBUSY if handler already registered. */
int scsi_register_device_handler(struct scsi_device_handler *scsi_dh) | {
if (get_device_handler(scsi_dh->name))
return -EBUSY;
spin_lock(&list_lock);
list_add(&scsi_dh->list, &scsi_dh_list);
spin_unlock(&list_lock);
bus_for_each_dev(&scsi_bus_type, NULL, scsi_dh, scsi_dh_notifier_add);
printk(KERN_INFO "%s: device handler registered\n", scsi_dh->name);
return SCSI_DH_OK;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Parses the command line to extract the firmware file. This is the only parameter that is specified without a '-' character at the start. */ | static char const *const ExtractFirmwareFileFromCommandLine(int argc, char const *const argv[]) | /* Parses the command line to extract the firmware file. This is the only parameter that is specified without a '-' character at the start. */
static char const *const ExtractFirmwareFileFromCommandLine(int argc, char const *const argv[]) | {
char const * result = NULL;
uint8_t paramIdx;
assert(argv != NULL);
if (argv != NULL)
{
for (paramIdx = 1; paramIdx < argc; paramIdx++)
{
if ( (argv[paramIdx][0] != '-') && (strlen(argv[paramIdx]) > 2) )
{
result = argv[paramIdx];
}
}
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Get the display device data structure corresponding to the device number. */ | EMSTATUS DISPLAY_DeviceGet(int displayDeviceNo, DISPLAY_Device_t *device) | /* Get the display device data structure corresponding to the device number. */
EMSTATUS DISPLAY_DeviceGet(int displayDeviceNo, DISPLAY_Device_t *device) | {
EMSTATUS status;
if (false == moduleInitialized)
{
status = DISPLAY_EMSTATUS_NOT_INITIALIZED;
}
else
{
if (displayDeviceNo < DISPLAY_DEVICES_MAX)
{
memcpy(device, &deviceTable[displayDeviceNo], sizeof(DISPLAY_Device_t));
status = DISPLAY_EMSTATUS_OK;
}
else
{
status = DISPLAY_EMSTATUS_OUT_OF_RANGE;
}
}
return status;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Unregisters an interrupt handler for a UART interrupt. */ | void UARTIntUnregister(unsigned long ulBase) | /* Unregisters an interrupt handler for a UART interrupt. */
void UARTIntUnregister(unsigned long ulBase) | {
unsigned long ulInt;
ASSERT(UARTBaseValid(ulBase));
ulInt = ((ulBase == UART0_BASE) ? INT_UART0 :
((ulBase == UART1_BASE) ? INT_UART1 : INT_UART2));
IntDisable(ulInt);
IntUnregister(ulInt);
} | watterott/WebRadio | C++ | null | 71 |
/* The function is used to Enable or active power down function. */ | void SysCtlPowerDownEnable(xtBoolean bEnable) | /* The function is used to Enable or active power down function. */
void SysCtlPowerDownEnable(xtBoolean bEnable) | {
SysCtlKeyAddrUnlock();
if(bEnable)
{
xHWREG(SYSCLK_PWRCON) |= SYSCLK_PWRCON_PWR_DO_EN;
}
else
{
xHWREG(SYSCLK_PWRCON) &= ~SYSCLK_PWRCON_PWR_DO_EN;
}
SysCtlKeyAddrLock();
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* To select the trigger level, one of the following macros should be used: */ | void I2CRxFIFOConfigSet(uint32_t ui32Base, uint32_t ui32Config) | /* To select the trigger level, one of the following macros should be used: */
void I2CRxFIFOConfigSet(uint32_t ui32Base, uint32_t ui32Config) | {
ASSERT(_I2CBaseValid(ui32Base));
HWREG(ui32Base + I2C_O_FIFOCTL) &= 0x0000ffff;
HWREG(ui32Base + I2C_O_FIFOCTL) |= ui32Config;
} | micropython/micropython | C++ | Other | 18,334 |
/* Note, the @key argument has to be the key of the first child. Also note, this function relies on the fact that 0:0 is never a valid LEB number and offset for a main-area node. */ | int is_idx_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, int level, int lnum, int offs) | /* Note, the @key argument has to be the key of the first child. Also note, this function relies on the fact that 0:0 is never a valid LEB number and offset for a main-area node. */
int is_idx_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, int level, int lnum, int offs) | {
struct ubifs_znode *znode;
znode = lookup_znode(c, key, level, lnum, offs);
if (!znode)
return 0;
if (IS_ERR(znode))
return PTR_ERR(znode);
return ubifs_zn_dirty(znode) ? 1 : 2;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Builds a pdu frame as a DISC command. */ | void llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit) | /* Builds a pdu frame as a DISC command. */
void llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit) | {
struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_CMD_DISC;
pdu->ctrl_1 |= ((p_bit & 1) << 4) & LLC_U_PF_BIT_MASK;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This option gets or sets the list of HMAC algorithms that the local endpoint requires the peer to use. */ | static int sctp_setsockopt_hmac_ident(struct sock *sk, char __user *optval, unsigned int optlen) | /* This option gets or sets the list of HMAC algorithms that the local endpoint requires the peer to use. */
static int sctp_setsockopt_hmac_ident(struct sock *sk, char __user *optval, unsigned int optlen) | {
struct sctp_hmacalgo *hmacs;
u32 idents;
int err;
if (!sctp_auth_enable)
return -EACCES;
if (optlen < sizeof(struct sctp_hmacalgo))
return -EINVAL;
hmacs = kmalloc(optlen, GFP_KERNEL);
if (!hmacs)
return -ENOMEM;
if (copy_from_user(hmacs, optval, optlen)) {
err = -EFAULT;
goto out;
}
idents = hmacs->shmac_num_idents;
if (idents == 0 || idents > SCTP_AUTH_NUM_HMACS ||
(idents * sizeof(u16)) > (optlen - sizeof(struct sctp_hmacalgo))) {
err = -EINVAL;
goto out;
}
err = sctp_auth_ep_set_hmacs(sctp_sk(sk)->ep, hmacs);
out:
kfree(hmacs);
return err;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If ExtendedData is NULL, then ASSERT(). If ExtendedDataSize is 0, then ASSERT(). */ | EFI_STATUS EFIAPI ReportStatusCodeWithExtendedData(IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_VALUE Value, IN CONST VOID *ExtendedData, IN UINTN ExtendedDataSize) | /* If ExtendedData is NULL, then ASSERT(). If ExtendedDataSize is 0, then ASSERT(). */
EFI_STATUS EFIAPI ReportStatusCodeWithExtendedData(IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_VALUE Value, IN CONST VOID *ExtendedData, IN UINTN ExtendedDataSize) | {
ASSERT (ExtendedData != NULL);
ASSERT (ExtendedDataSize != 0);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Selection of any of the above modes will enable the EPI module, except for */ | void EPIModeSet(unsigned long ulBase, unsigned long ulMode) | /* Selection of any of the above modes will enable the EPI module, except for */
void EPIModeSet(unsigned long ulBase, unsigned long ulMode) | {
ASSERT(ulBase == EPI0_BASE);
ASSERT((ulMode == EPI_MODE_GENERAL) ||
(ulMode == EPI_MODE_SDRAM) ||
(ulMode == EPI_MODE_HB8) ||
(ulMode == EPI_MODE_HB16) ||
(ulMode == EPI_MODE_DISABLE));
HWREG(ulBase + EPI_O_CFG) = ulMode;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Make sure the bus isn't already busy.
A busy bus is allowed if we are the one driving it. */ | status_t LPI2C_CheckForBusyBus(LPI2C_Type *base) | /* Make sure the bus isn't already busy.
A busy bus is allowed if we are the one driving it. */
status_t LPI2C_CheckForBusyBus(LPI2C_Type *base) | {
uint32_t status = LPI2C_MasterGetStatusFlags(base);
if ((status & kLPI2C_MasterBusBusyFlag) && (!(status & kLPI2C_MasterBusyFlag)))
{
return kStatus_LPI2C_Busy;
}
return kStatus_Success;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* This is called on every exception exit except for z_riscv_fpu_trap(). In that case the exception level of interest is 1 (soon to be 0). */ | void z_riscv_fpu_exit_exc(z_arch_esf_t *esf) | /* This is called on every exception exit except for z_riscv_fpu_trap(). In that case the exception level of interest is 1 (soon to be 0). */
void z_riscv_fpu_exit_exc(z_arch_esf_t *esf) | {
if (fpu_access_allowed(1)) {
esf->mstatus &= ~MSTATUS_FS;
esf->mstatus |= _current_cpu->arch.fpu_state;
} else {
esf->mstatus &= ~MSTATUS_FS;
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* read the pin's value (works even if it's not muxed as a gpio). */ | int at91_get_pio_value(unsigned port, unsigned pin) | /* read the pin's value (works even if it's not muxed as a gpio). */
int at91_get_pio_value(unsigned port, unsigned pin) | {
u32 pdsr = 0;
at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
u32 mask;
if ((port < AT91_PIO_PORTS) && (pin < 32)) {
mask = 1 << pin;
pdsr = readl(&pio->port[port].pdsr) & mask;
}
return pdsr != 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function handles External lines 15 to 10 interrupt request. */ | void EXTI15_10_IRQHandler(void) | /* This function handles External lines 15 to 10 interrupt request. */
void EXTI15_10_IRQHandler(void) | {
HAL_GPIO_EXTI_IRQHandler(KEY_BUTTON_PIN);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Call when there is a possibility of a match, either as a final match or as a path within a match */ | static jsonsl_jpr_match_t jsonsl__match_continue(jsonsl_jpr_t jpr, const struct jsonsl_jpr_component_st *component, unsigned prlevel, unsigned chtype) | /* Call when there is a possibility of a match, either as a final match or as a path within a match */
static jsonsl_jpr_match_t jsonsl__match_continue(jsonsl_jpr_t jpr, const struct jsonsl_jpr_component_st *component, unsigned prlevel, unsigned chtype) | {
const struct jsonsl_jpr_component_st *next_comp = component + 1;
if (prlevel == jpr->ncomponents - 1) {
if (jpr->match_type == 0 || jpr->match_type == chtype) {
return JSONSL_MATCH_COMPLETE;
} else {
return JSONSL_MATCH_TYPE_MISMATCH;
}
}
if (chtype == JSONSL_T_LIST) {
if (next_comp->ptype == JSONSL_PATH_NUMERIC) {
return JSONSL_MATCH_POSSIBLE;
} else {
return JSONSL_MATCH_TYPE_MISMATCH;
}
} else if (chtype == JSONSL_T_OBJECT) {
if (next_comp->ptype == JSONSL_PATH_NUMERIC) {
return JSONSL_MATCH_TYPE_MISMATCH;
} else {
return JSONSL_MATCH_POSSIBLE;
}
} else {
return JSONSL_MATCH_TYPE_MISMATCH;
}
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* ps3_repository_read_mm_info - Read mm info for single pu system. @rm_base: Real mode memory base address. @rm_size: Real mode memory size. @region_total: Maximum memory region size. */ | int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size, u64 *region_total) | /* ps3_repository_read_mm_info - Read mm info for single pu system. @rm_base: Real mode memory base address. @rm_size: Real mode memory size. @region_total: Maximum memory region size. */
int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size, u64 *region_total) | {
int result;
u64 ppe_id;
lv1_get_logical_ppe_id(&ppe_id);
*rm_base = 0;
result = ps3_repository_read_rm_size(ppe_id, rm_size);
return result ? result
: ps3_repository_read_region_total(region_total);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This API reads acceleration data Z values of 8bit resolution from location 07h.
@aram accel_z_s8 : the data of z */ | BMA2x2_RETURN_FUNCTION_TYPE bma2x2_read_accel_eight_resolution_z(s8 *accel_z_s8) | /* This API reads acceleration data Z values of 8bit resolution from location 07h.
@aram accel_z_s8 : the data of z */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_read_accel_eight_resolution_z(s8 *accel_z_s8) | {
BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR;
u8 data = BMA2x2_INIT_VALUE;
if (p_bma2x2 == BMA2x2_NULL)
{
return E_BMA2x2_NULL_PTR;
}
else
{
com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC
(p_bma2x2->dev_addr,
BMA2x2_Z_AXIS_MSB_ADDR, &data,
BMA2x2_GEN_READ_WRITE_LENGTH);
*accel_z_s8 = BMA2x2_GET_BITSLICE(data,
BMA2x2_ACCEL_Z_MSB);
}
return com_rslt;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Only to be used on 8-bit arrays. array_len is actual len in bytes (not encoded le_value_length). buf is null-terminated. */ | static int zap_leaf_array_equal(zap_leaf_phys_t *l, zfs_endian_t endian, int blksft, int chunk, int array_len, const char *buf) | /* Only to be used on 8-bit arrays. array_len is actual len in bytes (not encoded le_value_length). buf is null-terminated. */
static int zap_leaf_array_equal(zap_leaf_phys_t *l, zfs_endian_t endian, int blksft, int chunk, int array_len, const char *buf) | {
int bseen = 0;
while (bseen < array_len) {
struct zap_leaf_array *la = &ZAP_LEAF_CHUNK(l, blksft, chunk).l_array;
int toread = min(array_len - bseen, ZAP_LEAF_ARRAY_BYTES);
if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft))
return 0;
if (memcmp(la->la_array, buf + bseen, toread) != 0)
break;
chunk = zfs_to_cpu16(la->la_next, endian);
bseen += toread;
}
return (bseen == array_len);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* If error is set than unvalidate buffer, otherwise just free memory used by parsing context. */ | static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error) | /* If error is set than unvalidate buffer, otherwise just free memory used by parsing context. */
static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error) | {
unsigned i;
kfree(parser->relocs);
for (i = 0; i < parser->nchunks; i++) {
kfree(parser->chunks[i].kdata);
kfree(parser->chunks[i].kpage[0]);
kfree(parser->chunks[i].kpage[1]);
}
kfree(parser->chunks);
kfree(parser->chunks_array);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check the status of the Tx buffer of the specified SPI port. */ | xtBoolean xSPIIsTxEmpty(unsigned long ulBase) | /* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean xSPIIsTxEmpty(unsigned long ulBase) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_TX_EMPTY)? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* The callback function for the net buffer which wraps the packet processed by IPsec. It releases the wrap packet and also signals IPsec to free the resources. */ | VOID EFIAPI Ip4IpSecFree(IN VOID *Arg) | /* The callback function for the net buffer which wraps the packet processed by IPsec. It releases the wrap packet and also signals IPsec to free the resources. */
VOID EFIAPI Ip4IpSecFree(IN VOID *Arg) | {
IP4_IPSEC_WRAP *Wrap;
Wrap = (IP4_IPSEC_WRAP *)Arg;
if (Wrap->IpSecRecycleSignal != NULL) {
gBS->SignalEvent (Wrap->IpSecRecycleSignal);
}
NetbufFree (Wrap->Packet);
FreePool (Wrap);
return;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function converts the elapsed ticks of running performance counter to time value in unit of nanoseconds. */ | UINT64 EFIAPI GetTimeInNanoSecond(IN UINT64 Ticks) | /* This function converts the elapsed ticks of running performance counter to time value in unit of nanoseconds. */
UINT64 EFIAPI GetTimeInNanoSecond(IN UINT64 Ticks) | {
UINT64 NanoSeconds;
UINT32 Remainder;
NanoSeconds = MultU64x32 (DivU64x32Remainder (Ticks, ACPI_TIMER_FREQUENCY, &Remainder), 1000000000u);
NanoSeconds += DivU64x32 (MultU64x32 ((UINT64)Remainder, 1000000000u), ACPI_TIMER_FREQUENCY);
return NanoSeconds;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Disables the system to enter low power mode. */ | void NVIC_DisableSystemLowPower(uint8_t lowPowerMode) | /* Disables the system to enter low power mode. */
void NVIC_DisableSystemLowPower(uint8_t lowPowerMode) | {
SCB->SCR &= (uint32_t)(~(uint32_t)lowPowerMode);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* If 8-bit MMIO register operations are not supported, then ASSERT(). */ | UINT8 EFIAPI MmioWrite8(IN UINTN Address, IN UINT8 Value) | /* If 8-bit MMIO register operations are not supported, then ASSERT(). */
UINT8 EFIAPI MmioWrite8(IN UINTN Address, IN UINT8 Value) | {
CONST EFI_PEI_SERVICES **PeiServices;
EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
ASSERT (CpuIo != NULL);
CpuIo->MemWrite8 (PeiServices, CpuIo, (UINT64)Address, Value);
return Value;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* An event is triggered whenever a drive drops out of a stripe volume. */ | static void trigger_event(struct work_struct *work) | /* An event is triggered whenever a drive drops out of a stripe volume. */
static void trigger_event(struct work_struct *work) | {
struct stripe_c *sc = container_of(work, struct stripe_c, kstriped_ws);
dm_table_event(sc->ti->table);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Oops. The kernel tried to access some page that wasn't present. */ | static void __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, struct pt_regs *regs) | /* Oops. The kernel tried to access some page that wasn't present. */
static void __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr, struct pt_regs *regs) | {
if (fixup_exception(regs))
return;
bust_spinlocks(1);
printk(KERN_ALERT
"Unable to handle kernel %s at virtual address %08lx\n",
(addr < PAGE_SIZE) ? "NULL pointer dereference" :
"paging request", addr);
show_pte(mm, addr);
die("Oops", regs, fsr);
bust_spinlocks(0);
do_exit(SIGKILL);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Gets the current BUS status of a PCAN Channel. */ | static TPCANStatus PCanUsbLibFuncGetStatus(TPCANHandle Channel) | /* Gets the current BUS status of a PCAN Channel. */
static TPCANStatus PCanUsbLibFuncGetStatus(TPCANHandle Channel) | {
TPCANStatus result = PCAN_ERROR_INITIALIZE;
assert(pCanUsbLibFuncGetStatusPtr != NULL);
assert(pCanUsbDllHandle != NULL);
if ((pCanUsbLibFuncGetStatusPtr != NULL) && (pCanUsbDllHandle != NULL))
{
result = pCanUsbLibFuncGetStatusPtr(Channel);
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Get the touch detailed informations on touch number 'touchIdx' (0..1) This touch detailed information contains : */ | void ft3x67_TS_GetTouchInfo(uint16_t DeviceAddr, uint32_t touchIdx, uint32_t *pWeight, uint32_t *pArea, uint32_t *pEvent) | /* Get the touch detailed informations on touch number 'touchIdx' (0..1) This touch detailed information contains : */
void ft3x67_TS_GetTouchInfo(uint16_t DeviceAddr, uint32_t touchIdx, uint32_t *pWeight, uint32_t *pArea, uint32_t *pEvent) | {
volatile uint8_t ucReadData = 0U;
uint8_t regAddressXHigh = 0U;
if(touchIdx < ft3x67_handle.currActiveTouchNb)
{
switch(touchIdx)
{
case 0U :
regAddressXHigh = FT3X67_P1_XH_REG;
break;
case 1U :
regAddressXHigh = FT3X67_P2_XH_REG;
break;
default :
break;
}
ucReadData = TS_IO_Read(DeviceAddr, regAddressXHigh);
*pEvent = (ucReadData & FT3X67_TOUCH_EVT_FLAG_MASK) >> FT3X67_TOUCH_EVT_FLAG_SHIFT;
*pWeight = 0;
*pArea = 0;
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.