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 |
|---|---|---|---|---|---|---|---|
/* The ISR used for the scheduler tick depends on whether the cooperative or the preemptive scheduler is being used. */ | void vNonPreemptiveTick(void) | /* The ISR used for the scheduler tick depends on whether the cooperative or the preemptive scheduler is being used. */
void vNonPreemptiveTick(void) | {
uint32_t ulDummy;
xTaskIncrementTick();
ulDummy = AT91C_BASE_PITC->PITC_PIVR;
AT91C_BASE_AIC->AIC_EOICR = ulDummy;
} | labapart/polymcu | C++ | null | 201 |
/* Enables or disables the temperature sensor and Vrefint channel. */ | void ADC_EnableTempSensorVrefint(FunctionalState Cmd) | /* Enables or disables the temperature sensor and Vrefint channel. */
void ADC_EnableTempSensorVrefint(FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
ADC->CTRL2 |= CTRL2_TSVREFE_SET;
_EnVref1p2()
_EnVref2p0()
}
else
{
ADC->CTRL2 &= CTRL2_TSVREFE_RESET;
_DisVref1p2()
_DisVref2p0()
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Disable AON Sleep Timer module instance.
AON Sleep Timer module instance disable. */ | void aon_sleep_timer_disable(void) | /* Disable AON Sleep Timer module instance.
AON Sleep Timer module instance disable. */
void aon_sleep_timer_disable(void) | {
uint32_t regval;
AON_SLEEP_TIMER0->SINGLE_COUNT_DURATION.reg = 0;
regval = AON_SLEEP_TIMER0->CONTROL.reg;
regval &= ~AON_SLEEP_TIMER_CONTROL_RELOAD_ENABLE;
regval &= ~AON_SLEEP_TIMER_CONTROL_SINGLE_COUNT_ENABLE;
AON_SLEEP_TIMER0->CONTROL.reg = regval;
while ((AON_SLEEP_TIMER0->CONTROL.reg & AON_SLEEP_TIMER_CON... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* edma_clear_event - clear an outstanding event on the DMA channel Arguments: channel - channel number */ | void edma_clear_event(unsigned channel) | /* edma_clear_event - clear an outstanding event on the DMA channel Arguments: channel - channel number */
void edma_clear_event(unsigned channel) | {
unsigned ctlr;
ctlr = EDMA_CTLR(channel);
channel = EDMA_CHAN_SLOT(channel);
if (channel >= edma_cc[ctlr]->num_channels)
return;
if (channel < 32)
edma_write(ctlr, EDMA_ECR, BIT(channel));
else
edma_write(ctlr, EDMA_ECRH, BIT(channel - 32));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get elapsed time since last user activity on a display (e.g. click) */ | uint32_t lv_disp_get_inactive_time(const lv_disp_t *disp) | /* Get elapsed time since last user activity on a display (e.g. click) */
uint32_t lv_disp_get_inactive_time(const lv_disp_t *disp) | {
if(!disp) disp = lv_disp_get_default();
if(!disp) {
LV_LOG_WARN("lv_disp_get_inactive_time: no display registered");
return 0;
}
if(disp) return lv_tick_elaps(disp->last_activity_time);
lv_disp_t * d;
uint32_t t = UINT32_MAX;
d = lv_disp_get_next(NULL);
while(d... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Attempt to re-trigger the interrupt. The SA1111 contains a register (INTSET) which claims to do this. However, in practice no amount of manipulation of INTEN and INTSET guarantees that the interrupt will be triggered. In fact, its very difficult, if not impossible to get INTSET to re-trigger the interrupt. */ | static int sa1111_retrigger_highirq(unsigned int irq) | /* Attempt to re-trigger the interrupt. The SA1111 contains a register (INTSET) which claims to do this. However, in practice no amount of manipulation of INTEN and INTSET guarantees that the interrupt will be triggered. In fact, its very difficult, if not impossible to get INTSET to re-trigger the interrupt. */
stati... | {
unsigned int mask = SA1111_IRQMASK_HI(irq);
void __iomem *mapbase = get_irq_chip_data(irq);
unsigned long ip1;
int i;
ip1 = sa1111_readl(mapbase + SA1111_INTPOL1);
for (i = 0; i < 8; i++) {
sa1111_writel(ip1 ^ mask, mapbase + SA1111_INTPOL1);
sa1111_writel(ip1, mapbase + SA1111_INTPOL1);
if (sa1111_readl(... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the RootNode information. The Node must be a root node. */ | EFI_STATUS EFIAPI AmlGetRootNodeInfo(IN AML_ROOT_NODE *RootNode, OUT EFI_ACPI_DESCRIPTION_HEADER *SdtHeaderBuffer) | /* Get the RootNode information. The Node must be a root node. */
EFI_STATUS EFIAPI AmlGetRootNodeInfo(IN AML_ROOT_NODE *RootNode, OUT EFI_ACPI_DESCRIPTION_HEADER *SdtHeaderBuffer) | {
if (!IS_AML_ROOT_NODE (RootNode) ||
(SdtHeaderBuffer == NULL))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
CopyMem (
SdtHeaderBuffer,
RootNode->SdtHeader,
sizeof (EFI_ACPI_DESCRIPTION_HEADER)
);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */ | void SAI_TransferAbortReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle) | /* param base SAI base pointer. param handle SAI eDMA handle pointer. */
void SAI_TransferAbortReceiveEDMA(I2S_Type *base, sai_edma_handle_t *handle) | {
assert(handle != NULL);
EDMA_AbortTransfer(handle->dmaHandle);
base->RCR3 &= ~I2S_RCR3_RCE_MASK;
SAI_RxEnableDMA(base, kSAI_FIFORequestDMAEnable, false);
SAI_RxEnable(base, false);
if ((base->RCSR & I2S_RCSR_RE_MASK) == 0UL)
{
base->RCSR |= (I2S_RCSR_FR_MASK | I2S_RCSR_SR_MASK);
... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Draw a polygon from triangles. Only convex polygons are supported */ | void lv_draw_polygon(const lv_point_t *points, uint32_t point_cnt, const lv_area_t *mask, const lv_style_t *style, lv_opa_t opa_scale) | /* Draw a polygon from triangles. Only convex polygons are supported */
void lv_draw_polygon(const lv_point_t *points, uint32_t point_cnt, const lv_area_t *mask, const lv_style_t *style, lv_opa_t opa_scale) | {
if(point_cnt < 3) return;
if(points == NULL) return;
uint32_t i;
lv_point_t tri[3];
tri[0].x = points[0].x;
tri[0].y = points[0].y;
for(i = 0; i < point_cnt - 1; i++) {
tri[1].x = points[i].x;
tri[1].y = points[i].y;
tri[2].x = points[i + 1].x;
tri[2].y = po... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Notes: This is used to disable tagged queuing to a device, yet leave queue in function. */ | void blk_queue_free_tags(struct request_queue *q) | /* Notes: This is used to disable tagged queuing to a device, yet leave queue in function. */
void blk_queue_free_tags(struct request_queue *q) | {
queue_flag_clear_unlocked(QUEUE_FLAG_QUEUED, q);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns: 0 if state changed / non-zero if not changed */ | static int ibmvfc_set_host_state(struct ibmvfc_host *vhost, enum ibmvfc_host_state state) | /* Returns: 0 if state changed / non-zero if not changed */
static int ibmvfc_set_host_state(struct ibmvfc_host *vhost, enum ibmvfc_host_state state) | {
int rc = 0;
switch (vhost->state) {
case IBMVFC_HOST_OFFLINE:
rc = -EINVAL;
break;
default:
vhost->state = state;
break;
};
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The fault signal to the PWM generator is generated by ORing together each of the signals whose inputs are specified in the */ | void PWMGenFaultTriggerSet(unsigned long ulBase, unsigned long ulGen, unsigned long ulGroup, unsigned long ulFaultTriggers) | /* The fault signal to the PWM generator is generated by ORing together each of the signals whose inputs are specified in the */
void PWMGenFaultTriggerSet(unsigned long ulBase, unsigned long ulGen, unsigned long ulGroup, unsigned long ulFaultTriggers) | {
ASSERT(HWREG(SYSCTL_DC5) & SYSCTL_DC5_PWMEFLT);
ASSERT(ulBase == PWM_BASE);
ASSERT(PWMGenValid(ulGen));
ASSERT((ulGroup == PWM_FAULT_GROUP_0) || (ulGroup == PWM_FAULT_GROUP_1));
ASSERT((ulFaultTriggers & ~(PWM_FAULT_FAULT0 | PWM_FAULT_FAULT1 |
PWM_FAULT_FAULT2 | PWM... | watterott/WebRadio | C++ | null | 71 |
/* Writes one pixel to the LCD controller. DMDIF_prepareDataAccess() needs to be called before writing data using this function. */ | EMSTATUS DMDIF_writeData(uint32_t data) | /* Writes one pixel to the LCD controller. DMDIF_prepareDataAccess() needs to be called before writing data using this function. */
EMSTATUS DMDIF_writeData(uint32_t data) | {
DVK_writeRegister( (uint16_t *) data_register, (data & 0x0003FE00) >> 9);
DVK_writeRegister( (uint16_t *) data_register, (data & 0x000001FF));
return DMD_OK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set the specified data holding register value for dual channel DAC. */ | void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1) | /* Set the specified data holding register value for dual channel DAC. */
void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1) | {
uint32_t data = 0;
assert_param(IS_DAC_ALIGN(DAC_Align));
assert_param(IS_DAC_DATA(Data1));
assert_param(IS_DAC_DATA(Data2));
if (DAC_Align == DAC_Align_8b_R)
{
data = ((uint32_t)Data2 << 8) | Data1;
}
else
{
data = ((uint32_t)Data2 << 16) | Data1;
}
*((__I... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables the specified SAI Block peripheral. */ | void SAI_Cmd(SAI_Block_TypeDef *SAI_Block_x, FunctionalState NewState) | /* Enables or disables the specified SAI Block peripheral. */
void SAI_Cmd(SAI_Block_TypeDef *SAI_Block_x, FunctionalState NewState) | {
assert_param(IS_SAI_BLOCK_PERIPH(SAI_Block_x));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
SAI_Block_x->CR1 |= SAI_xCR1_SAIEN;
}
else
{
SAI_Block_x->CR1 &= ~(SAI_xCR1_SAIEN);
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* returns zero if a bit matches, or a negative error code. */ | static int pcxhr_check_reg_bit(struct pcxhr_mgr *mgr, unsigned int reg, unsigned char mask, unsigned char bit, int time, unsigned char *read) | /* returns zero if a bit matches, or a negative error code. */
static int pcxhr_check_reg_bit(struct pcxhr_mgr *mgr, unsigned int reg, unsigned char mask, unsigned char bit, int time, unsigned char *read) | {
int i = 0;
unsigned long end_time = jiffies + (time * HZ + 999) / 1000;
do {
*read = PCXHR_INPB(mgr, reg);
if ((*read & mask) == bit) {
if (i > 100)
snd_printdd("ATTENTION! check_reg(%x) "
"loopcount=%d\n",
reg, i);
return 0;
}
i++;
} while (time_after_eq(end_time, jiffies));
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* SRC (8bit) = SRC DST (8bit) = SRC */ | void transfer8x8_copy_c(uint8_t *const dst, const uint8_t *const src, const uint32_t stride) | /* SRC (8bit) = SRC DST (8bit) = SRC */
void transfer8x8_copy_c(uint8_t *const dst, const uint8_t *const src, const uint32_t stride) | {
int j, i;
for (j = 0; j < 8; ++j) {
uint8_t *d = dst + j*stride;
const uint8_t *s = src + j*stride;
for (i = 0; i < 8; ++i)
{
*d++ = *s++;
}
}
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Construct full path according to dir and file path. */ | CHAR16* ConstructFullPath(IN CHAR16 *DirPath, IN CHAR16 *FilePath, IN UINTN Size) | /* Construct full path according to dir and file path. */
CHAR16* ConstructFullPath(IN CHAR16 *DirPath, IN CHAR16 *FilePath, IN UINTN Size) | {
UINTN DirPathSize;
DirPathSize = StrLen (DirPath);
*(DirPath + DirPathSize) = L'\\';
StrnCatS (DirPath, DirPathSize + Size + 1, FilePath, Size);
*(DirPath + DirPathSize + Size + 1) = 0;
return DirPath;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Finish up after inputting a compressed-data scan. This is called by the coefficient controller after it's read all the expected data of the scan. */ | finish_input_pass(j_decompress_ptr cinfo) | /* Finish up after inputting a compressed-data scan. This is called by the coefficient controller after it's read all the expected data of the scan. */
finish_input_pass(j_decompress_ptr cinfo) | {
(*cinfo->entropy->finish_pass) (cinfo);
cinfo->inputctl->consume_input = consume_markers;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ` */ | char* strdup(char *str) const | /* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ` */
char* strdup(char *str) const | {
size_t len;
char *copy;
len = strlen(str) + 1;
if ((copy = malloc(len)) == NULL)
return (NULL);
memcpy(copy, str, len);
return (copy);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Get Vendor Data.
This funtions is used to get the vendor specific data. */ | void adi_ble_GetVendorData(ADI_BLE_VENDOR_DATA *pVendorData) | /* Get Vendor Data.
This funtions is used to get the vendor specific data. */
void adi_ble_GetVendorData(ADI_BLE_VENDOR_DATA *pVendorData) | {
ASSERT(pVendorData != NULL);
memcpy(pVendorData, &pBLERadio->sVendorData, sizeof(ADI_BLE_VENDOR_DATA));
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* If DhContext is NULL, then return FALSE. If Prime is NULL, then return FALSE. */ | BOOLEAN EFIAPI DhSetParameter(IN OUT VOID *DhContext, IN UINTN Generator, IN UINTN PrimeLength, IN CONST UINT8 *Prime) | /* If DhContext is NULL, then return FALSE. If Prime is NULL, then return FALSE. */
BOOLEAN EFIAPI DhSetParameter(IN OUT VOID *DhContext, IN UINTN Generator, IN UINTN PrimeLength, IN CONST UINT8 *Prime) | {
DH *Dh;
BIGNUM *BnP;
BIGNUM *BnG;
if ((DhContext == NULL) || (Prime == NULL) || (PrimeLength > INT_MAX)) {
return FALSE;
}
if ((Generator != DH_GENERATOR_2) && (Generator != DH_GENERATOR_5)) {
return FALSE;
}
Dh = (DH *)DhContext;
BnP = BN_bin2bn ((const unsigned char *)Prime, (int)(... | tianocore/edk2 | C++ | Other | 4,240 |
/* Collect command-line arguments as a string consisting of the arguments, separated by spaces. */ | char* get_args_as_string(int argc, char **argv, int optindex) | /* Collect command-line arguments as a string consisting of the arguments, separated by spaces. */
char* get_args_as_string(int argc, char **argv, int optindex) | {
int len;
int i;
char *argstring;
len = 0;
for (i = optindex; i < argc; i++) {
len += (int) strlen(argv[i]);
len++;
}
argstring = (char *)g_malloc(len);
argstring[0] = '\0';
i = optindex;
for (;;) {
g_strlcat(argstring, argv[i], len);
i++;
... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Configures the EBI for NandFlash access. Pins must be configured after or before calling this function. */ | void BOARD_ConfigureNandFlash(unsigned char busWidth) | /* Configures the EBI for NandFlash access. Pins must be configured after or before calling this function. */
void BOARD_ConfigureNandFlash(unsigned char busWidth) | {
AT91C_BASE_MATRIX->MATRIX_EBI |= AT91C_MATRIX_CS3A_SM;
AT91C_BASE_SMC->SMC_SETUP3 = 0x00000000;
AT91C_BASE_SMC->SMC_PULSE3 = 0x00030003;
AT91C_BASE_SMC->SMC_CYCLE3 = 0x00050005;
AT91C_BASE_SMC->SMC_CTRL3 = 0x00002003;
if (busWidth == 8) {
AT91C_BASE_SMC->SMC_CTRL3 |= AT91C_SMC_DBW_WID... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* @mode: agp mode register value to configure with. */ | void agp_enable(struct agp_bridge_data *bridge, u32 mode) | /* @mode: agp mode register value to configure with. */
void agp_enable(struct agp_bridge_data *bridge, u32 mode) | {
if (!bridge)
return;
bridge->driver->agp_enable(bridge, mode);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the new structure or NULL in case of error */ | xmlURIPtr xmlCreateURI(void) | /* Returns the new structure or NULL in case of error */
xmlURIPtr xmlCreateURI(void) | {
xmlURIErrMemory("creating URI structure\n");
return(NULL);
}
memset(ret, 0, sizeof(xmlURI));
return(ret);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* cgroup_rename - Only allow simple rename of directories in place. */ | static int cgroup_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) | /* cgroup_rename - Only allow simple rename of directories in place. */
static int cgroup_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) | {
if (!S_ISDIR(old_dentry->d_inode->i_mode))
return -ENOTDIR;
if (new_dentry->d_inode)
return -EEXIST;
if (old_dir != new_dir)
return -EIO;
return simple_rename(old_dir, old_dentry, new_dir, new_dentry);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Write zero pool from the WritePos to the end of OFile. */ | EFI_STATUS FatWriteZeroPool(IN FAT_OFILE *OFile, IN UINTN WritePos) | /* Write zero pool from the WritePos to the end of OFile. */
EFI_STATUS FatWriteZeroPool(IN FAT_OFILE *OFile, IN UINTN WritePos) | {
EFI_STATUS Status;
VOID *ZeroBuffer;
UINTN AppendedSize;
UINTN BufferSize;
UINTN WriteSize;
AppendedSize = OFile->FileSize - WritePos;
BufferSize = AppendedSize;
if (AppendedSize > FAT_MAX_ALLOCATE_SIZE) {
BufferSize = FAT_MAX_ALLOCATE_SIZE;
}
ZeroBuffer = AllocateZ... | tianocore/edk2 | C++ | Other | 4,240 |
/* Configures User push-button in GPIO or EXTI Line Mode. */ | void UserButton_Init(void) | /* Configures User push-button in GPIO or EXTI Line Mode. */
void UserButton_Init(void) | {
USER_BUTTON_GPIO_CLK_ENABLE();
LL_GPIO_SetPinMode(USER_BUTTON_GPIO_PORT, USER_BUTTON_PIN, LL_GPIO_MODE_INPUT);
LL_GPIO_SetPinPull(USER_BUTTON_GPIO_PORT, USER_BUTTON_PIN, LL_GPIO_PULL_NO);
USER_BUTTON_SYSCFG_SET_EXTI();
USER_BUTTON_EXTI_LINE_ENABLE();
USER_BUTTON_EXTI_FALLING_TRIG_ENABLE();
NVIC_SetPrior... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Set the callback for checking if a Sink Request is valid. */ | void usbc_set_policy_cb_check_sink_request(const struct device *dev, const policy_cb_check_sink_request_t cb) | /* Set the callback for checking if a Sink Request is valid. */
void usbc_set_policy_cb_check_sink_request(const struct device *dev, const policy_cb_check_sink_request_t cb) | {
struct usbc_port_data *data = dev->data;
data->policy_cb_check_sink_request = cb;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Called after mce notification in process context. This code is allowed to sleep. Call the high level VM handler to process any corrupted pages. Assume that the work queue code only calls this one at a time per CPU. Note we don't disable preemption, so this code might run on the wrong CPU. In this case the event is p... | void mce_notify_process(void) | /* Called after mce notification in process context. This code is allowed to sleep. Call the high level VM handler to process any corrupted pages. Assume that the work queue code only calls this one at a time per CPU. Note we don't disable preemption, so this code might run on the wrong CPU. In this case the event is p... | {
unsigned long pfn;
mce_notify_irq();
while (mce_ring_get(&pfn))
memory_failure(pfn, MCE_VECTOR);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Reads and returns the current value of CR3. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */ | UINTN EFIAPI AsmReadCr3(VOID) | /* Reads and returns the current value of CR3. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmReadCr3(VOID) | {
__asm {
mov eax, cr3
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param Node The node to check. Node may be NULL, corresponding to a leaf. */ | BOOLEAN NodeIsNullOrBlack(IN CONST RED_BLACK_TREE_NODE *Node) | /* param Node The node to check. Node may be NULL, corresponding to a leaf. */
BOOLEAN NodeIsNullOrBlack(IN CONST RED_BLACK_TREE_NODE *Node) | {
return (BOOLEAN)(Node == NULL || Node->Color == RedBlackTreeBlack);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Sets the user bits in the status word (16-bits) of an LPC Channel. */ | void LPCChannelStatusSet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulStatus) | /* Sets the user bits in the status word (16-bits) of an LPC Channel. */
void LPCChannelStatusSet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulStatus) | {
unsigned long ulTemp;
ASSERT(ulBase == LPC0_BASE);
ASSERT(LPCChannelValid(ulChannel));
ASSERT((ulStatus & (~LPC_CH0ST_USER_M)) == 0);
ulTemp = HWREG(ulBase + LPC_O_CH0ST + (ulChannel * 0x10));
ulTemp |= ulStatus;
HWREG(ulBase + LPC_O_CH0ST + (ulChannel * 0x10)) = ulTemp;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* VSPrint function to process format and place the results in Buffer. Since a VA_LIST is used this routine allows the nesting of Vararg routines. Thus this is the main print working routine */ | UINTN EFIAPI InternalPrintLibSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN UINTN Flags, IN CONST CHAR8 *FormatString,...) | /* VSPrint function to process format and place the results in Buffer. Since a VA_LIST is used this routine allows the nesting of Vararg routines. Thus this is the main print working routine */
UINTN EFIAPI InternalPrintLibSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN UINTN Flags, IN CONST CHAR8 *FormatStrin... | {
VA_LIST Marker;
UINTN NumberOfPrinted;
VA_START (Marker, FormatString);
NumberOfPrinted = InternalPrintLibSPrintMarker (StartOfBuffer, BufferSize, Flags, FormatString, Marker, NULL);
VA_END (Marker);
return NumberOfPrinted;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get a reference to the blockdevice at @pathname in the current namespace if possible and return it. Return ERR_PTR(error) otherwise. */ | struct block_device* lookup_bdev(const char *pathname) | /* Get a reference to the blockdevice at @pathname in the current namespace if possible and return it. Return ERR_PTR(error) otherwise. */
struct block_device* lookup_bdev(const char *pathname) | {
struct block_device *bdev;
struct inode *inode;
struct path path;
int error;
if (!pathname || !*pathname)
return ERR_PTR(-EINVAL);
error = kern_path(pathname, LOOKUP_FOLLOW, &path);
if (error)
return ERR_PTR(error);
inode = path.dentry->d_inode;
error = -ENOTBLK;
if (!S_ISBLK(inode->i_mode))
goto fail... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The interpretation of the LPC_INT_CHx fields varies based on the type value programed for the specific Channel. */ | unsigned long LPCIntStatus(unsigned long ulBase, tBoolean bMasked) | /* The interpretation of the LPC_INT_CHx fields varies based on the type value programed for the specific Channel. */
unsigned long LPCIntStatus(unsigned long ulBase, tBoolean bMasked) | {
ASSERT(ulBase == LPC0_BASE);
if(bMasked)
{
return(HWREG(ulBase + LPC_O_MIS));
}
else
{
return(HWREG(ulBase + LPC_O_RIS));
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param base SAI base pointer param enable True means enable SAI Rx, false means disable. */ | void SAI_RxEnable(I2S_Type *base, bool enable) | /* param base SAI base pointer param enable True means enable SAI Rx, false means disable. */
void SAI_RxEnable(I2S_Type *base, bool enable) | {
if (enable)
{
if (((base->RCR2 & I2S_RCR2_SYNC_MASK) >> I2S_RCR2_SYNC_SHIFT) == 0x1U)
{
base->TCSR = ((base->TCSR & 0xFFE3FFFFU) | I2S_TCSR_TE_MASK);
}
base->RCSR = ((base->RCSR & 0xFFE3FFFFU) | I2S_RCSR_RE_MASK);
SAI_RxClearStatusFlags(base, kSAI_FIFOErrorF... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Stack space used when we detect a bad kernel stack pointer, and early in SMP boots before relocation is enabled. */ | static void __init emergency_stack_init(void) | /* Stack space used when we detect a bad kernel stack pointer, and early in SMP boots before relocation is enabled. */
static void __init emergency_stack_init(void) | {
unsigned long limit;
unsigned int i;
limit = min(0x10000000ULL, lmb.rmo_size);
for_each_possible_cpu(i) {
unsigned long sp;
sp = lmb_alloc_base(THREAD_SIZE, THREAD_SIZE, limit);
sp += THREAD_SIZE;
paca[i].emergency_sp = __va(sp);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* ADC Set Clock Prescale.
The ADC clock taken from the APB2 clock can be scaled down by 2, 4, 6 or 8. */ | void adc_set_clk_prescale(uint32_t adc, uint32_t prescale) | /* ADC Set Clock Prescale.
The ADC clock taken from the APB2 clock can be scaled down by 2, 4, 6 or 8. */
void adc_set_clk_prescale(uint32_t adc, uint32_t prescale) | {
uint32_t reg32 = ((ADC_CCR(adc) & ~ADC_CCR_CKMODE_MASK) | prescale);
ADC_CCR(adc) = reg32;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Get the captured data for the ADC sample channel. */ | unsigned long ADCDataGet(unsigned long ulBase) | /* Get the captured data for the ADC sample channel. */
unsigned long ADCDataGet(unsigned long ulBase) | {
unsigned long ulData = 0;
unsigned long ulValid = 0;
xASSERT(ulBase == ADC_BASE);
do
{
ulValid = (xHWREG(ulBase + ADC0_SC1A) & ADC0_SC1A_COCO_FLAG) >> 7;
} while(!ulValid);
ulData = xHWREG(ulBase + ADC0_RA);
return ulData;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Reads data from the specified Data Backup Register. */ | uint16_t BKP_ReadBkpData(uint16_t BKP_DAT) | /* Reads data from the specified Data Backup Register. */
uint16_t BKP_ReadBkpData(uint16_t BKP_DAT) | {
__IO uint32_t tmp = 0;
assert_param(IS_BKP_DAT(BKP_DAT));
tmp = (uint32_t)BKP_BASE;
tmp += BKP_DAT;
return (*(__IO uint16_t*)tmp);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Register address automatically incremented during a multiple byte access with a serial interface.. */ | int32_t lsm6dsl_auto_increment_get(stmdev_ctx_t *ctx, uint8_t *val) | /* Register address automatically incremented during a multiple byte access with a serial interface.. */
int32_t lsm6dsl_auto_increment_get(stmdev_ctx_t *ctx, uint8_t *val) | {
lsm6dsl_ctrl3_c_t ctrl3_c;
int32_t ret;
ret = lsm6dsl_read_reg(ctx, LSM6DSL_CTRL3_C, (uint8_t*)&ctrl3_c, 1);
*val = ctrl3_c.if_inc;
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Convert the address within this vma to the page offset within the mapping, in pagecache page units; huge pages here. */ | static pgoff_t vma_hugecache_offset(struct hstate *h, struct vm_area_struct *vma, unsigned long address) | /* Convert the address within this vma to the page offset within the mapping, in pagecache page units; huge pages here. */
static pgoff_t vma_hugecache_offset(struct hstate *h, struct vm_area_struct *vma, unsigned long address) | {
return ((address - vma->vm_start) >> huge_page_shift(h)) +
(vma->vm_pgoff >> huge_page_order(h));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Iterate through the rbtree using a post order traversal path to release the next node. It won't necessary release one at each iteration but it will at least advance closer to the next one to be released. */ | static struct rb_node* release_next(struct tracer_stat *ts, struct rb_node *node) | /* Iterate through the rbtree using a post order traversal path to release the next node. It won't necessary release one at each iteration but it will at least advance closer to the next one to be released. */
static struct rb_node* release_next(struct tracer_stat *ts, struct rb_node *node) | {
struct stat_node *snode;
struct rb_node *parent = rb_parent(node);
if (node->rb_left)
return node->rb_left;
else if (node->rb_right)
return node->rb_right;
else {
if (!parent)
;
else if (parent->rb_left == node)
parent->rb_left = NULL;
else
parent->rb_right = NULL;
snode = container_of(node,... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* IDL typedef struct { IDL LOGON_IDENTITY_INFO logon_info; IDL LM_OWF_PASSWORD lmpassword; IDL NT_OWF_PASSWORD ntpassword; IDL } SERVICE_INFO; */ | static int netlogon_dissect_SERVICE_INFO(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | /* IDL typedef struct { IDL LOGON_IDENTITY_INFO logon_info; IDL LM_OWF_PASSWORD lmpassword; IDL NT_OWF_PASSWORD ntpassword; IDL } SERVICE_INFO; */
static int netlogon_dissect_SERVICE_INFO(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | {
offset = netlogon_dissect_LOGON_IDENTITY_INFO(tvb, offset,
pinfo, tree, di, drep);
offset = netlogon_dissect_LM_OWF_PASSWORD(tvb, offset,
pinfo, tree, di, drep);
offset = netlogon_dissect_NT_OWF_PASSWORD(tvb, o... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* param config Pointer to configuration structure. See to "dcdc_detection_config_t" */ | void DCDC_GetDefaultDetectionConfig(dcdc_detection_config_t *config) | /* param config Pointer to configuration structure. See to "dcdc_detection_config_t" */
void DCDC_GetDefaultDetectionConfig(dcdc_detection_config_t *config) | {
assert(NULL != config);
memset(config, 0, sizeof(*config));
config->enableXtalokDetection = false;
config->powerDownOverVoltageDetection = true;
config->powerDownLowVlotageDetection = false;
config->powerDownOverCurrentDetection = true;
config->powerDownPeakCurrentDetection = true;
con... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Checks whether the packet received is a magic packet?. */ | bool synopGMAC_is_magic_packet_received(synopGMACdevice *gmacdev) | /* Checks whether the packet received is a magic packet?. */
bool synopGMAC_is_magic_packet_received(synopGMACdevice *gmacdev) | {
u32 data;
data = synopGMACReadReg(gmacdev->MacBase, GmacPmtCtrlStatus);
return ((data & GmacPmtMagicPktReceived) == GmacPmtMagicPktReceived);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Copy Tx Message to TX buffer and Request transmission. */ | uint32_t CANFD_TransmitTxMsg(CANFD_T *psCanfd, uint32_t u32TxBufIdx, CANFD_FD_MSG_T *psTxMsg) | /* Copy Tx Message to TX buffer and Request transmission. */
uint32_t CANFD_TransmitTxMsg(CANFD_T *psCanfd, uint32_t u32TxBufIdx, CANFD_FD_MSG_T *psTxMsg) | {
uint32_t u32Success = 0;
uint32_t u32TimeOutCnt = CANFD_TIMEOUT;
u32Success = CANFD_TransmitDMsg(psCanfd, u32TxBufIdx, psTxMsg);
if (u32Success == 1)
{
while (!(psCanfd->TXBRP & (1UL << u32TxBufIdx)))
{
if (--u32TimeOutCnt == 0)
{
u32Success ... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* process the status when related error status happens. */ | void usb_host_errorprocess(USBH_HOST *phost, HOST_STATUS errType) | /* process the status when related error status happens. */
void usb_host_errorprocess(USBH_HOST *phost, HOST_STATUS errType) | {
switch (errType) {
case HSTATUS_APP_DEINIT:
phost->host_state = HOST_ERROR_STATE;
phost->user_callbk->huser_init();
break;
case HSTATUS_SPEED_UNKNOWN:
case HSTATUS_UNRECOVERED_ERROR:
phost->user_callbk->huser_unrecoverederror();
p... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Determine if capsule comes from memory by checking Capsule PPI. */ | static BOOLEAN CheckCapsuleFromRam(IN CONST EFI_PEI_SERVICES **PeiServices) | /* Determine if capsule comes from memory by checking Capsule PPI. */
static BOOLEAN CheckCapsuleFromRam(IN CONST EFI_PEI_SERVICES **PeiServices) | {
EFI_STATUS Status;
PEI_CAPSULE_PPI *Capsule;
Status = PeiServicesLocatePpi (
&gEfiPeiCapsulePpiGuid,
0,
NULL,
(VOID **)&Capsule
);
if (!EFI_ERROR (Status)) {
Status = Capsule->CheckCapsuleUpdate ((EFI_PEI_SERVICES **)PeiServices);
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Return a pointer to the chip entry if found, zero otherwise. */ | struct sym_chip* sym_lookup_chip_table(u_short device_id, u_char revision) | /* Return a pointer to the chip entry if found, zero otherwise. */
struct sym_chip* sym_lookup_chip_table(u_short device_id, u_char revision) | {
struct sym_chip *chip;
int i;
for (i = 0; i < sym_num_devs; i++) {
chip = &sym_dev_table[i];
if (device_id != chip->device_id)
continue;
if (revision > chip->revision_id)
continue;
return chip;
}
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the number of effects a haptic device has. */ | int SDL_HapticNumEffects(SDL_Haptic *haptic) | /* Returns the number of effects a haptic device has. */
int SDL_HapticNumEffects(SDL_Haptic *haptic) | {
if (!ValidHaptic(haptic)) {
return -1;
}
return haptic->neffects;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* The aio_error() function shall return the error status associated with the aiocb structure referenced by the aiocbp argument. The error status for an asynchronous I/O operation is the errno value that would be set by the corresponding read(), write(), */ | int aio_error(const struct aiocb *cb) | /* The aio_error() function shall return the error status associated with the aiocb structure referenced by the aiocbp argument. The error status for an asynchronous I/O operation is the errno value that would be set by the corresponding read(), write(), */
int aio_error(const struct aiocb *cb) | {
if (cb)
{
return cb->aio_result;
}
return -EINVAL;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Make a mailbox call. Returns 0 on failure, non-zero on success */ | int mbox_call(unsigned char ch, int mmu_enable) | /* Make a mailbox call. Returns 0 on failure, non-zero on success */
int mbox_call(unsigned char ch, int mmu_enable) | {
unsigned int r = (((MBOX_ADDR)&~0xF) | (ch&0xF));
if(mmu_enable)
r = BUS_ADDRESS(r);
do
{
asm volatile("nop");
} while (*MBOX_STATUS & MBOX_FULL);
*MBOX_WRITE = r;
while(1)
{
do
{
asm volatile("nop");
} while (*MBOX_STATUS & MBOX_EMPT... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param base FlexIO I2S peripheral base address. param handle FlexIO I2S eDMA handle pointer. param callback FlexIO I2S eDMA callback function called while finished a block. param userData User parameter for callback. param dmaHandle eDMA handle for FlexIO I2S. This handle is a static value allocated by users. */ | void FLEXIO_I2S_TransferRxCreateHandleEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_edma_callback_t callback, void *userData, edma_handle_t *dmaHandle) | /* param base FlexIO I2S peripheral base address. param handle FlexIO I2S eDMA handle pointer. param callback FlexIO I2S eDMA callback function called while finished a block. param userData User parameter for callback. param dmaHandle eDMA handle for FlexIO I2S. This handle is a static value allocated by users. */
voi... | {
assert(handle && dmaHandle);
memset(handle, 0, sizeof(*handle));
handle->dmaHandle = dmaHandle;
handle->callback = callback;
handle->userData = userData;
handle->state = kFLEXIO_I2S_Idle;
s_edmaPrivateHandle[1].base = base;
s_edmaPrivateHandle[1].handle = handle;
EDMA_InstallTC... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* LSM hook implementation that copies security data structure from old to new for policy cloning. */ | int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp) | /* LSM hook implementation that copies security data structure from old to new for policy cloning. */
int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp) | {
struct xfrm_sec_ctx *new_ctx;
if (old_ctx) {
new_ctx = kmalloc(sizeof(*old_ctx) + old_ctx->ctx_len,
GFP_KERNEL);
if (!new_ctx)
return -ENOMEM;
memcpy(new_ctx, old_ctx, sizeof(*new_ctx));
memcpy(new_ctx->ctx_str, old_ctx->ctx_str, new_ctx->ctx_len);
*new_ctxp = new_ctx;
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* fc_seq_start_next() - Lock the exchange and get a new sequence for a given sequence/exchange pair @sp: */ | static struct fc_seq* fc_seq_start_next(struct fc_seq *sp) | /* fc_seq_start_next() - Lock the exchange and get a new sequence for a given sequence/exchange pair @sp: */
static struct fc_seq* fc_seq_start_next(struct fc_seq *sp) | {
struct fc_exch *ep = fc_seq_exch(sp);
spin_lock_bh(&ep->ex_lock);
sp = fc_seq_start_next_locked(sp);
spin_unlock_bh(&ep->ex_lock);
return sp;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Call ExitBootServices again and check that the notification function is not called again. */ | static int execute(void) | /* Call ExitBootServices again and check that the notification function is not called again. */
static int execute(void) | {
if (notification_count != 1) {
efi_st_error("ExitBootServices was not notified\n");
return EFI_ST_FAILURE;
}
efi_st_exit_boot_services();
if (notification_count != 1) {
efi_st_error("ExitBootServices was notified twice\n");
return EFI_ST_FAILURE;
}
return EFI_ST_SUCCESS;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Enables the specified SPI CRC value calculation of the transferred bytes. */ | void SPI_EnableCRC(SPI_T *spi) | /* Enables the specified SPI CRC value calculation of the transferred bytes. */
void SPI_EnableCRC(SPI_T *spi) | {
spi->CTRL1_B.CRCEN = BIT_SET;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* eeprom_field_print_ascii() - print a field which contains ASCII data @field: an initialized field to print */ | void eeprom_field_print_ascii(const struct eeprom_field *field) | /* eeprom_field_print_ascii() - print a field which contains ASCII data @field: an initialized field to print */
void eeprom_field_print_ascii(const struct eeprom_field *field) | {
char format[8];
sprintf(format, "%%.%ds\n", field->size);
printf(PRINT_FIELD_SEGMENT, field->name);
printf(format, field->buf);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Write scan header. This consists of DHT or DAC markers, optional DRI, and SOS. Compressed data will be written following the SOS. */ | write_scan_header(j_compress_ptr cinfo) | /* Write scan header. This consists of DHT or DAC markers, optional DRI, and SOS. Compressed data will be written following the SOS. */
write_scan_header(j_compress_ptr cinfo) | {
my_marker_ptr marker = (my_marker_ptr) cinfo->marker;
int i;
jpeg_component_info *compptr;
if (cinfo->arith_code) {
emit_dac(cinfo);
} else {
for (i = 0; i < cinfo->comps_in_scan; i++) {
compptr = cinfo->cur_comp_info[i];
if (cinfo->Ss == 0 && cinfo->Ah == 0)
emit_dht(cinfo, compptr->dc... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Since: 2.10 Returns: the #GParamSpec that was passed into this function */ | GParamSpec* g_param_spec_ref_sink(GParamSpec *pspec) | /* Since: 2.10 Returns: the #GParamSpec that was passed into this function */
GParamSpec* g_param_spec_ref_sink(GParamSpec *pspec) | {
gsize oldvalue;
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), NULL);
oldvalue = g_atomic_pointer_and (&pspec->qdata, ~(gsize)PARAM_FLOATING_FLAG);
if (!(oldvalue & PARAM_FLOATING_FLAG))
g_param_spec_ref (pspec);
return pspec;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Receive a sequence of bytes from an SPI device.
All bytes sent out on SPI bus are sent as value 0. */ | status_code_t spi_read_packet(Spi *p_spi, uint8_t *data, size_t len) | /* Receive a sequence of bytes from an SPI device.
All bytes sent out on SPI bus are sent as value 0. */
status_code_t spi_read_packet(Spi *p_spi, uint8_t *data, size_t len) | {
uint32_t timeout = SPI_TIMEOUT;
uint8_t val;
uint32_t i = 0;
while (len) {
timeout = SPI_TIMEOUT;
while (!spi_is_tx_ready(p_spi)) {
if (!timeout--) {
return ERR_TIMEOUT;
}
}
spi_write_single(p_spi, CONFIG_SPI_MASTER_DUMMY);
timeout = SPI_TIMEOUT;
while (!spi_is_rx_ready(p_spi)) {
if (!tim... | memfault/zero-to-main | C++ | null | 200 |
/* This API sets the feature config. data start address in the sensor. */ | static uint16_t get_feature_config_start_addr(struct bma4_dev *dev) | /* This API sets the feature config. data start address in the sensor. */
static uint16_t get_feature_config_start_addr(struct bma4_dev *dev) | {
uint16_t rslt;
uint8_t asic_lsb;
uint8_t asic_msb;
rslt = read_regs(BMA4_RESERVED_REG_5B_ADDR, &asic_lsb, 1, dev);
rslt |= read_regs(BMA4_RESERVED_REG_5C_ADDR, &asic_msb, 1, dev);
dev->asic_data.asic_lsb = asic_lsb & 0x0F;
dev->asic_data.asic_msb = asic_msb;
return rslt;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* RTC MSP De-Initialization This function frees the hardware resources used in this example: */ | void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc) | /* RTC MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc) | {
__HAL_RCC_RTC_DISABLE();
HAL_PWR_DisableBkUpAccess();
__HAL_RCC_PWR_CLK_DISABLE();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Waits for a Flash operation to complete or a TIMEOUT to occur. */ | FMC_STATUS_T FMC_WaitForLastOperation(uint32_t timeOut) | /* Waits for a Flash operation to complete or a TIMEOUT to occur. */
FMC_STATUS_T FMC_WaitForLastOperation(uint32_t timeOut) | {
FMC_STATUS_T status = FMC_STATUS_COMPLETE;
status = FMC_ReadStatus();
while((status == FMC_STATUS_BUSY) && (timeOut !=0))
{
status = FMC_ReadStatus();
timeOut--;
}
if(timeOut == 0x00)
{
status = FMC_STATUS_TIMEOUT;
}
return status;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Clears all of the I2C interrupt pending bit. */ | void I2C_ClearAllINT(I2C_TypeDef *I2Cx) | /* Clears all of the I2C interrupt pending bit. */
void I2C_ClearAllINT(I2C_TypeDef *I2Cx) | {
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
I2Cx->IC_CLR_INTR;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Check if an area is fully on an other */ | bool lv_area_is_in(const lv_area_t *ain_p, const lv_area_t *aholder_p) | /* Check if an area is fully on an other */
bool lv_area_is_in(const lv_area_t *ain_p, const lv_area_t *aholder_p) | {
bool is_in = false;
if(ain_p->x1 >= aholder_p->x1 &&
ain_p->y1 >= aholder_p->y1 &&
ain_p->x2 <= aholder_p->x2 &&
ain_p->y2 <= aholder_p->y2) {
is_in = true;
}
return is_in;
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* If there are any sessions left, this will initiate the removal and wait for the completion. */ | void iscsi_host_remove(struct Scsi_Host *shost) | /* If there are any sessions left, this will initiate the removal and wait for the completion. */
void iscsi_host_remove(struct Scsi_Host *shost) | {
struct iscsi_host *ihost = shost_priv(shost);
unsigned long flags;
spin_lock_irqsave(&ihost->lock, flags);
ihost->state = ISCSI_HOST_REMOVED;
spin_unlock_irqrestore(&ihost->lock, flags);
iscsi_host_for_each_session(shost, iscsi_notify_host_removed);
wait_event_interruptible(ihost->session_removal_wq,
ihos... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Generate VEVENT_CARD_INSERT or VEVENT_CARD_REMOVE based on vreader state. Separated from vreader_insert_card to allow replaying events for a given state. */ | void vreader_queue_card_event(VReader *reader) | /* Generate VEVENT_CARD_INSERT or VEVENT_CARD_REMOVE based on vreader state. Separated from vreader_insert_card to allow replaying events for a given state. */
void vreader_queue_card_event(VReader *reader) | {
vevent_queue_vevent(vevent_new(
reader->card ? VEVENT_CARD_INSERT : VEVENT_CARD_REMOVE, reader,
reader->card));
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* The caller must ensure that the buffer pcBuf is large enough to hold the entire converted string, including the null termination character. */ | int usprintf(char *pcBuf, const char *pcString,...) | /* The caller must ensure that the buffer pcBuf is large enough to hold the entire converted string, including the null termination character. */
int usprintf(char *pcBuf, const char *pcString,...) | {
va_list vaArgP;
int iRet;
va_start(vaArgP, pcString);
iRet = uvsnprintf(pcBuf, 0xffff, pcString, vaArgP);
va_end(vaArgP);
return(iRet);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Switch between Normal operation and deep sleep power mode. */ | void EMC_DynCtrlPowerDownMode(uint32_t Power_command) | /* Switch between Normal operation and deep sleep power mode. */
void EMC_DynCtrlPowerDownMode(uint32_t Power_command) | {
uint32_t mask = ~(uint32_t)(_BIT(13));
LPC_EMC->DynamicControl = ((LPC_EMC->DynamicControl & mask)|Power_command);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Because the reader may move the head_page pointer, we can not trust what the head page is (it may be pointing to the reader page). But if the next page is a header page, its flags will be non zero. */ | static int rb_is_head_page(struct ring_buffer_per_cpu *cpu_buffer, struct buffer_page *page, struct list_head *list) | /* Because the reader may move the head_page pointer, we can not trust what the head page is (it may be pointing to the reader page). But if the next page is a header page, its flags will be non zero. */
static int rb_is_head_page(struct ring_buffer_per_cpu *cpu_buffer, struct buffer_page *page, struct list_head *list... | {
unsigned long val;
val = (unsigned long)list->next;
if ((val & ~RB_FLAG_MASK) != (unsigned long)&page->list)
return RB_PAGE_MOVED;
return val & RB_FLAG_MASK;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enable all interrupts on the CPU.
This routine can be called from either interrupt, task or fiber level. */ | void posix_irq_unlock(unsigned int key) | /* Enable all interrupts on the CPU.
This routine can be called from either interrupt, task or fiber level. */
void posix_irq_unlock(unsigned int key) | {
hw_irq_ctrl_change_lock(CONFIG_NATIVE_SIMULATOR_MCU_N, key);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Erases the flash memory. Note that this function also checks that no data is erased outside the flash memory region, so the bootloader can never be erased. */ | blt_bool FlashErase(blt_addr addr, blt_int32u len) | /* Erases the flash memory. Note that this function also checks that no data is erased outside the flash memory region, so the bootloader can never be erased. */
blt_bool FlashErase(blt_addr addr, blt_int32u len) | {
blt_bool result = BLT_TRUE;
blt_int8u first_sector_idx = FLASH_INVALID_SECTOR_IDX;
blt_int8u last_sector_idx = FLASH_INVALID_SECTOR_IDX;
if ((len - 1) > (FLASH_END_ADDRESS - addr))
{
result = BLT_FALSE;
}
if (result == BLT_TRUE)
{
first_sector_idx = FlashGetSectorIdx(addr);
last_sector_id... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Forces the TIMx output 4 waveform to active or inactive level. */ | void TIM_ForcedOC4Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) | /* Forces the TIMx output 4 waveform to active or inactive level. */
void TIM_ForcedOC4Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) | {
uint16_t tmpccmr2 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction));
tmpccmr2 = TIMx->CCMR2;
tmpccmr2 &= (uint16_t)~TIM_CCMR2_OC4M;
tmpccmr2 |= (uint16_t)(TIM_ForcedAction << 8);
TIMx->CCMR2 = tmpccmr2;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* If Alignment is not a power of two and Alignment is not zero, then ASSERT(). If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). */ | VOID* EFIAPI AllocateAlignedRuntimePages(IN UINTN Pages, IN UINTN Alignment) | /* If Alignment is not a power of two and Alignment is not zero, then ASSERT(). If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT(). */
VOID* EFIAPI AllocateAlignedRuntimePages(IN UINTN Pages, IN UINTN Alignment) | {
return InternalAllocateAlignedPages (EfiRuntimeServicesData, Pages, Alignment);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd) | /* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd) | {
if(hpcd->Instance==USB_OTG_FS)
{
__HAL_RCC_USB_OTG_FS_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12);
if(__HAL_RCC_PWR_IS_CLK_DISABLED())
{
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWREx_DisableVddUSB();
__HAL_RCC_PWR_CLK_DISABLE();
}
else
{
HAL_PWREx_Dis... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Initialize the GPIO pins controlling the power switches. */ | static void power_pins_init(void) | /* Initialize the GPIO pins controlling the power switches. */
static void power_pins_init(void) | {
gpio_init(MULLE_POWER_AVDD, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_init(MULLE_POWER_VPERIPH, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_init(MULLE_POWER_VSEC, GPIO_DIR_OUT, GPIO_NOPULL);
gpio_clear(MULLE_POWER_AVDD);
gpio_clear(MULLE_POWER_VPERIPH);
gpio_clear(MULLE_POWER_VSEC);
} | labapart/polymcu | C++ | null | 201 |
/* Decode a tile/strip and apply the predictor routine. Note that horizontal differencing must be done on a row-by-row basis. The width of a "row" has already been calculated at pre-decode time according to the strip/tile dimensions. */ | static int PredictorDecodeTile(TIFF *tif, uint8 *op0, tmsize_t occ0, uint16 s) | /* Decode a tile/strip and apply the predictor routine. Note that horizontal differencing must be done on a row-by-row basis. The width of a "row" has already been calculated at pre-decode time according to the strip/tile dimensions. */
static int PredictorDecodeTile(TIFF *tif, uint8 *op0, tmsize_t occ0, uint16 s) | {
TIFFPredictorState *sp = PredictorState(tif);
assert(sp != NULL);
assert(sp->decodetile != NULL);
if ((*sp->decodetile)(tif, op0, occ0, s)) {
tmsize_t rowsize = sp->rowsize;
assert(rowsize > 0);
if((occ0%rowsize) !=0)
{
TIFFErrorExt(tif->tif_clientdata, "PredictorDecodeTile",
... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Set the hardware gate setting into the block. If we end up on something other than an S3C64XX, then we might need to change this to using a platform data callback, or some other mechanism. */ | static void s3c_hsotg_gate(struct platform_device *pdev, bool on) | /* Set the hardware gate setting into the block. If we end up on something other than an S3C64XX, then we might need to change this to using a platform data callback, or some other mechanism. */
static void s3c_hsotg_gate(struct platform_device *pdev, bool on) | {
unsigned long flags;
u32 others;
local_irq_save(flags);
others = __raw_readl(S3C64XX_OTHERS);
if (on)
others |= S3C64XX_OTHERS_USBMASK;
else
others &= ~S3C64XX_OTHERS_USBMASK;
__raw_writel(others, S3C64XX_OTHERS);
local_irq_restore(flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* nfs4_alloc_state_owner(): this is called on the OPEN or CREATE path to create a new state_owner. */ | static struct nfs4_state_owner* nfs4_alloc_state_owner(void) | /* nfs4_alloc_state_owner(): this is called on the OPEN or CREATE path to create a new state_owner. */
static struct nfs4_state_owner* nfs4_alloc_state_owner(void) | {
struct nfs4_state_owner *sp;
sp = kzalloc(sizeof(*sp),GFP_KERNEL);
if (!sp)
return NULL;
spin_lock_init(&sp->so_lock);
INIT_LIST_HEAD(&sp->so_states);
INIT_LIST_HEAD(&sp->so_delegations);
rpc_init_wait_queue(&sp->so_sequence.wait, "Seqid_waitqueue");
sp->so_seqid.sequence = &sp->so_sequence;
spin_lock_init... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base Pointer to FLEXIO_I2C_Type structure param baudRate_Bps the baud rate value in HZ param srcClock_Hz source clock in HZ */ | void FLEXIO_I2C_MasterSetBaudRate(FLEXIO_I2C_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz) | /* param base Pointer to FLEXIO_I2C_Type structure param baudRate_Bps the baud rate value in HZ param srcClock_Hz source clock in HZ */
void FLEXIO_I2C_MasterSetBaudRate(FLEXIO_I2C_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz) | {
uint16_t timerDiv = 0;
uint16_t timerCmp = 0;
FLEXIO_Type *flexioBase = base->flexioBase;
timerDiv = srcClock_Hz / baudRate_Bps;
timerDiv = timerDiv / 2 - 1U;
timerCmp = flexioBase->TIMCMP[base->timerIndex[0]];
timerCmp &= 0xFF00;
timerCmp |= timerDiv;
flexioBase->TIMCMP[base->time... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enable the PWM output of the PWM module.
The */ | void PWMOutputEnable(unsigned long ulBase, unsigned long ulChannel) | /* Enable the PWM output of the PWM module.
The */
void PWMOutputEnable(unsigned long ulBase, unsigned long ulChannel) | {
unsigned long ulChannelTemp;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT(ulBase == PWMA_BASE);
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
xHWREG(ulBase + PWM_POE) |= (PWM_POE_PWM0 << (ulChannelTemp));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Webserver task core function.
Support and FAQ: visit */ | static void webserver_task(void *pvParameters) | /* Webserver task core function.
Support and FAQ: visit */
static void webserver_task(void *pvParameters) | {
UNUSED(pvParameters);
WAIT_FOR_TOUCH_EVENT;
while (1)
{
ethernet_task();
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* set the number of remaining data to be transferred by the DMA */ | void dma_transfer_number_config(dma_channel_enum channelx, uint32_t number) | /* set the number of remaining data to be transferred by the DMA */
void dma_transfer_number_config(dma_channel_enum channelx, uint32_t number) | {
DMA_CHCNT(channelx) = number;
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* Return the number of bytes of data available in the circular buffer. */ | static unsigned int pl2303_buf_data_avail(struct pl2303_buf *pb) | /* Return the number of bytes of data available in the circular buffer. */
static unsigned int pl2303_buf_data_avail(struct pl2303_buf *pb) | {
if (pb == NULL)
return 0;
return (pb->buf_size + pb->buf_put - pb->buf_get) % pb->buf_size;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is called via menu_items_iter, so it returns a pointer to the item if the key matches, and returns NULL otherwise. */ | static void* menu_item_key_match(struct menu *m, struct menu_item *item, void *extra) | /* This is called via menu_items_iter, so it returns a pointer to the item if the key matches, and returns NULL otherwise. */
static void* menu_item_key_match(struct menu *m, struct menu_item *item, void *extra) | {
char *item_key = extra;
if (!item_key || !item->key) {
if (item_key == item->key)
return item;
return NULL;
}
if (strcmp(item->key, item_key) == 0)
return item;
return NULL;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function de-Initializes common part of the HAL and stops the systick. This function is optional. */ | HAL_StatusTypeDef HAL_DeInit(void) | /* This function de-Initializes common part of the HAL and stops the systick. This function is optional. */
HAL_StatusTypeDef HAL_DeInit(void) | {
HAL_MspDeInit();
return HAL_OK;
} | ua1arn/hftrx | C++ | null | 69 |
/* param base CDOG peripheral base address. param add Value to be added. */ | void CDOG_Add1(CDOG_Type *base) | /* param base CDOG peripheral base address. param add Value to be added. */
void CDOG_Add1(CDOG_Type *base) | {
base->ADD1 = (secure_counter_t)0x1U;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables the PTP time stamp for transmit and receive frames. */ | void ETH_StartPTPTimeStamp(FunctionalState Cmd) | /* Enables or disables the PTP time stamp for transmit and receive frames. */
void ETH_StartPTPTimeStamp(FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
ETH->PTPTSCTRL |= ETH_PTPTSCTRL_TSENA;
}
else
{
ETH->PTPTSCTRL &= (~(uint32_t)ETH_PTPTSCTRL_TSENA);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is called with hbalock held to add a command iocb to the txq when SLI layer cannot submit the command iocb to the ring. */ | static void __lpfc_sli_ringtx_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_iocbq *piocb) | /* This function is called with hbalock held to add a command iocb to the txq when SLI layer cannot submit the command iocb to the ring. */
static void __lpfc_sli_ringtx_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_iocbq *piocb) | {
list_add_tail(&piocb->list, &pring->txq);
pring->txq_cnt++;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Both r8169 chips on the n2100 exhibit PCI parity problems. Set the ->broken_parity_status flag for both ports so that the r8169 driver knows it should ignore error interrupts. */ | static void n2100_fixup_r8169(struct pci_dev *dev) | /* Both r8169 chips on the n2100 exhibit PCI parity problems. Set the ->broken_parity_status flag for both ports so that the r8169 driver knows it should ignore error interrupts. */
static void n2100_fixup_r8169(struct pci_dev *dev) | {
if (dev->bus->number == 0 &&
(dev->devfn == PCI_DEVFN(1, 0) ||
dev->devfn == PCI_DEVFN(2, 0)))
dev->broken_parity_status = 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* v9fs_fill_super - populate superblock with info @sb: superblock @v9ses: session information @flags: flags propagated from v9fs_get_sb() */ | static void v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, int flags, void *data) | /* v9fs_fill_super - populate superblock with info @sb: superblock @v9ses: session information @flags: flags propagated from v9fs_get_sb() */
static void v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, int flags, void *data) | {
sb->s_maxbytes = MAX_LFS_FILESIZE;
sb->s_blocksize_bits = fls(v9ses->maxdata - 1);
sb->s_blocksize = 1 << sb->s_blocksize_bits;
sb->s_magic = V9FS_MAGIC;
sb->s_op = &v9fs_super_ops;
sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC |
MS_NOATIME;
save_mount_options(sb, data);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set CNTP_CVAL This function assigns the given value to 64bits PL1 Physical Timer CompareValue Register (CNTP_CVAL). param value: CNTP_CVAL Register value to set */ | static void __set_cntp_cval(rt_uint64_t value) | /* Set CNTP_CVAL This function assigns the given value to 64bits PL1 Physical Timer CompareValue Register (CNTP_CVAL). param value: CNTP_CVAL Register value to set */
static void __set_cntp_cval(rt_uint64_t value) | {
__set_cp64(15, 2, value, 14);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function will disable the SysTick interrupt, preventing it from being reflected to the processor. */ | void SysTickIntDisable(void) | /* This function will disable the SysTick interrupt, preventing it from being reflected to the processor. */
void SysTickIntDisable(void) | {
HWREG(NVIC_ST_CTRL) &= ~(NVIC_ST_CTRL_INTEN);
} | watterott/WebRadio | C++ | null | 71 |
/* The following functions handle opens on a file that displays a pidlist (tasks or procs). Prepare an array of the process/thread IDs of whoever's in the cgroup. */ | static int cgroup_pidlist_open(struct file *file, enum cgroup_filetype type) | /* The following functions handle opens on a file that displays a pidlist (tasks or procs). Prepare an array of the process/thread IDs of whoever's in the cgroup. */
static int cgroup_pidlist_open(struct file *file, enum cgroup_filetype type) | {
struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent);
struct cgroup_pidlist *l;
int retval;
if (!(file->f_mode & FMODE_READ))
return 0;
retval = pidlist_array_load(cgrp, type, &l);
if (retval)
return retval;
file->f_op = &cgroup_pidlist_operations;
retval = seq_open(file, &cgroup_pidlist_seq_operation... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does no... | EFI_STATUS EFIAPI UsbRndisComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | /* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does no... | {
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
gUsbRndisDriverNameTable,
DriverName,
(BOOLEAN)(This == &gUsbRndisComponentName)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Callback to be used by PE to check is VBUS is ready or present. */ | USBPD_FunctionalState USBPD_DPM_IsPowerReady(uint8_t PortNum, USBPD_VSAFE_StatusTypeDef Vsafe) | /* Callback to be used by PE to check is VBUS is ready or present. */
USBPD_FunctionalState USBPD_DPM_IsPowerReady(uint8_t PortNum, USBPD_VSAFE_StatusTypeDef Vsafe) | {
return ((USBPD_OK == USBPD_PWR_IF_SupplyReady(PortNum, Vsafe)) ? USBPD_ENABLE : USBPD_DISABLE);
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.