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
|
|---|---|---|---|---|---|---|---|
/* This function gets the video mode currently used by the generator in the VTC core. If the video mode is unknown or not recognized, then 0 will be returned. */
|
u16 XVtc_GetGeneratorVideoMode(XVtc *InstancePtr)
|
/* This function gets the video mode currently used by the generator in the VTC core. If the video mode is unknown or not recognized, then 0 will be returned. */
u16 XVtc_GetGeneratorVideoMode(XVtc *InstancePtr)
|
{
u16 mode;
XVtc_Timing Timing;
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XVtc_GetGeneratorTiming(InstancePtr, &Timing);
mode = XVtc_ConvTiming2VideoMode(InstancePtr, &Timing);
return mode;
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* This function sets the update marker flag for volume @vol. Returns zero in case of success and a negative error code in case of failure. */
|
static int set_update_marker(struct ubi_device *ubi, struct ubi_volume *vol)
|
/* This function sets the update marker flag for volume @vol. Returns zero in case of success and a negative error code in case of failure. */
static int set_update_marker(struct ubi_device *ubi, struct ubi_volume *vol)
|
{
int err;
struct ubi_vtbl_record vtbl_rec;
dbg_gen("set update marker for volume %d", vol->vol_id);
if (vol->upd_marker) {
ubi_assert(ubi->vtbl[vol->vol_id].upd_marker);
dbg_gen("already set");
return 0;
}
vtbl_rec = ubi->vtbl[vol->vol_id];
vtbl_rec.upd_marker = 1;
mutex_lock(&ubi->device_mutex);
err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec);
vol->upd_marker = 1;
mutex_unlock(&ubi->device_mutex);
return err;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* %-EINVAL - bmap is broken. (the caller should call nilfs_error()) */
|
int nilfs_mdt_delete_block(struct inode *inode, unsigned long block)
|
/* %-EINVAL - bmap is broken. (the caller should call nilfs_error()) */
int nilfs_mdt_delete_block(struct inode *inode, unsigned long block)
|
{
struct nilfs_inode_info *ii = NILFS_I(inode);
int err;
err = nilfs_bmap_delete(ii->i_bmap, block);
if (!err || err == -ENOENT) {
nilfs_mdt_mark_dirty(inode);
nilfs_mdt_forget_block(inode, block);
}
return err;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Reads and returns the current value of DR3. 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 AsmReadDr3(VOID)
|
/* Reads and returns the current value of DR3. 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 AsmReadDr3(VOID)
|
{
__asm {
mov eax, dr3
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* 8.19 EPS Bearer Level Traffic Flow Template (Bearer TFT) */
|
static void dissect_gtpv2_bearer_tft(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_, session_args_t *args _U_)
|
/* 8.19 EPS Bearer Level Traffic Flow Template (Bearer TFT) */
static void dissect_gtpv2_bearer_tft(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint16 length, guint8 message_type _U_, guint8 instance _U_, session_args_t *args _U_)
|
{
de_sm_tflow_temp(tvb, tree, pinfo, 0, length, NULL, 0);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Reads a data element from the input registers data table.
Write the value of the input register in your CPUs native endianess. The MicroTBX-Modbus stack will automatically convert this to the big endianess that the Modbus protocol requires. Note that the element is specified by its zero-based address in the range 0 - 65535, not its element number (1 - 65536). */
|
static tTbxMbServerResult AppReadInputReg(tTbxMbServer channel, uint16_t addr, uint16_t *value)
|
/* Reads a data element from the input registers data table.
Write the value of the input register in your CPUs native endianess. The MicroTBX-Modbus stack will automatically convert this to the big endianess that the Modbus protocol requires. Note that the element is specified by its zero-based address in the range 0 - 65535, not its element number (1 - 65536). */
static tTbxMbServerResult AppReadInputReg(tTbxMbServer channel, uint16_t addr, uint16_t *value)
|
{
tTbxMbServerResult result = TBX_MB_SERVER_OK;
TBX_UNUSED_ARG(channel);
switch (addr)
{
case 30000U:
*value = (uint16_t)TimerGet();
break;
case 30001U:
*value = 12345;
break;
default:
result = TBX_MB_SERVER_ERR_ILLEGAL_DATA_ADDR;
break;
}
return result;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* mx3fb_set_par() - set framebuffer parameters and change the operating mode. @fbi: framebuffer information pointer. */
|
static int mx3fb_set_par(struct fb_info *fbi)
|
/* mx3fb_set_par() - set framebuffer parameters and change the operating mode. @fbi: framebuffer information pointer. */
static int mx3fb_set_par(struct fb_info *fbi)
|
{
struct mx3fb_info *mx3_fbi = fbi->par;
struct mx3fb_data *mx3fb = mx3_fbi->mx3fb;
struct idmac_channel *ichan = mx3_fbi->idmac_channel;
int ret;
dev_dbg(mx3fb->dev, "%s [%c]\n", __func__, list_empty(&ichan->queue) ? '-' : '+');
mutex_lock(&mx3_fbi->mutex);
ret = __set_par(fbi, true);
mutex_unlock(&mx3_fbi->mutex);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */
|
VOID EFIAPI FreeAlignedPages(IN VOID *Buffer, IN UINTN Pages)
|
/* If Buffer was not allocated with an aligned page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */
VOID EFIAPI FreeAlignedPages(IN VOID *Buffer, IN UINTN Pages)
|
{
EFI_STATUS Status;
ASSERT (Pages != 0);
if (BufferInSmram (Buffer)) {
Status = SmmFreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
} else {
Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
}
ASSERT_EFI_ERROR (Status);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Description: If auto-negotiation is enabled, we configure the advertising, and then restart auto-negotiation. If it is not enabled, then we write the BMCR. */
|
int genphy_config_aneg(struct phy_device *phydev)
|
/* Description: If auto-negotiation is enabled, we configure the advertising, and then restart auto-negotiation. If it is not enabled, then we write the BMCR. */
int genphy_config_aneg(struct phy_device *phydev)
|
{
int result;
if (AUTONEG_ENABLE != phydev->autoneg)
return genphy_setup_forced(phydev);
result = genphy_config_advert(phydev);
if (result < 0)
return result;
if (result == 0) {
int ctl = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
if (ctl < 0)
return ctl;
if (!(ctl & BMCR_ANENABLE) || (ctl & BMCR_ISOLATE))
result = 1;
}
if (result > 0)
result = genphy_restart_aneg(phydev);
return result;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Is sp valid as the address of the next kernel stack frame after prev_sp? The next frame may be in a different stack area but should not go back down in the same stack area. */
|
static int valid_next_sp(unsigned long sp, unsigned long prev_sp)
|
/* Is sp valid as the address of the next kernel stack frame after prev_sp? The next frame may be in a different stack area but should not go back down in the same stack area. */
static int valid_next_sp(unsigned long sp, unsigned long prev_sp)
|
{
if (sp & 0xf)
return 0;
if (!validate_sp(sp, current, STACK_FRAME_OVERHEAD))
return 0;
if (sp >= prev_sp + STACK_FRAME_OVERHEAD)
return 1;
if ((sp & ~(THREAD_SIZE - 1)) != (prev_sp & ~(THREAD_SIZE - 1)))
return 1;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enable the PWM interrupt of the PWM module.
The */
|
void PWMIntEnable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
|
/* Enable the PWM interrupt of the PWM module.
The */
void PWMIntEnable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
|
{
unsigned long ulChannelTemp;
ulChannelTemp = ulChannel;
xASSERT((ulBase == PWMA_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 5)));
xASSERT((ulIntType == PWM_INT_DUTY) || (ulIntType == PWM_INT_BRAKE) ||
(ulIntType == PWM_INT_PWM));
if(ulIntType == PWM_INT_PWM)
{
xHWREG(ulBase + PWM_PIER) |= (PWM_PIER_PWMPIE0 << ulChannelTemp) |
PWM_INT_PWM;
}
else if(ulIntType == PWM_INT_DUTY)
{
xHWREG(ulBase + PWM_PIER) |= (PWM_PIER_PWMDIE0 << ulChannelTemp) |
PWM_INT_DUTY;
}
else
{
xHWREG(ulBase + PWM_PIER) |= PWM_PIER_BRKIE;
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Enables PDMA transfer of selected channel for PWM capture. */
|
void PWM_EnablePDMA(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32RisingFirst, uint32_t u32Mode)
|
/* Enables PDMA transfer of selected channel for PWM capture. */
void PWM_EnablePDMA(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32RisingFirst, uint32_t u32Mode)
|
{
uint32_t u32IsOddCh;
u32IsOddCh = u32ChannelNum % 2UL;
(pwm)->PDMACTL = ((pwm)->PDMACTL & ~((PWM_PDMACTL_CHSEL0_1_Msk | PWM_PDMACTL_CAPORD0_1_Msk | PWM_PDMACTL_CAPMOD0_1_Msk) << ((u32ChannelNum >> 1UL) << 3UL))) | \
(((u32IsOddCh << PWM_PDMACTL_CHSEL0_1_Pos) | (u32RisingFirst << PWM_PDMACTL_CAPORD0_1_Pos) | \
u32Mode | PWM_PDMACTL_CHEN0_1_Msk) << ((u32ChannelNum >> 1UL) << 3UL));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Configures the data size for the selected SPI. */
|
void SPI_DataSizeConfig(SPI_TypeDef *SPIx, uint16_t SPI_DataSize)
|
/* Configures the data size for the selected SPI. */
void SPI_DataSizeConfig(SPI_TypeDef *SPIx, uint16_t SPI_DataSize)
|
{
uint16_t tmpreg = 0;
assert_param(IS_SPI_ALL_PERIPH(SPIx));
assert_param(IS_SPI_DATA_SIZE(SPI_DataSize));
tmpreg = SPIx->CR2;
tmpreg &= (uint16_t)~SPI_CR2_DS;
tmpreg |= SPI_DataSize;
SPIx->CR2 = tmpreg;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* The returned entry has a reference count of 1 and is owned by the caller. The caller must allocate the actual table field for this entry and it must be freeable using qemu_vfree(). */
|
CachedL2Table* qed_alloc_l2_cache_entry(L2TableCache *l2_cache)
|
/* The returned entry has a reference count of 1 and is owned by the caller. The caller must allocate the actual table field for this entry and it must be freeable using qemu_vfree(). */
CachedL2Table* qed_alloc_l2_cache_entry(L2TableCache *l2_cache)
|
{
CachedL2Table *entry;
entry = g_malloc0(sizeof(*entry));
entry->ref++;
trace_qed_alloc_l2_cache_entry(l2_cache, entry);
return entry;
}
|
ve3wwg/teensy3_qemu
|
C++
|
Other
| 15
|
/* Returns the endpoint interrupt status on a given USB controller. */
|
unsigned long USBIntStatusEndpoint(unsigned long ulBase)
|
/* Returns the endpoint interrupt status on a given USB controller. */
unsigned long USBIntStatusEndpoint(unsigned long ulBase)
|
{
unsigned long ulStatus;
ASSERT(ulBase == USB0_BASE);
ulStatus = HWREGH(ulBase + USB_O_TXIS);
ulStatus |= (HWREGH(ulBase + USB_O_RXIS) << USB_INTEP_RX_SHIFT);
return(ulStatus);
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* This function calculates the LEB numbers for the LEB properties it contains based on the pnode number. */
|
static void set_pnode_lnum(const struct ubifs_info *c, struct ubifs_pnode *pnode)
|
/* This function calculates the LEB numbers for the LEB properties it contains based on the pnode number. */
static void set_pnode_lnum(const struct ubifs_info *c, struct ubifs_pnode *pnode)
|
{
int i, lnum;
lnum = (pnode->num << UBIFS_LPT_FANOUT_SHIFT) + c->main_first;
for (i = 0; i < UBIFS_LPT_FANOUT; i++) {
if (lnum >= c->leb_cnt)
return;
pnode->lprops[i].lnum = lnum++;
}
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct . */
|
void USART_ClockInit(USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct)
|
/* Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct . */
void USART_ClockInit(USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct)
|
{
uint32_t tmpreg = 0x00;
assert_param(IS_USART_123_PERIPH(USARTx));
assert_param(IS_USART_CLOCK(USART_ClockInitStruct->USART_Clock));
assert_param(IS_USART_CPOL(USART_ClockInitStruct->USART_CPOL));
assert_param(IS_USART_CPHA(USART_ClockInitStruct->USART_CPHA));
assert_param(IS_USART_LASTBIT(USART_ClockInitStruct->USART_LastBit));
tmpreg = USARTx->CR2;
tmpreg &= CR2_CLOCK_CLEAR_Mask;
tmpreg |= (uint32_t)USART_ClockInitStruct->USART_Clock | USART_ClockInitStruct->USART_CPOL |
USART_ClockInitStruct->USART_CPHA | USART_ClockInitStruct->USART_LastBit;
USARTx->CR2 = (uint16_t)tmpreg;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Checks if a command exists, either internally or through the dynamic command protocol. */
|
BOOLEAN EFIAPI ShellCommandIsCommandOnList(IN CONST CHAR16 *CommandString)
|
/* Checks if a command exists, either internally or through the dynamic command protocol. */
BOOLEAN EFIAPI ShellCommandIsCommandOnList(IN CONST CHAR16 *CommandString)
|
{
if (ShellCommandIsCommandOnInternalList (CommandString)) {
return TRUE;
}
return ShellCommandDynamicCommandExists (CommandString);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Initializes the U32Kx peripheral registers to their default reset values. */
|
void U32K_DeInit(U32K_Type *U32Kx)
|
/* Initializes the U32Kx peripheral registers to their default reset values. */
void U32K_DeInit(U32K_Type *U32Kx)
|
{
assert_parameters(IS_U32K_ALL_INSTANCE(U32Kx));
U32Kx->CTRL0 &= ~U32K_CTRL0_EN;
U32Kx->STS = U32K_STS_Msk;
U32Kx->CTRL0 = U32K_CTRL0_RSTValue;
U32Kx->CTRL1 = U32K_CTRL1_RSTValue;
U32Kx->BAUDDIV = U32K_PHASE_RSTValue;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Get to know the Tx FIFO is full or not from the specified port. */
|
xtBoolean UARTFIFOTxIsFull(unsigned long ulBase)
|
/* Get to know the Tx FIFO is full or not from the specified port. */
xtBoolean UARTFIFOTxIsFull(unsigned long ulBase)
|
{
xASSERT(UARTBaseValid(ulBase));
return((xHWREG(ulBase + UART_FSR) & UART_FSR_TX_FF) ? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Display a short tutorial for using the 'di' command in case of mistake. */
|
static void aiodio_digital_in_prompt(struct aiodio_dev *dev)
|
/* Display a short tutorial for using the 'di' command in case of mistake. */
static void aiodio_digital_in_prompt(struct aiodio_dev *dev)
|
{
usr_uart_write_string(dev->board_cli->uart_device,
(uint8_t*)"Digital Input command model:\n");
usr_uart_write_string(dev->board_cli->uart_device,
(uint8_t*)"di x\n");
usr_uart_write_string(dev->board_cli->uart_device,
(uint8_t*)"Where:\n");
usr_uart_write_string(dev->board_cli->uart_device,
(uint8_t*)"\tx = channel number (0-7);\n");
usr_uart_write_string(dev->board_cli->uart_device,
(uint8_t*)"The spaces <' '> are mandatory.\n");
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Searches the FFS file for a section by its type */
|
EFI_STATUS FvBufFindSectionByType(IN VOID *FfsFile, IN UINT8 Type, OUT VOID **Section)
|
/* Searches the FFS file for a section by its type */
EFI_STATUS FvBufFindSectionByType(IN VOID *FfsFile, IN UINT8 Type, OUT VOID **Section)
|
{
EFI_STATUS Status;
UINTN Key;
VOID* SectionStart;
UINTN TotalSectionsSize;
EFI_COMMON_SECTION_HEADER* NextSection;
SectionStart = (VOID*)((UINTN)FfsFile + FvBufGetFfsHeaderSize(FfsFile));
TotalSectionsSize =
FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)FfsFile) -
FvBufGetFfsHeaderSize(FfsFile);
Key = 0;
while (TRUE) {
Status = FvBufFindNextSection (
SectionStart,
TotalSectionsSize,
&Key,
(VOID **)&NextSection
);
if (EFI_ERROR (Status)) {
return Status;
}
if (Type == NextSection->Type) {
if (Section != NULL) {
*Section = NextSection;
}
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Change Logs: Date Author Notes 勤为本 first version 获取指定gpio的CFG寄存器 @gpio gpio编号 @ret CFG寄存器 */
|
volatile unsigned int* gpio_get_cfg_reg(unsigned int gpio)
|
/* Change Logs: Date Author Notes 勤为本 first version 获取指定gpio的CFG寄存器 @gpio gpio编号 @ret CFG寄存器 */
volatile unsigned int* gpio_get_cfg_reg(unsigned int gpio)
|
{
volatile unsigned int *gpio_cfgx = NULL;
unsigned int port = GPIO_GET_PORT(gpio);
switch (port)
{
case 0:
gpio_cfgx = (volatile unsigned int *)LS1C_GPIO_CFG0;
break;
case 1:
gpio_cfgx = (volatile unsigned int *)LS1C_GPIO_CFG1;
break;
case 2:
gpio_cfgx = (volatile unsigned int *)LS1C_GPIO_CFG2;
break;
case 3:
gpio_cfgx = (volatile unsigned int *)LS1C_GPIO_CFG3;
break;
default:
gpio_cfgx = NULL;
break;
}
return gpio_cfgx;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Safely release the modem from any context.
This function can be called from any context and guarantees that the release operations will only be run once. */
|
static bool modem_release(struct sx12xx_data *data)
|
/* Safely release the modem from any context.
This function can be called from any context and guarantees that the release operations will only be run once. */
static bool modem_release(struct sx12xx_data *data)
|
{
if (!atomic_cas(&data->modem_usage, STATE_BUSY, STATE_CLEANUP)) {
return false;
}
Radio.Sleep();
data->operation_done = NULL;
atomic_clear(&data->modem_usage);
return true;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* get the ring block buffer object buffer size */
|
rt_size_t rt_rbb_get_buf_size(rt_rbb_t rbb)
|
/* get the ring block buffer object buffer size */
rt_size_t rt_rbb_get_buf_size(rt_rbb_t rbb)
|
{
RT_ASSERT(rbb);
return rbb->buf_size;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* @cmd: command block to be used for cancelling the HCAM */
|
static void pmcraid_cancel_ldn(struct pmcraid_cmd *cmd)
|
/* @cmd: command block to be used for cancelling the HCAM */
static void pmcraid_cancel_ldn(struct pmcraid_cmd *cmd)
|
{
pmcraid_cancel_hcam(cmd,
PMCRAID_HCAM_CODE_LOG_DATA,
pmcraid_cancel_ccn);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Dissect 802.11 with a variable-length link-layer header and without an FCS, but no pseudo-header. */
|
static int dissect_ieee80211_withoutfcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
/* Dissect 802.11 with a variable-length link-layer header and without an FCS, but no pseudo-header. */
static int dissect_ieee80211_withoutfcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
{
struct ieee_802_11_phdr phdr;
memset(&phdr, 0, sizeof(phdr));
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
phdr.phy = PHDR_802_11_PHY_UNKNOWN;
dissect_ieee80211_common(tvb, pinfo, tree, IEEE80211_COMMON_OPT_NORMAL_QOS, &phdr);
return tvb_captured_length(tvb);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function acquires the irq spinlock and can be called from interrupt context. */
|
void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect)
|
/* This function acquires the irq spinlock and can be called from interrupt context. */
void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect)
|
{
struct uvc_buffer *buf;
unsigned long flags;
spin_lock_irqsave(&queue->irqlock, flags);
while (!list_empty(&queue->irqqueue)) {
buf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
queue);
list_del(&buf->queue);
buf->state = UVC_BUF_STATE_ERROR;
wake_up(&buf->wait);
}
if (disconnect)
queue->flags |= UVC_QUEUE_DISCONNECTED;
spin_unlock_irqrestore(&queue->irqlock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Stops the PWM output signal generation on the designed timer output. */
|
void HRTIM_SimplePWMStop(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, uint32_t PWMChannel)
|
/* Stops the PWM output signal generation on the designed timer output. */
void HRTIM_SimplePWMStop(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, uint32_t PWMChannel)
|
{
assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel));
HRTIMx->HRTIM_COMMON.DISR |= PWMChannel;
__HRTIM_DISABLE(HRTIMx, TimerIdxToTimerId[TimerIdx]);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* set up the ttyS0 serial port baud rate timers */
|
void __init console_set_baud(unsigned baud)
|
/* set up the ttyS0 serial port baud rate timers */
void __init console_set_baud(unsigned baud)
|
{
unsigned value, high, low;
u8 lcr;
value = __serial_clock_speed_HZ / 16 / baud;
high = __serial_clock_speed_HZ / 16 / value;
low = __serial_clock_speed_HZ / 16 / (value + 1);
if (low + (high - low) / 2 > baud)
value++;
lcr = __UART0(LCR);
__UART0(LCR) |= UART_LCR_DLAB;
mb();
__UART0(DLL) = value & 0xff;
__UART0(DLM) = (value >> 8) & 0xff;
mb();
__UART0(LCR) = lcr;
mb();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Description: Register the unlabeled packet NetLabel component with the Generic NETLINK mechanism. Returns zero on success, negative values on failure. */
|
int __init netlbl_unlabel_genl_init(void)
|
/* Description: Register the unlabeled packet NetLabel component with the Generic NETLINK mechanism. Returns zero on success, negative values on failure. */
int __init netlbl_unlabel_genl_init(void)
|
{
return genl_register_family_with_ops(&netlbl_unlabel_gnl_family,
netlbl_unlabel_genl_ops, ARRAY_SIZE(netlbl_unlabel_genl_ops));
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* param base Pointer to FLEXIO_I2S_Type structure param format Pointer to FlexIO I2S audio data format structure. */
|
void FLEXIO_I2S_SlaveSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format)
|
/* param base Pointer to FLEXIO_I2S_Type structure param format Pointer to FlexIO I2S audio data format structure. */
void FLEXIO_I2S_SlaveSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format)
|
{
base->flexioBase->TIMCMP[base->fsTimerIndex] = FLEXIO_TIMCMP_CMP(format->bitWidth * 4UL - 3UL);
base->flexioBase->TIMCMP[base->bclkTimerIndex] = FLEXIO_TIMCMP_CMP(format->bitWidth * 2UL - 1UL);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Converts a Bluetooth device path structure to its string representative. */
|
VOID DevPathToTextBluetoothLE(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
|
/* Converts a Bluetooth device path structure to its string representative. */
VOID DevPathToTextBluetoothLE(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
|
{
BLUETOOTH_LE_DEVICE_PATH *BluetoothLE;
BluetoothLE = DevPath;
UefiDevicePathLibCatPrint (
Str,
L"BluetoothLE(%02x%02x%02x%02x%02x%02x,0x%02x)",
BluetoothLE->Address.Address[0],
BluetoothLE->Address.Address[1],
BluetoothLE->Address.Address[2],
BluetoothLE->Address.Address[3],
BluetoothLE->Address.Address[4],
BluetoothLE->Address.Address[5],
BluetoothLE->Address.Type
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Create an ACL representing the file mode permission bits of an inode. */
|
struct posix_acl* posix_acl_from_mode(mode_t mode, gfp_t flags)
|
/* Create an ACL representing the file mode permission bits of an inode. */
struct posix_acl* posix_acl_from_mode(mode_t mode, gfp_t flags)
|
{
struct posix_acl *acl = posix_acl_alloc(3, flags);
if (!acl)
return ERR_PTR(-ENOMEM);
acl->a_entries[0].e_tag = ACL_USER_OBJ;
acl->a_entries[0].e_id = ACL_UNDEFINED_ID;
acl->a_entries[0].e_perm = (mode & S_IRWXU) >> 6;
acl->a_entries[1].e_tag = ACL_GROUP_OBJ;
acl->a_entries[1].e_id = ACL_UNDEFINED_ID;
acl->a_entries[1].e_perm = (mode & S_IRWXG) >> 3;
acl->a_entries[2].e_tag = ACL_OTHER;
acl->a_entries[2].e_id = ACL_UNDEFINED_ID;
acl->a_entries[2].e_perm = (mode & S_IRWXO);
return acl;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Release the group dquot pointers the user dquots may be carrying around as a hint. mplist is locked on entry and exit. */
|
STATIC void xfs_qm_detach_gdquots(xfs_mount_t *mp)
|
/* Release the group dquot pointers the user dquots may be carrying around as a hint. mplist is locked on entry and exit. */
STATIC void xfs_qm_detach_gdquots(xfs_mount_t *mp)
|
{
xfs_dquot_t *dqp, *gdqp;
int nrecl;
again:
ASSERT(XFS_QM_IS_MPLIST_LOCKED(mp));
dqp = XFS_QI_MPLNEXT(mp);
while (dqp) {
xfs_dqlock(dqp);
if ((gdqp = dqp->q_gdquot)) {
xfs_dqlock(gdqp);
dqp->q_gdquot = NULL;
}
xfs_dqunlock(dqp);
if (gdqp) {
nrecl = XFS_QI_MPLRECLAIMS(mp);
xfs_qm_mplist_unlock(mp);
xfs_qm_dqput(gdqp);
xfs_qm_mplist_lock(mp);
if (nrecl != XFS_QI_MPLRECLAIMS(mp))
goto again;
}
dqp = dqp->MPL_NEXT;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Disable the FLASH Prefetch Buffer.
Note carefully the restrictions under which the prefetch buffer may be set to disabled. See the reference and programming manuals for details. */
|
void flash_prefetch_disable(void)
|
/* Disable the FLASH Prefetch Buffer.
Note carefully the restrictions under which the prefetch buffer may be set to disabled. See the reference and programming manuals for details. */
void flash_prefetch_disable(void)
|
{
FLASH_ACR &= ~FLASH_ACR_PRFTEN;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Set specified permissions for a page in the appropriate page table */
|
static void mpu_context_map_page(struct mm_struct *mm, unsigned int a, unsigned int f)
|
/* Set specified permissions for a page in the appropriate page table */
static void mpu_context_map_page(struct mm_struct *mm, unsigned int a, unsigned int f)
|
{
mpu_context_t *p;
mpu_addr_region_t *r;
unsigned int *mask;
unsigned int page;
unsigned int idx;
unsigned int bit;
int i;
r = mpu_addr_region_find(a);
if (! r) {
goto Done;
}
p = mpu_context_p(mm);
i = r - mpu_addr_region_tbl;
mask = p->page_tbl + mpu_page_tbl_off[i];
page = (a - r->bot) >> PAGE_SHIFT;
idx = page >> 5;
bit = 1 << (page & 31);
if (f & (VM_READ | VM_WRITE | VM_EXEC)) mask[idx] |= bit;
else mask[idx] &= ~bit;
Done: ;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Returns true if @filename is specified by "deny_rewrite" directive, false otherwise. */
|
static bool tomoyo_is_no_rewrite_file(const struct tomoyo_path_info *filename)
|
/* Returns true if @filename is specified by "deny_rewrite" directive, false otherwise. */
static bool tomoyo_is_no_rewrite_file(const struct tomoyo_path_info *filename)
|
{
struct tomoyo_no_rewrite_entry *ptr;
bool found = false;
down_read(&tomoyo_no_rewrite_list_lock);
list_for_each_entry(ptr, &tomoyo_no_rewrite_list, list) {
if (ptr->is_deleted)
continue;
if (!tomoyo_path_matches_pattern(filename, ptr->pattern))
continue;
found = true;
break;
}
up_read(&tomoyo_no_rewrite_list_lock);
return found;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* send the command of get HID descriptor to the device */
|
static usbh_status usbh_hid_desc_get(usbh_host *puhost, uint16_t len)
|
/* send the command of get HID descriptor to the device */
static usbh_status usbh_hid_desc_get(usbh_host *puhost, uint16_t len)
|
{
usbh_status status = USBH_BUSY;
if (CTL_IDLE == puhost->control.ctl_state) {
puhost->control.setup.req = (usb_req) {
.bmRequestType = USB_TRX_IN | USB_RECPTYPE_ITF | USB_REQTYPE_STRD,
.bRequest = USB_GET_DESCRIPTOR,
.wValue = USBH_DESC(USB_DESCTYPE_HID),
.wIndex = 0U,
.wLength = len
};
usbh_ctlstate_config (puhost, puhost->dev_prop.data, len);
}
status = usbh_ctl_handler (puhost);
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Set the 400MHz RC oscillator tune value when the tune logic is disabled. */
|
void CLOCK_OSC_SetOscRc400MTuneValue(uint8_t tuneValue)
|
/* Set the 400MHz RC oscillator tune value when the tune logic is disabled. */
void CLOCK_OSC_SetOscRc400MTuneValue(uint8_t tuneValue)
|
{
uint32_t tmp32;
tmp32 = ANATOP_AI_Read(kAI_Itf_400m, kAI_RCOSC400M_CTRL2);
tmp32 &= ~AI_RCOSC400M_CTRL2_OSC_TUNE_VAL_MASK;
tmp32 |= AI_RCOSC400M_CTRL2_OSC_TUNE_VAL(tuneValue);
ANATOP_AI_Write(kAI_Itf_400m, kAI_RCOSC400M_CTRL2, tmp32);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Function for the SoftDevice initialization.
This function initializes the SoftDevice and the BLE event interrupt. */
|
static void ble_stack_init(void)
|
/* Function for the SoftDevice initialization.
This function initializes the SoftDevice and the BLE event interrupt. */
static void ble_stack_init(void)
|
{
uint32_t err_code;
nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);
ble_enable_params_t ble_enable_params;
err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT,
PERIPHERAL_LINK_COUNT,
&ble_enable_params);
APP_ERROR_CHECK(err_code);
CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT);
err_code = softdevice_enable(&ble_enable_params);
APP_ERROR_CHECK(err_code);
err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
APP_ERROR_CHECK(err_code);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Configurate The WatchDog Timer(WDT)'s Timer Interval. This function is to configure The WatchDog Timer(WDT)'s Timer Interval. There are three factors to determine the Timer Interval, they are: */
|
void xWDTInit(unsigned long ulBase, unsigned long ulConfig, unsigned long ulReload)
|
/* Configurate The WatchDog Timer(WDT)'s Timer Interval. This function is to configure The WatchDog Timer(WDT)'s Timer Interval. There are three factors to determine the Timer Interval, they are: */
void xWDTInit(unsigned long ulBase, unsigned long ulConfig, unsigned long ulReload)
|
{
SysCtlIPClockDividerSet(ulConfig);
WDTimerInit(ulReload);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Writes user data to the specified data Backup Register immediately. */
|
void exBKP_ImmWrite(BKPDR_Typedef bkp_dr, u16 dat)
|
/* Writes user data to the specified data Backup Register immediately. */
void exBKP_ImmWrite(BKPDR_Typedef bkp_dr, u16 dat)
|
{
RCC->BDCR |= RCC_BDCR_DBP;
*(vu16*)(BKP_BASE + bkp_dr) = dat;
RCC->BDCR &= ~RCC_BDCR_DBP;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Check if PTE is present, if not then jump to LABEL. PTR points to the page table where this PTE is located, PTE will be re-loaded with it's original value. */
|
static void __cpuinit build_pte_present(u32 **p, struct uasm_reloc **r, unsigned int pte, unsigned int ptr, enum label_id lid)
|
/* Check if PTE is present, if not then jump to LABEL. PTR points to the page table where this PTE is located, PTE will be re-loaded with it's original value. */
static void __cpuinit build_pte_present(u32 **p, struct uasm_reloc **r, unsigned int pte, unsigned int ptr, enum label_id lid)
|
{
uasm_i_andi(p, pte, pte, _PAGE_PRESENT | _PAGE_READ);
uasm_i_xori(p, pte, pte, _PAGE_PRESENT | _PAGE_READ);
uasm_il_bnez(p, r, pte, lid);
iPTE_LW(p, pte, ptr);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* There is special code here to handle the one source type with 5 sources. */
|
int get_periph_clock_source(enum periph_id periph_id, enum clock_id parent, int *mux_bits, int *divider_bits)
|
/* There is special code here to handle the one source type with 5 sources. */
int get_periph_clock_source(enum periph_id periph_id, enum clock_id parent, int *mux_bits, int *divider_bits)
|
{
enum clock_type_id type;
int mux, err;
err = get_periph_clock_info(periph_id, mux_bits, divider_bits, &type);
assert(!err);
for (mux = 0; mux < CLOCK_MAX_MUX; mux++)
if (clock_source[type][mux] == parent)
return mux;
printf("Caller requested bad clock: periph=%d, parent=%d\n", periph_id,
parent);
return -1;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* open an AFS file or directory and attach a key to it */
|
int afs_open(struct inode *inode, struct file *file)
|
/* open an AFS file or directory and attach a key to it */
int afs_open(struct inode *inode, struct file *file)
|
{
struct afs_vnode *vnode = AFS_FS_I(inode);
struct key *key;
int ret;
_enter("{%x:%u},", vnode->fid.vid, vnode->fid.vnode);
key = afs_request_key(vnode->volume->cell);
if (IS_ERR(key)) {
_leave(" = %ld [key]", PTR_ERR(key));
return PTR_ERR(key);
}
ret = afs_validate(vnode, key);
if (ret < 0) {
_leave(" = %d [val]", ret);
return ret;
}
file->private_data = key;
_leave(" = 0");
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* return The error flag for locked 1MHz clock out. */
|
bool CLOCK_OSC_CheckLocked1MHzErrorFlag(void)
|
/* return The error flag for locked 1MHz clock out. */
bool CLOCK_OSC_CheckLocked1MHzErrorFlag(void)
|
{
uint32_t tmp32;
tmp32 = ANATOP_AI_Read(kAI_Itf_400m, kAI_RCOSC400M_STAT0);
return ((tmp32 & AI_RCOSC400M_STAT0_CLK1M_ERR_MASK) == AI_RCOSC400M_STAT0_CLK1M_ERR_MASK);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Add a route entry to the route table. All the IP4_ADDRs are in host byte order. */
|
EFI_STATUS Ip4AddRoute(IN OUT IP4_ROUTE_TABLE *RtTable, IN IP4_ADDR Dest, IN IP4_ADDR Netmask, IN IP4_ADDR Gateway)
|
/* Add a route entry to the route table. All the IP4_ADDRs are in host byte order. */
EFI_STATUS Ip4AddRoute(IN OUT IP4_ROUTE_TABLE *RtTable, IN IP4_ADDR Dest, IN IP4_ADDR Netmask, IN IP4_ADDR Gateway)
|
{
LIST_ENTRY *Head;
LIST_ENTRY *Entry;
IP4_ROUTE_ENTRY *RtEntry;
Head = &(RtTable->RouteArea[NetGetMaskLength (Netmask)]);
NET_LIST_FOR_EACH (Entry, Head) {
RtEntry = NET_LIST_USER_STRUCT (Entry, IP4_ROUTE_ENTRY, Link);
if (IP4_NET_EQUAL (RtEntry->Dest, Dest, Netmask) && (RtEntry->NextHop == Gateway)) {
return EFI_ACCESS_DENIED;
}
}
RtEntry = Ip4CreateRouteEntry (Dest, Netmask, Gateway);
if (RtEntry == NULL) {
return EFI_OUT_OF_RESOURCES;
}
if (Gateway == IP4_ALLZERO_ADDRESS) {
RtEntry->Flag = IP4_DIRECT_ROUTE;
}
InsertHeadList (Head, &RtEntry->Link);
RtTable->TotalNum++;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* dev_set_mac_address - Change Media Access Control Address @dev: device */
|
int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa)
|
/* dev_set_mac_address - Change Media Access Control Address @dev: device */
int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa)
|
{
const struct net_device_ops *ops = dev->netdev_ops;
int err;
if (!ops->ndo_set_mac_address)
return -EOPNOTSUPP;
if (sa->sa_family != dev->type)
return -EINVAL;
if (!netif_device_present(dev))
return -ENODEV;
err = ops->ndo_set_mac_address(dev, sa);
if (!err)
call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
return err;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Determine whether a given device path is valid. */
|
BOOLEAN IsDevicePathValid(CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, UINTN MaxSize)
|
/* Determine whether a given device path is valid. */
BOOLEAN IsDevicePathValid(CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, UINTN MaxSize)
|
{
UINTN Count;
UINTN Size;
UINTN NodeLength;
if (DevicePath == NULL || (MaxSize > 0 && MaxSize < END_DEVICE_PATH_LENGTH)) {
return FALSE;
}
if (MaxSize == 0) {
MaxSize = MAX_UINT32;
}
for (Count = 0, Size = 0; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {
NodeLength = DevicePathNodeLength (DevicePath);
if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
return FALSE;
}
if (NodeLength > MAX_UINT32 - Size) {
return FALSE;
}
Size += NodeLength;
if (Size > MaxSize - END_DEVICE_PATH_LENGTH ) {
return FALSE;
}
Count++;
if (Count >= MAX_DEVICE_PATH_NODE_COUNT) {
return FALSE;
}
}
return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* format: baycom_ser_hdx=io,irq,mode mode: ser12 hardware DCD ser12* software DCD ser12@ hardware/software DCD, i.e. no explicit DCD signal but hardware mutes audio input to the modem ser12+ hardware DCD, inverted signal at DCD pin */
|
static int __init baycom_ser_hdx_setup(char *str)
|
/* format: baycom_ser_hdx=io,irq,mode mode: ser12 hardware DCD ser12* software DCD ser12@ hardware/software DCD, i.e. no explicit DCD signal but hardware mutes audio input to the modem ser12+ hardware DCD, inverted signal at DCD pin */
static int __init baycom_ser_hdx_setup(char *str)
|
{
static unsigned nr_dev;
int ints[3];
if (nr_dev >= NR_PORTS)
return 0;
str = get_options(str, 3, ints);
if (ints[0] < 2)
return 0;
mode[nr_dev] = str;
iobase[nr_dev] = ints[1];
irq[nr_dev] = ints[2];
nr_dev++;
return 1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Write number on lower alphanumeric part of Segment LCD display. */
|
void SegmentLCD_LowerNumber(int num)
|
/* Write number on lower alphanumeric part of Segment LCD display. */
void SegmentLCD_LowerNumber(int num)
|
{
int i;
char str[7];
SegmentLCD_Symbol(LCD_SYMBOL_MINUS, 0);
if ( ( num > 9999999 ) || ( num < -9999999 ) )
{
SegmentLCD_Write("Ovrflow");
return;
}
if ( num < 0 )
{
SegmentLCD_Symbol(LCD_SYMBOL_MINUS, 1);
num = -num;
}
for ( i=6; i>=0; i-- )
{
if ( ( i < 6 ) && ( num == 0 ) )
{
str[i] = ' ';
}
else
{
str[i] = (num % 10) + '0';
num /= 10;
}
}
SegmentLCD_Write(str);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* determine if desired set of events been satisfied
This routine determines if the current set of events satisfies the desired set of events. If */
|
static bool are_wait_conditions_met(uint32_t desired, uint32_t current, unsigned int wait_condition)
|
/* determine if desired set of events been satisfied
This routine determines if the current set of events satisfies the desired set of events. If */
static bool are_wait_conditions_met(uint32_t desired, uint32_t current, unsigned int wait_condition)
|
{
uint32_t match = current & desired;
if (wait_condition == K_EVENT_WAIT_ALL) {
return match == desired;
}
return match != 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Builds a pdu frame as a UA response. */
|
void llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit)
|
/* Builds a pdu frame as a UA response. */
void llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit)
|
{
struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_U;
pdu->ctrl_1 |= LLC_2_PDU_RSP_UA;
pdu->ctrl_1 |= ((f_bit & 1) << 4) & LLC_U_PF_BIT_MASK;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* brief Aborts the slave non-blocking transfers. note This API could be called at any time to stop slave for handling the bus events. param base The I2C peripheral base address. param handle Pointer to i2c_slave_handle_t structure which stores the transfer state. retval kStatus_Success retval #kStatus_I2C_Idle */
|
void I2C_SlaveTransferAbort(I2C_Type *base, i2c_slave_handle_t *handle)
|
/* brief Aborts the slave non-blocking transfers. note This API could be called at any time to stop slave for handling the bus events. param base The I2C peripheral base address. param handle Pointer to i2c_slave_handle_t structure which stores the transfer state. retval kStatus_Success retval #kStatus_I2C_Idle */
void I2C_SlaveTransferAbort(I2C_Type *base, i2c_slave_handle_t *handle)
|
{
I2C_DisableInterrupts(base, (uint32_t)kI2C_SlaveIrqFlags);
I2C_SlaveEnable(base, false);
handle->isBusy = false;
handle->transfer.txSize = 0U;
handle->transfer.rxSize = 0U;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This is a wrapper function for consistent dma-able Memory allocation routine. In linux Kernel, it depends on pci dev structure */
|
void* plat_alloc_consistent_dmaable_memory(synopGMACdevice *pcidev, u32 size, u32 *addr)
|
/* This is a wrapper function for consistent dma-able Memory allocation routine. In linux Kernel, it depends on pci dev structure */
void* plat_alloc_consistent_dmaable_memory(synopGMACdevice *pcidev, u32 size, u32 *addr)
|
{
void *buf;
buf = (void*)rt_malloc((u32)(size+16));
unsigned long i = (unsigned long)buf;
if(i%16 == 8){
i += 8;
}
else if(i%16 == 4){
i += 12;
}
else if(i%16 == 12){
i += 4;
}
flush_cache(i, size);
*addr =gmac_dmamap(i, size);
buf = (unsigned char *)CACHED_TO_UNCACHED(i);
return buf;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This is is a set of wrappers/stubs that allow to use certain routines from U-Boot's lib_generic in the standalone app. This way way we can re-use existing code e.g. operations on strings and similar. printf() and vprintf() are stolen from u-boot/common/console.c */
|
void printf(const char *fmt,...)
|
/* This is is a set of wrappers/stubs that allow to use certain routines from U-Boot's lib_generic in the standalone app. This way way we can re-use existing code e.g. operations on strings and similar. printf() and vprintf() are stolen from u-boot/common/console.c */
void printf(const char *fmt,...)
|
{
va_list args;
uint i;
char printbuffer[256];
va_start (args, fmt);
i = vsprintf (printbuffer, fmt, args);
va_end (args);
ub_puts (printbuffer);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Returns: (element-type GDrive) (transfer full): a #GList of connected #GDrive objects. */
|
GList* g_volume_monitor_get_connected_drives(GVolumeMonitor *volume_monitor)
|
/* Returns: (element-type GDrive) (transfer full): a #GList of connected #GDrive objects. */
GList* g_volume_monitor_get_connected_drives(GVolumeMonitor *volume_monitor)
|
{
GVolumeMonitorClass *class;
g_return_val_if_fail (G_IS_VOLUME_MONITOR (volume_monitor), NULL);
class = G_VOLUME_MONITOR_GET_CLASS (volume_monitor);
return class->get_connected_drives (volume_monitor);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
{
if(huart->Instance==USART1)
{
__HAL_RCC_USART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_4|GPIO_PIN_5);
}
if(huart->Instance==USART2)
{
__HAL_RCC_USART2_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
}
if(huart->Instance==USART3)
{
__HAL_RCC_USART3_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10|GPIO_PIN_11);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Enable the specified interrupt to trigger on UCB_RISING, UCB_FALLING or both edges. The interrupt should have been hooked by ucb1x00_hook_irq. */
|
void ucb1x00_enable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges)
|
/* Enable the specified interrupt to trigger on UCB_RISING, UCB_FALLING or both edges. The interrupt should have been hooked by ucb1x00_hook_irq. */
void ucb1x00_enable_irq(struct ucb1x00 *ucb, unsigned int idx, int edges)
|
{
unsigned long flags;
if (idx < 16) {
spin_lock_irqsave(&ucb->lock, flags);
ucb1x00_enable(ucb);
if (edges & UCB_RISING) {
ucb->irq_ris_enbl |= 1 << idx;
ucb1x00_reg_write(ucb, UCB_IE_RIS, ucb->irq_ris_enbl);
}
if (edges & UCB_FALLING) {
ucb->irq_fal_enbl |= 1 << idx;
ucb1x00_reg_write(ucb, UCB_IE_FAL, ucb->irq_fal_enbl);
}
ucb1x00_disable(ucb);
spin_unlock_irqrestore(&ucb->lock, flags);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set the DMA source address of the specified DMA Channel. */
|
void dmac_channel_set_source_addr(Dmac *p_dmac, uint32_t ul_num, uint32_t ul_addr)
|
/* Set the DMA source address of the specified DMA Channel. */
void dmac_channel_set_source_addr(Dmac *p_dmac, uint32_t ul_num, uint32_t ul_addr)
|
{
Assert(p_dmac);
Assert(ul_num<=3);
p_dmac->DMAC_CH_NUM[ul_num].DMAC_SADDR = ul_addr;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* ADC Software Triggered Conversion on Injected Channels.
This starts conversion on a set of defined injected channels. It is cleared by hardware once conversion starts. */
|
void adc_start_conversion_injected(uint32_t adc)
|
/* ADC Software Triggered Conversion on Injected Channels.
This starts conversion on a set of defined injected channels. It is cleared by hardware once conversion starts. */
void adc_start_conversion_injected(uint32_t adc)
|
{
ADC_CR(adc) |= ADC_CR_JADSTART;
while (ADC_CR(adc) & ADC_CR_JADSTART);
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Copy attributes of the original request to the clone request. The actual data parts (e.g. ->cmd, ->buffer, ->sense) are not copied. */
|
static void __blk_rq_prep_clone(struct request *dst, struct request *src)
|
/* Copy attributes of the original request to the clone request. The actual data parts (e.g. ->cmd, ->buffer, ->sense) are not copied. */
static void __blk_rq_prep_clone(struct request *dst, struct request *src)
|
{
dst->cpu = src->cpu;
dst->cmd_flags = (rq_data_dir(src) | REQ_NOMERGE);
dst->cmd_type = src->cmd_type;
dst->__sector = blk_rq_pos(src);
dst->__data_len = blk_rq_bytes(src);
dst->nr_phys_segments = src->nr_phys_segments;
dst->ioprio = src->ioprio;
dst->extra_len = src->extra_len;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Get information about an image. Try the created image decoder one by one. Once one is able to get info that info will be used. */
|
lv_res_t lv_img_decoder_get_info(const void *src, lv_img_header_t *header)
|
/* Get information about an image. Try the created image decoder one by one. Once one is able to get info that info will be used. */
lv_res_t lv_img_decoder_get_info(const void *src, lv_img_header_t *header)
|
{
lv_memset_00(header, sizeof(lv_img_header_t));
if(src == NULL) return LV_RES_INV;
lv_img_src_t src_type = lv_img_src_get_type(src);
if(src_type == LV_IMG_SRC_VARIABLE) {
const lv_img_dsc_t * img_dsc = src;
if(img_dsc->data == NULL) return LV_RES_INV;
}
lv_res_t res = LV_RES_INV;
lv_img_decoder_t * d;
_LV_LL_READ(&LV_GC_ROOT(_lv_img_decoder_ll), d) {
if(d->info_cb) {
res = d->info_cb(d, src, header);
if(res == LV_RES_OK) break;
}
}
return res;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* @handle: handle of the loaded image @systable: system table */
|
static int setup(const efi_handle_t handle, const struct efi_system_table *systable)
|
/* @handle: handle of the loaded image @systable: system table */
static int setup(const efi_handle_t handle, const struct efi_system_table *systable)
|
{
runtime = systable->runtime;
return EFI_ST_SUCCESS;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Reads a page of a directory's index table. Having metadata mapped into the directory inode's address space presents a multitude of problems. We avoid this by mapping to the absolute address space outside of the *_metapage routines */
|
static struct metapage* read_index_page(struct inode *inode, s64 blkno)
|
/* Reads a page of a directory's index table. Having metadata mapped into the directory inode's address space presents a multitude of problems. We avoid this by mapping to the absolute address space outside of the *_metapage routines */
static struct metapage* read_index_page(struct inode *inode, s64 blkno)
|
{
int rc;
s64 xaddr;
int xflag;
s32 xlen;
rc = xtLookup(inode, blkno, 1, &xflag, &xaddr, &xlen, 1);
if (rc || (xaddr == 0))
return NULL;
return read_metapage(inode, xaddr, PSIZE, 1);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The driver's entry point. Will register a function for callback during SmmReadyToLock event to configure the TPM's platform authorization. */
|
EFI_STATUS EFIAPI Tcg2PlatformDxeEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
/* The driver's entry point. Will register a function for callback during SmmReadyToLock event to configure the TPM's platform authorization. */
EFI_STATUS EFIAPI Tcg2PlatformDxeEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
{
VOID *Registration;
EFI_EVENT Event;
Event = EfiCreateProtocolNotifyEvent (
&gEfiDxeSmmReadyToLockProtocolGuid,
TPL_CALLBACK,
SmmReadyToLockEventCallBack,
NULL,
&Registration
);
ASSERT (Event != NULL);
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Get reference to app inc (only called from softirq) */
|
int ip_vs_app_inc_get(struct ip_vs_app *inc)
|
/* Get reference to app inc (only called from softirq) */
int ip_vs_app_inc_get(struct ip_vs_app *inc)
|
{
int result;
atomic_inc(&inc->usecnt);
if (unlikely((result = ip_vs_app_get(inc->app)) != 1))
atomic_dec(&inc->usecnt);
return result;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The CPU S3 data is copied to SMRAM for security and mSmmReadyToLock is set to perform additional lock actions that must be performed from SMM on the next SMI. */
|
EFI_STATUS EFIAPI SmmReadyToLockEventNotify(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
|
/* The CPU S3 data is copied to SMRAM for security and mSmmReadyToLock is set to perform additional lock actions that must be performed from SMM on the next SMI. */
EFI_STATUS EFIAPI SmmReadyToLockEventNotify(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
|
{
GetAcpiCpuData ();
GetUefiMemoryMap ();
mSmmReadyToLock = TRUE;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Clock the UART module from the internal oscillator. */
|
void uart_clock_from_piosc(uint32_t uart)
|
/* Clock the UART module from the internal oscillator. */
void uart_clock_from_piosc(uint32_t uart)
|
{
UART_CC(uart) = UART_CC_CS_PIOSC;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* This function will startup the scheduler. It will select one thread with the highest priority level, then switch to it. */
|
void rt_system_scheduler_start(void)
|
/* This function will startup the scheduler. It will select one thread with the highest priority level, then switch to it. */
void rt_system_scheduler_start(void)
|
{
struct rt_thread *to_thread;
rt_ubase_t highest_ready_priority;
to_thread = _scheduler_get_highest_priority_thread(&highest_ready_priority);
rt_current_thread = to_thread;
rt_schedule_remove_thread(to_thread);
to_thread->stat = RT_THREAD_RUNNING;
rt_hw_context_switch_to((rt_ubase_t)&to_thread->sp);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Draw graph on the OLED screen using the provided point array. */
|
static void ssd1306_draw_graph(uint8_t col, uint8_t page, uint8_t width, uint8_t height, uint8_t *tab)
|
/* Draw graph on the OLED screen using the provided point array. */
static void ssd1306_draw_graph(uint8_t col, uint8_t page, uint8_t width, uint8_t height, uint8_t *tab)
|
{
uint8_t page_start;
uint8_t i, j, k, s;
uint8_t scale;
for (i = col; i < width; ++i) {
for (page_start = page; page_start <= height; ++page_start) {
ssd1306_write_command(SSD1306_CMD_SET_PAGE_START_ADDRESS(page_start));
ssd1306_set_column_address(i);
j = tab[i];
scale = 8 * (height - page_start + 1);
if (j > scale)
j = 8;
else
j -= (scale - 8);
for (k = 0, s = j; j > 0; --j)
k = (k << 1) + 1;
for (s = 8 - s; s > 0; --s)
k <<= 1;
ssd1306_write_data(k);
}
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* This function will suspend a thread to a specified list. IPC object or some double-queue object (mailbox etc.) contains this kind of list. */
|
rt_inline rt_err_t rt_ipc_list_suspend(rt_list_t *list, struct rt_thread *thread, rt_uint8_t flag)
|
/* This function will suspend a thread to a specified list. IPC object or some double-queue object (mailbox etc.) contains this kind of list. */
rt_inline rt_err_t rt_ipc_list_suspend(rt_list_t *list, struct rt_thread *thread, rt_uint8_t flag)
|
{
rt_thread_suspend(thread);
switch (flag)
{
case RT_IPC_FLAG_FIFO:
rt_list_insert_before(list, &(thread->tlist));
break;
case RT_IPC_FLAG_PRIO:
{
struct rt_list_node *n;
struct rt_thread *sthread;
for (n = list->next; n != list; n = n->next)
{
sthread = rt_list_entry(n, struct rt_thread, tlist);
if (thread->current_priority < sthread->current_priority)
{
rt_list_insert_before(&(sthread->tlist), &(thread->tlist));
break;
}
}
if (n == list)
rt_list_insert_before(list, &(thread->tlist));
}
break;
}
return RT_EOK;
}
|
armink/FreeModbus_Slave-Master-RTT-STM32
|
C++
|
Other
| 1,477
|
/* Check the busy status of the specified SPI port. */
|
xtBoolean SPIIsBusy(unsigned long ulBase)
|
/* Check the busy status of the specified SPI port. */
xtBoolean SPIIsBusy(unsigned long ulBase)
|
{
xASSERT(ulBase == SPI0_BASE);
return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY) ? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct. */
|
void USART_ClockInit(USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct)
|
/* Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct. */
void USART_ClockInit(USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct)
|
{
uint32_t tmpreg = 0;
assert_param(IS_USART_123_PERIPH(USARTx));
assert_param(IS_USART_CLOCK(USART_ClockInitStruct->USART_Clock));
assert_param(IS_USART_CPOL(USART_ClockInitStruct->USART_CPOL));
assert_param(IS_USART_CPHA(USART_ClockInitStruct->USART_CPHA));
assert_param(IS_USART_LASTBIT(USART_ClockInitStruct->USART_LastBit));
tmpreg = USARTx->CR2;
tmpreg &= (uint32_t)~((uint32_t)CR2_CLOCK_CLEAR_MASK);
tmpreg |= (uint32_t)(USART_ClockInitStruct->USART_Clock | USART_ClockInitStruct->USART_CPOL |
USART_ClockInitStruct->USART_CPHA | USART_ClockInitStruct->USART_LastBit);
USARTx->CR2 = tmpreg;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned. */
|
UINTN EFIAPI LibPcdSetSku(IN UINTN SkuId)
|
/* Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned. */
UINTN EFIAPI LibPcdSetSku(IN UINTN SkuId)
|
{
GetPiPcdPpiPointer ()->SetSku (SkuId);
return SkuId;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Use the UART driver APIs to write a strng to the terminal. */
|
int32_t cli_write_string(struct cli_desc *dev, uint8_t *str)
|
/* Use the UART driver APIs to write a strng to the terminal. */
int32_t cli_write_string(struct cli_desc *dev, uint8_t *str)
|
{
uint32_t ms_size = strlen((char *)str);
if (!ms_size)
return SUCCESS;
return uart_write(dev->uart_device, str, ms_size);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Configure pins as Analog Input Output EVENT_OUT EXTI */
|
__attribute__((isr))
|
/* Configure pins as Analog Input Output EVENT_OUT EXTI */
__attribute__((isr))
|
{
readl(0xE000E010);
HAL_IncTick();
xPortSysTickHandler();
portYIELD_FROM_ISR(1);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Command response callback function for sd_ble_gap_auth_key_reply BLE command.
Callback for decoding the output parameters and the command response return code. */
|
static uint32_t gap_auth_key_reply_rsp_dec(const uint8_t *p_buffer, uint16_t length)
|
/* Command response callback function for sd_ble_gap_auth_key_reply BLE command.
Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_auth_key_reply_rsp_dec(const uint8_t *p_buffer, uint16_t length)
|
{
uint32_t result_code = 0;
const uint32_t err_code = ble_gap_auth_key_reply_rsp_dec(p_buffer,
length,
&result_code);
APP_ERROR_CHECK(err_code);
return result_code;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* This API reads the data from the auxiliary sensor. */
|
uint16_t bma4_aux_read(uint8_t aux_reg_addr, uint8_t *aux_data, uint16_t len, struct bma4_dev *dev)
|
/* This API reads the data from the auxiliary sensor. */
uint16_t bma4_aux_read(uint8_t aux_reg_addr, uint8_t *aux_data, uint16_t len, struct bma4_dev *dev)
|
{
uint16_t rslt = BMA4_OK;
rslt |= bma4_null_pointer_check(dev);
if (rslt == BMA4_OK) {
rslt = bma4_extract_aux_data(aux_reg_addr, aux_data, len, dev);
}
return rslt;
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* This is the rmdir() entry in the inode_operations structure for regular HFS directories. The purpose is to delete an existing directory, given the inode for the parent directory and the name (and its length) of the existing directory. */
|
static int hfs_rmdir(struct inode *dir, struct dentry *dentry)
|
/* This is the rmdir() entry in the inode_operations structure for regular HFS directories. The purpose is to delete an existing directory, given the inode for the parent directory and the name (and its length) of the existing directory. */
static int hfs_rmdir(struct inode *dir, struct dentry *dentry)
|
{
struct inode *inode;
int res;
inode = dentry->d_inode;
if (inode->i_size != 2)
return -ENOTEMPTY;
res = hfs_cat_delete(inode->i_ino, dir, &dentry->d_name);
if (res)
return res;
clear_nlink(inode);
inode->i_ctime = CURRENT_TIME_SEC;
hfs_delete_inode(inode);
mark_inode_dirty(inode);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Calculated and stalled the interval time by BSP to check whether the APs have finished. */
|
UINTN CalculateAndStallInterval(IN UINTN Timeout)
|
/* Calculated and stalled the interval time by BSP to check whether the APs have finished. */
UINTN CalculateAndStallInterval(IN UINTN Timeout)
|
{
UINTN StallTime;
if ((Timeout < gPollInterval) && (Timeout != 0)) {
StallTime = Timeout;
} else {
StallTime = gPollInterval;
}
gBS->Stall (StallTime);
return StallTime;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Notes: The function can return -EAGAIN in which case caller must call it again later, or recover. '0' return code means successful xmit. */
|
static int iscsi_iser_mtask_xmit(struct iscsi_conn *conn, struct iscsi_task *task)
|
/* Notes: The function can return -EAGAIN in which case caller must call it again later, or recover. '0' return code means successful xmit. */
static int iscsi_iser_mtask_xmit(struct iscsi_conn *conn, struct iscsi_task *task)
|
{
int error = 0;
iser_dbg("task deq [cid %d itt 0x%x]\n", conn->id, task->itt);
error = iser_send_control(conn, task);
if (error && error != -ENOBUFS)
iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
return error;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* MSS_SPI_clear_slave_select() See "mss_spi.h" for details of how to use this function. */
|
void MSS_SPI_clear_slave_select(mss_spi_instance_t *this_spi, mss_spi_slave_t slave)
|
/* MSS_SPI_clear_slave_select() See "mss_spi.h" for details of how to use this function. */
void MSS_SPI_clear_slave_select(mss_spi_instance_t *this_spi, mss_spi_slave_t slave)
|
{
ASSERT( (this_spi == &g_mss_spi0) || (this_spi == &g_mss_spi1) );
ASSERT( this_spi->hw_reg_bit->CTRL_MASTER == MSS_SPI_MODE_MASTER );
this_spi->hw_reg->SLAVE_SELECT &= ~((uint32_t)1 << (uint32_t)slave);
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Write the contents of the current directory to the specified file. This routine doesn't handle overwriting a directory with auxiliary storage that's been changed. */
|
int TIFFWriteDirectory(TIFF *tif)
|
/* Write the contents of the current directory to the specified file. This routine doesn't handle overwriting a directory with auxiliary storage that's been changed. */
int TIFFWriteDirectory(TIFF *tif)
|
{
return TIFFWriteDirectorySec(tif,TRUE,TRUE,NULL);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* ->detroy_inode() callback. Deletes inode from the caches and frees private data. */
|
static void pohmelfs_destroy_inode(struct inode *inode)
|
/* ->detroy_inode() callback. Deletes inode from the caches and frees private data. */
static void pohmelfs_destroy_inode(struct inode *inode)
|
{
struct super_block *sb = inode->i_sb;
struct pohmelfs_sb *psb = POHMELFS_SB(sb);
struct pohmelfs_inode *pi = POHMELFS_I(inode);
pohmelfs_inode_del_inode(psb, pi);
dprintk("%s: pi: %p, inode: %p, ino: %llu.\n",
__func__, pi, &pi->vfs_inode, pi->ino);
kmem_cache_free(pohmelfs_inode_cache, pi);
atomic_long_dec(&psb->total_inodes);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Function for tracing page 2 and common data. */
|
static void page2_data_log(ant_hrm_page2_data_t const *p_page_data)
|
/* Function for tracing page 2 and common data. */
static void page2_data_log(ant_hrm_page2_data_t const *p_page_data)
|
{
LOG_PAGE2("Manufacturer ID: %u\n\r", (unsigned int)p_page_data->manuf_id);
LOG_PAGE2("Serial No (upper 16-bits): 0x%X\n\r", (unsigned int)p_page_data->serial_num);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* hibernate_nvs_alloc - allocate memory necessary for saving NVS regions */
|
int hibernate_nvs_alloc(void)
|
/* hibernate_nvs_alloc - allocate memory necessary for saving NVS regions */
int hibernate_nvs_alloc(void)
|
{
struct nvs_page *entry;
list_for_each_entry(entry, &nvs_list, node) {
entry->data = (void *)__get_free_page(GFP_KERNEL);
if (!entry->data) {
hibernate_nvs_free();
return -ENOMEM;
}
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function handles DMA Channel 2 and 3 interrupts. */
|
void DMA1_Channel2_3_IRQHandler(void)
|
/* This function handles DMA Channel 2 and 3 interrupts. */
void DMA1_Channel2_3_IRQHandler(void)
|
{
USBPD_DMA_PORT1_IRQHandler();
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* Set the specified data holding register value for DAC channel2. */
|
void DAC_SetChannel2Data(emDACALIGN_TypeDef alignement, u16 data)
|
/* Set the specified data holding register value for DAC channel2. */
void DAC_SetChannel2Data(emDACALIGN_TypeDef alignement, u16 data)
|
{
*((u32*)(DAC_BASE + DHR12R2_Offset + alignement)) = data;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function processes the results of changes in configuration. */
|
EFI_STATUS EFIAPI DeviceManagerRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
|
/* This function processes the results of changes in configuration. */
EFI_STATUS EFIAPI DeviceManagerRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
|
{
if ((Configuration == NULL) || (Progress == NULL)) {
return EFI_INVALID_PARAMETER;
}
*Progress = Configuration;
return EFI_NOT_FOUND;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Change Logs: Date Author Notes Quintin.Z the first version */
|
void led_thread_entry(void *parameter)
|
/* Change Logs: Date Author Notes Quintin.Z the first version */
void led_thread_entry(void *parameter)
|
{
GPIO_Init (GPIOA, GPIO_PTB5_MASK, GPIO_PinOutput);
while(1)
{
GPIO_Toggle (GPIOA, GPIO_PTB5_MASK);
rt_thread_delay(RT_TICK_PER_SECOND / 10);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Set or clear the multicast filter for this adaptor to use the best-effort filtering supported. The 3c501 supports only three modes of filtering. It always receives broadcasts and packets for itself. You can choose to optionally receive all packets, or all multicast packets on top of this. */
|
static void set_multicast_list(struct net_device *dev)
|
/* Set or clear the multicast filter for this adaptor to use the best-effort filtering supported. The 3c501 supports only three modes of filtering. It always receives broadcasts and packets for itself. You can choose to optionally receive all packets, or all multicast packets on top of this. */
static void set_multicast_list(struct net_device *dev)
|
{
int ioaddr = dev->base_addr;
if (dev->flags & IFF_PROMISC) {
outb(RX_PROM, RX_CMD);
inb(RX_STATUS);
} else if (dev->mc_list || dev->flags & IFF_ALLMULTI) {
outb(RX_MULT, RX_CMD);
inb(RX_STATUS);
} else {
outb(RX_NORM, RX_CMD);
inb(RX_STATUS);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read user data from the specified Data Backup Register. */
|
uint16_t BAKPR_ReadBackupRegister(BAKPR_DATA_T bakrData)
|
/* Read user data from the specified Data Backup Register. */
uint16_t BAKPR_ReadBackupRegister(BAKPR_DATA_T bakrData)
|
{
__IOM uint32_t tmp = 0;
tmp = (uint32_t)BAKPR_BASE;
tmp += bakrData;
return (*(__IOM uint32_t*) tmp);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base asrc base pointer. param handle asrc eDMA handle pointer. */
|
void ASRC_TransferTerminateConvert(ASRC_Type *base, asrc_handle_t *handle)
|
/* param base asrc base pointer. param handle asrc eDMA handle pointer. */
void ASRC_TransferTerminateConvert(ASRC_Type *base, asrc_handle_t *handle)
|
{
assert(handle != NULL);
ASRC_TransferAbortConvert(base, handle);
(void)memset(handle->in.asrcQueue, 0, sizeof(handle->in.asrcQueue));
(void)memset(handle->in.transferSamples, 0, sizeof(handle->in.transferSamples));
(void)memset(handle->out.asrcQueue, 0, sizeof(handle->out.asrcQueue));
(void)memset(handle->out.transferSamples, 0, sizeof(handle->out.transferSamples));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The pthread_cancel(), pthread_setcancelstate(), and pthread_setcanceltype() functions are defined to be async-cancel safe. */
|
int pthread_setcancelstate(int state, int *oldstate)
|
/* The pthread_cancel(), pthread_setcancelstate(), and pthread_setcanceltype() functions are defined to be async-cancel safe. */
int pthread_setcancelstate(int state, int *oldstate)
|
{
_pthread_data_t *ptd;
if (rt_thread_self() == NULL) return EINVAL;
ptd = (_pthread_data_t *)rt_thread_self()->user_data;
RT_ASSERT(ptd != RT_NULL);
if ((state == PTHREAD_CANCEL_ENABLE) || (state == PTHREAD_CANCEL_DISABLE))
{
if (oldstate)
*oldstate = ptd->cancelstate;
ptd->cancelstate = state;
return 0;
}
return EINVAL;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* CAN Initialize a 32bit Message ID Mask Filter. */
|
void can_filter_id_mask_32bit_init(uint32_t canport, uint32_t nr, uint32_t id, uint32_t mask, uint32_t fifo, bool enable)
|
/* CAN Initialize a 32bit Message ID Mask Filter. */
void can_filter_id_mask_32bit_init(uint32_t canport, uint32_t nr, uint32_t id, uint32_t mask, uint32_t fifo, bool enable)
|
{
can_filter_init(canport, nr, true, false, id, mask, fifo, enable);
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Returns 1 if no transfer is currently pending on the given channel; otherwise, returns 0. */
|
unsigned char AC97C_IsFinished(unsigned char channel)
|
/* Returns 1 if no transfer is currently pending on the given channel; otherwise, returns 0. */
unsigned char AC97C_IsFinished(unsigned char channel)
|
{
SANITY_CHECK(channel <= AC97C_CHANNEL_B_TRANSMIT);
if (ac97c.transfers[channel].numSamples > 0) {
return 0;
}
else {
return 1;
}
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* fc_fcp_unlock_pkt() - Release a fcp_pkt's lock and decrement its reference count @fsp: The FCP packet to be unlocked and decremented */
|
static void fc_fcp_unlock_pkt(struct fc_fcp_pkt *fsp)
|
/* fc_fcp_unlock_pkt() - Release a fcp_pkt's lock and decrement its reference count @fsp: The FCP packet to be unlocked and decremented */
static void fc_fcp_unlock_pkt(struct fc_fcp_pkt *fsp)
|
{
spin_unlock_bh(&fsp->scsi_pkt_lock);
fc_fcp_pkt_release(fsp);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* During taskmangement request, we need to freeze the device queue. */
|
void mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle)
|
/* During taskmangement request, we need to freeze the device queue. */
void mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle)
|
{
struct MPT2SAS_DEVICE *sas_device_priv_data;
struct scsi_device *sdev;
u8 skip = 0;
shost_for_each_device(sdev, ioc->shost) {
if (skip)
continue;
sas_device_priv_data = sdev->hostdata;
if (!sas_device_priv_data)
continue;
if (sas_device_priv_data->sas_target->handle == handle) {
sas_device_priv_data->sas_target->tm_busy = 1;
skip = 1;
ioc->ignore_loginfos = 1;
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.