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 is the implementation of SPI0 handler named in startup code.
It passes the instance to the shared DSPI IRQ handler. */
|
void SPI0_IRQHandler(void)
|
/* This function is the implementation of SPI0 handler named in startup code.
It passes the instance to the shared DSPI IRQ handler. */
void SPI0_IRQHandler(void)
|
{
DSPI_DRV_IRQHandler(SPI0_IDX);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* This function is called with no lock held. When QUE_BUFTAG_BIT bit is set in the tag the buffer is posted for a particular exchange, the function will return the buffer without replacing the buffer. If the buffer is for unsolicited ELS or CT traffic, this function returns the buffer and also posts another buffer to the firmware. */
|
static struct lpfc_dmabuf* lpfc_sli_get_buff(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, uint32_t tag)
|
/* This function is called with no lock held. When QUE_BUFTAG_BIT bit is set in the tag the buffer is posted for a particular exchange, the function will return the buffer without replacing the buffer. If the buffer is for unsolicited ELS or CT traffic, this function returns the buffer and also posts another buffer to the firmware. */
static struct lpfc_dmabuf* lpfc_sli_get_buff(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, uint32_t tag)
|
{
struct hbq_dmabuf *hbq_entry;
if (tag & QUE_BUFTAG_BIT)
return lpfc_sli_ring_taggedbuf_get(phba, pring, tag);
hbq_entry = lpfc_sli_hbqbuf_find(phba, tag);
if (!hbq_entry)
return NULL;
return &hbq_entry->dbuf;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function handles RTC WAKE UP TIMER interrupt request. */
|
void RTC_TAMP_IRQHandler(void)
|
/* This function handles RTC WAKE UP TIMER interrupt request. */
void RTC_TAMP_IRQHandler(void)
|
{
HAL_RTCEx_WakeUpTimerIRQHandler(&hRTC_Handle);
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* SPI Set the NSS Pin as an Input.
In master mode this allows the master to sense the presence of other masters. If NSS is then pulled low the master is placed into slave mode. In slave mode NSS becomes a slave enable. */
|
void spi_disable_ss_output(uint32_t spi)
|
/* SPI Set the NSS Pin as an Input.
In master mode this allows the master to sense the presence of other masters. If NSS is then pulled low the master is placed into slave mode. In slave mode NSS becomes a slave enable. */
void spi_disable_ss_output(uint32_t spi)
|
{
SPI_CR2(spi) &= ~SPI_CR2_SSOE;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* The clock_cpu_microsecond() fucntion shall return the millisecond according to cpu_tick parameter. */
|
uint32_t clock_cpu_millisecond(uint32_t cpu_tick)
|
/* The clock_cpu_microsecond() fucntion shall return the millisecond according to cpu_tick parameter. */
uint32_t clock_cpu_millisecond(uint32_t cpu_tick)
|
{
float unit = clock_cpu_getres();
return (uint32_t)((cpu_tick * unit) / (1000 * 1000));
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* ?'s can have different meanings on different models, such as wheel rotation, extra buttons, stick buttons on a dualpoint, etc. */
|
static bool alps_is_valid_first_byte(const struct alps_model_info *model, unsigned char data)
|
/* ?'s can have different meanings on different models, such as wheel rotation, extra buttons, stick buttons on a dualpoint, etc. */
static bool alps_is_valid_first_byte(const struct alps_model_info *model, unsigned char data)
|
{
return (data & model->mask0) == model->byte0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Deinitializes the USARTx peripheral registers to their default reset values. */
|
void USART_DeInit(USART_TypeDef *USARTx)
|
/* Deinitializes the USARTx peripheral registers to their default reset values. */
void USART_DeInit(USART_TypeDef *USARTx)
|
{
assert_param(IS_USART_ALL_PERIPH(USARTx));
if (USARTx == USART1)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_USART1, DISABLE);
}
else
{
if (USARTx == USART2)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_USART2, DISABLE);
}
}
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* This function gets the header of next descriptor. */
|
USB_HOST_DescHeader_TypeDef* usb_host_getnextdesc(uint8_t *pbuf, uint16_t *ptr)
|
/* This function gets the header of next descriptor. */
USB_HOST_DescHeader_TypeDef* usb_host_getnextdesc(uint8_t *pbuf, uint16_t *ptr)
|
{
USB_HOST_DescHeader_TypeDef *pnext;
*ptr += ((USB_HOST_DescHeader_TypeDef *)pbuf)->bLength;
pnext = (USB_HOST_DescHeader_TypeDef *)((uint8_t *)pbuf + ((USB_HOST_DescHeader_TypeDef *)pbuf)->bLength);
return (pnext);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function is used to start pmu rtc timer. */
|
void tls_rtc_timer_start(struct tm *tblock)
|
/* This function is used to start pmu rtc timer. */
void tls_rtc_timer_start(struct tm *tblock)
|
{
int ctrl1 = 0;
int ctrl2 = 0;
tls_irq_enable(PMU_IRQn);
ctrl1 |= tblock->tm_sec;
ctrl1 |= tblock->tm_min << 8;
ctrl1 |= tblock->tm_hour << 16;
ctrl1 |= tblock->tm_mday << 24;
ctrl2 |= tblock->tm_mon;
ctrl2 |= tblock->tm_year << 8;
tls_reg_write32(HR_PMU_RTC_CTRL2, ctrl2 | BIT(16));
tls_reg_write32(HR_PMU_RTC_CTRL1, ctrl1 | BIT(31));
return;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* param handle codec handle. return kStatus_Success is success, else de-initial failed. */
|
status_t HAL_CODEC_Deinit(void *handle)
|
/* param handle codec handle. return kStatus_Success is success, else de-initial failed. */
status_t HAL_CODEC_Deinit(void *handle)
|
{
assert(handle != NULL);
return SGTL_Deinit((sgtl_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)));
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Determine whether the current process is permitted to use a particular syslog function, returning 0 if permission is granted, -ve if not. */
|
int cap_syslog(int type)
|
/* Determine whether the current process is permitted to use a particular syslog function, returning 0 if permission is granted, -ve if not. */
int cap_syslog(int type)
|
{
if ((type != 3 && type != 10) && !capable(CAP_SYS_ADMIN))
return -EPERM;
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* PWWN based Lookup for a R-Port in the Port R-Port Queue */
|
struct bfa_fcs_rport_s* bfa_fcs_port_get_rport_by_pwwn(struct bfa_fcs_port_s *port, wwn_t pwwn)
|
/* PWWN based Lookup for a R-Port in the Port R-Port Queue */
struct bfa_fcs_rport_s* bfa_fcs_port_get_rport_by_pwwn(struct bfa_fcs_port_s *port, wwn_t pwwn)
|
{
struct bfa_fcs_rport_s *rport;
struct list_head *qe;
list_for_each(qe, &port->rport_q) {
rport = (struct bfa_fcs_rport_s *)qe;
if (wwn_is_equal(rport->pwwn, pwwn))
return rport;
}
bfa_trc(port->fcs, pwwn);
return NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base SPDIF base pointer. param buffer Pointer to the data to be read. param size Bytes to be read. */
|
void SPDIF_ReadBlocking(SPDIF_Type *base, uint8_t *buffer, uint32_t size)
|
/* param base SPDIF base pointer. param buffer Pointer to the data to be read. param size Bytes to be read. */
void SPDIF_ReadBlocking(SPDIF_Type *base, uint8_t *buffer, uint32_t size)
|
{
assert(buffer);
assert(size % 6U == 0U);
uint32_t i = 0, j = 0, data = 0;
while (i < size)
{
while ((SPDIF_GetStatusFlag(base) & kSPDIF_RxFIFOFull) == 0U)
{
}
data = SPDIF_ReadLeftData(base);
for (j = 0; j < 3U; j++)
{
*buffer = ((data >> (j * 8U)) & 0xFFU);
buffer++;
}
data = SPDIF_ReadRightData(base);
for (j = 0; j < 3U; j++)
{
*buffer = ((data >> (j * 8U)) & 0xFFU);
buffer++;
}
i += 6U;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Puts a data element into the SSI transmit FIFO. */
|
void SSIDataPut(unsigned long ulBase, unsigned long ulData)
|
/* Puts a data element into the SSI transmit FIFO. */
void SSIDataPut(unsigned long ulBase, unsigned long ulData)
|
{
ASSERT((ulBase == SSI0_BASE) || (ulBase == SSI1_BASE));
ASSERT((ulData & (0xfffffffe << (HWREG(ulBase + SSI_O_CR0) &
SSI_CR0_DSS_M))) == 0);
while(!(HWREG(ulBase + SSI_O_SR) & SSI_SR_TNF))
{
}
HWREG(ulBase + SSI_O_DR) = ulData;
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* 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)
|
{
uint32_t tmpccmr2 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction));
tmpccmr2 = TIMx->CCMR2;
tmpccmr2 &= (uint32_t)~TIM_CCMR2_OC4M;
tmpccmr2 |= (uint32_t)(TIM_ForcedAction << 8);
TIMx->CCMR2 = tmpccmr2;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* This function checks if the command is allowed. */
|
static int lbs_is_cmd_allowed(struct lbs_private *priv)
|
/* This function checks if the command is allowed. */
static int lbs_is_cmd_allowed(struct lbs_private *priv)
|
{
int ret = 1;
lbs_deb_enter(LBS_DEB_CMD);
if (!priv->is_auto_deep_sleep_enabled) {
if (priv->is_deep_sleep) {
lbs_deb_cmd("command not allowed in deep sleep\n");
ret = 0;
}
}
lbs_deb_leave(LBS_DEB_CMD);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read the supported_output port width of the TPIU.
This function uses the */
|
uint32_t am_hal_tpiu_supported_port_width_get(void)
|
/* Read the supported_output port width of the TPIU.
This function uses the */
uint32_t am_hal_tpiu_supported_port_width_get(void)
|
{
uint32_t i, ui32WidthValue;
ui32WidthValue = AM_REG(TPIU, SSPSR);
for (i = 1; i < 32; i++)
{
if (ui32WidthValue == (0x1 << (i - 1)))
{
return i;
}
}
return 1;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Command response callback function for sd_ble_gap_appearance_get BLE command.
Callback for decoding the output parameters and the command response return code. */
|
static uint32_t gap_appearance_get_rsp_dec(const uint8_t *p_buffer, uint16_t length)
|
/* Command response callback function for sd_ble_gap_appearance_get BLE command.
Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_appearance_get_rsp_dec(const uint8_t *p_buffer, uint16_t length)
|
{
uint32_t result_code;
const uint32_t err_code =
ble_gap_appearance_get_rsp_dec(p_buffer,
length,
m_output_params.gap_appearance_get_out_params.p_appearance,
&result_code);
APP_ERROR_CHECK(err_code);
return result_code;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Get Interface USB Request Parameters: None (global SetupPacket) Return Value: TRUE - Success, FALSE - Error */
|
static uint32_t USB_ReqGetInterface(void)
|
/* Get Interface USB Request Parameters: None (global SetupPacket) Return Value: TRUE - Success, FALSE - Error */
static uint32_t USB_ReqGetInterface(void)
|
{
case REQUEST_TO_INTERFACE:
if ((USB_Configuration != 0) && (SetupPacket.wIndex.WB.L < USB_NumInterfaces)) {
EP0Data.pData = USB_AltSetting + SetupPacket.wIndex.WB.L;
} else {
return (FALSE);
}
break;
default:
return (FALSE);
}
return (TRUE);
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* This function checks if the buffer is valid per processor architecture and does not overlap with SMRAM. */
|
BOOLEAN FtwSmmIsBufferOutsideSmmValid(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length)
|
/* This function checks if the buffer is valid per processor architecture and does not overlap with SMRAM. */
BOOLEAN FtwSmmIsBufferOutsideSmmValid(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length)
|
{
return SmmIsBufferOutsideSmmValid (Buffer, Length);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Extracts decompressed data to its original form. If the compressed source data specified by Source is successfully decompressed into Destination, then RETURN_SUCCESS is returned. If the compressed source data specified by Source is not in a valid compressed data format, then RETURN_INVALID_PARAMETER is returned. */
|
RETURN_STATUS EFIAPI LzmaUefiDecompress(IN CONST VOID *Source, IN UINTN SourceSize, IN OUT VOID *Destination, IN OUT VOID *Scratch)
|
/* Extracts decompressed data to its original form. If the compressed source data specified by Source is successfully decompressed into Destination, then RETURN_SUCCESS is returned. If the compressed source data specified by Source is not in a valid compressed data format, then RETURN_INVALID_PARAMETER is returned. */
RETURN_STATUS EFIAPI LzmaUefiDecompress(IN CONST VOID *Source, IN UINTN SourceSize, IN OUT VOID *Destination, IN OUT VOID *Scratch)
|
{
SRes LzmaResult;
ELzmaStatus Status;
SizeT DecodedBufSize;
SizeT EncodedDataSize;
ISzAllocWithData AllocFuncs;
AllocFuncs.Functions.Alloc = SzAlloc;
AllocFuncs.Functions.Free = SzFree;
AllocFuncs.Buffer = Scratch;
AllocFuncs.BufferSize = SCRATCH_BUFFER_REQUEST_SIZE;
DecodedBufSize = (SizeT)GetDecodedSizeOfBuf ((UINT8 *)Source);
EncodedDataSize = (SizeT)(SourceSize - LZMA_HEADER_SIZE);
LzmaResult = LzmaDecode (
Destination,
&DecodedBufSize,
(Byte *)((UINT8 *)Source + LZMA_HEADER_SIZE),
&EncodedDataSize,
Source,
LZMA_PROPS_SIZE,
LZMA_FINISH_END,
&Status,
&(AllocFuncs.Functions)
);
if (LzmaResult == SZ_OK) {
return RETURN_SUCCESS;
} else {
return RETURN_INVALID_PARAMETER;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Calculate a 32-bit CRC for a given data word (16 bits) */
|
uint32_t CRC_CalculateCRC16bits(uint16_t data)
|
/* Calculate a 32-bit CRC for a given data word (16 bits) */
uint32_t CRC_CalculateCRC16bits(uint16_t data)
|
{
*(uint16_t*)(CRC_BASE) = (uint16_t) data;
return (CRC->DATA);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Sets up the RX descriptor ring buffers.
This function sets up the descriptor list used for receive packets. */
|
static err_t lpc_rx_setup(struct lpc_enetdata *lpc_enetif)
|
/* Sets up the RX descriptor ring buffers.
This function sets up the descriptor list used for receive packets. */
static err_t lpc_rx_setup(struct lpc_enetdata *lpc_enetif)
|
{
LPC_EMAC->RxDescriptor = (u32_t) &lpc_enetif->prxd[0];
LPC_EMAC->RxStatus = (u32_t) &lpc_enetif->prxs[0];
LPC_EMAC->RxDescriptorNumber = LPC_NUM_BUFF_RXDESCS - 1;
lpc_enetif->rx_free_descs = LPC_NUM_BUFF_RXDESCS;
lpc_enetif->rx_fill_desc_index = 0;
lpc_rx_queue(lpc_enetif->netif);
return ERR_OK;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* This call is similar to hwconfig_arg_cmp_f, except that it takes an additional argument @subopt, and so works with sub-options. */
|
int hwconfig_subarg_cmp_f(const char *opt, const char *subopt, const char *subarg, char *buf)
|
/* This call is similar to hwconfig_arg_cmp_f, except that it takes an additional argument @subopt, and so works with sub-options. */
int hwconfig_subarg_cmp_f(const char *opt, const char *subopt, const char *subarg, char *buf)
|
{
const char *argstr;
size_t arglen;
argstr = hwconfig_subarg_f(opt, subopt, &arglen, buf);
if (!argstr || arglen != strlen(subarg))
return 0;
return !strncmp(argstr, subarg, arglen);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Thread Safe to put the msg into ring - fifo. */
|
int uring_fifo_push_s(const void *buf, const uint16_t len)
|
/* Thread Safe to put the msg into ring - fifo. */
int uring_fifo_push_s(const void *buf, const uint16_t len)
|
{
return aos_queue_send(&ulog_queue, (void*)buf, len);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Return the number of bytes not written. Return 0 on success. */
|
static void asd_write_ocm_seg(struct asd_ha_struct *asd_ha, void *buffer, u32 offs, int size)
|
/* Return the number of bytes not written. Return 0 on success. */
static void asd_write_ocm_seg(struct asd_ha_struct *asd_ha, void *buffer, u32 offs, int size)
|
{
u8 *p = buffer;
if (unlikely(asd_ha->iospace))
asd_write_reg_string(asd_ha, buffer, offs+OCM_BASE_ADDR, size);
else {
for ( ; size > 0; size--, offs++, p++)
asd_write_ocm_byte(asd_ha, offs, *p);
}
return;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Change the current storage area. If the provided value is NULL, the default storage area will be used. */
|
void POINTER_SetCurrentAreaStore(u8 *ptr)
|
/* Change the current storage area. If the provided value is NULL, the default storage area will be used. */
void POINTER_SetCurrentAreaStore(u8 *ptr)
|
{
ptrAreaStore = ( ptr == 0 ) ? DefaultAreaStore : ptr;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Completes the execution of an interrupted C function, calling its continuation function. */
|
static void finishCcall(lua_State *L, int status)
|
/* Completes the execution of an interrupted C function, calling its continuation function. */
static void finishCcall(lua_State *L, int status)
|
{
ci->callstatus &= ~CIST_YPCALL;
L->errfunc = ci->u.c.old_errfunc;
}
adjustresults(L, ci->nresults);
lua_unlock(L);
n = (*ci->u.c.k)(L, status, ci->u.c.ctx);
lua_lock(L);
api_checknelems(L, n);
luaD_poscall(L, ci, L->top - n, n);
}
|
nodemcu/nodemcu-firmware
|
C++
|
MIT License
| 7,566
|
/* cpuidle_register_device - registers a CPU's idle PM feature @dev: the cpu */
|
int cpuidle_register_device(struct cpuidle_device *dev)
|
/* cpuidle_register_device - registers a CPU's idle PM feature @dev: the cpu */
int cpuidle_register_device(struct cpuidle_device *dev)
|
{
int ret;
mutex_lock(&cpuidle_lock);
if ((ret = __cpuidle_register_device(dev))) {
mutex_unlock(&cpuidle_lock);
return ret;
}
cpuidle_enable_device(dev);
cpuidle_install_idle_handler();
mutex_unlock(&cpuidle_lock);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configure the selected source to generate a global interrupt or not. */
|
int32_t MFXSTM32L152_TS_DisableIT(MFXSTM32L152_Object_t *pObj)
|
/* Configure the selected source to generate a global interrupt or not. */
int32_t MFXSTM32L152_TS_DisableIT(MFXSTM32L152_Object_t *pObj)
|
{
int32_t ret = MFXSTM32L152_OK;
if (MFXSTM32L152_DisableITSource(pObj, MFXSTM32L152_IRQ_TS_DET) != MFXSTM32L152_OK)
{
ret = MFXSTM32L152_ERROR;
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Remounting is useful when some setting affecting the operation of the volume has been changed, as these may need a remount to take affect. While this is semantically equivalent with unmounting and then remounting not all backends might need to actually be unmounted. */
|
void g_mount_remount(GMount *mount, GMountMountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
|
/* Remounting is useful when some setting affecting the operation of the volume has been changed, as these may need a remount to take affect. While this is semantically equivalent with unmounting and then remounting not all backends might need to actually be unmounted. */
void g_mount_remount(GMount *mount, GMountMountFlags flags, GMountOperation *mount_operation, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
|
{
GMountIface *iface;
g_return_if_fail (G_IS_MOUNT (mount));
iface = G_MOUNT_GET_IFACE (mount);
if (iface->remount == NULL)
{
g_task_report_new_error (mount, callback, user_data,
g_mount_remount,
G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("mount doesn't implement \"remount\""));
return;
}
(* iface->remount) (mount, flags, mount_operation, cancellable, callback, user_data);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* 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)
|
{
GetPcdProtocol ()->SetSku (SkuId);
return SkuId;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables or disables the selected DAC channel software trigger. */
|
void DAC_SoftTrgEnable(FunctionalState Cmd)
|
/* Enables or disables the selected DAC channel software trigger. */
void DAC_SoftTrgEnable(FunctionalState Cmd)
|
{
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
DAC->SOTTR |= DAC_SOTTR_TREN ;
}
else
{
DAC->SOTTR &= ~(DAC_SOTTR_TREN);
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Calculate the endpoint 0 COUNT_RX register value from */
|
static uint16_t ep0_count_rx(uint16_t ep0_size)
|
/* Calculate the endpoint 0 COUNT_RX register value from */
static uint16_t ep0_count_rx(uint16_t ep0_size)
|
{
if (ep0_size >= 64) {
return USB_EP_COUNT_RX_BL_SIZE | USB_EP_COUNT_RX_NUM_BLOCK(1);
} else if (ep0_size >= 32) {
return USB_EP_COUNT_RX_NUM_BLOCK(16);
} else if (ep0_size >= 16) {
return USB_EP_COUNT_RX_NUM_BLOCK(8);
} else {
return USB_EP_COUNT_RX_NUM_BLOCK(4);
}
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* To clear the chip sleep but keep the chip sleep. */
|
NMI_API sint8 hif_chip_sleep_sc(void)
|
/* To clear the chip sleep but keep the chip sleep. */
NMI_API sint8 hif_chip_sleep_sc(void)
|
{
if(gu8ChipSleep >= 1)
{
gu8ChipSleep--;
}
return M2M_SUCCESS;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Send Txt information message on UART Tx line (to PC Com port). */
|
void PrintInfo(UART_HandleTypeDef *huart, uint8_t *String, uint16_t Size)
|
/* Send Txt information message on UART Tx line (to PC Com port). */
void PrintInfo(UART_HandleTypeDef *huart, uint8_t *String, uint16_t Size)
|
{
if (HAL_OK != HAL_UART_Transmit(huart, String, Size, 100))
{
Error_Handler();
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Initialize the marker reader module. This is called only once, when the decompression object is created. */
|
jinit_marker_reader(j_decompress_ptr cinfo)
|
/* Initialize the marker reader module. This is called only once, when the decompression object is created. */
jinit_marker_reader(j_decompress_ptr cinfo)
|
{
my_marker_ptr marker;
int i;
marker = (my_marker_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
SIZEOF(my_marker_reader));
cinfo->marker = (struct jpeg_marker_reader *) marker;
marker->pub.reset_marker_reader = reset_marker_reader;
marker->pub.read_markers = read_markers;
marker->pub.read_restart_marker = read_restart_marker;
marker->process_COM = skip_variable;
marker->length_limit_COM = 0;
for (i = 0; i < 16; i++) {
marker->process_APPn[i] = skip_variable;
marker->length_limit_APPn[i] = 0;
}
marker->process_APPn[0] = get_interesting_appn;
marker->process_APPn[14] = get_interesting_appn;
reset_marker_reader(cinfo);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Configures and registers the GPIO callback function with the driver. */
|
static void configure_gpio_callback(void)
|
/* Configures and registers the GPIO callback function with the driver. */
static void configure_gpio_callback(void)
|
{
gpio_init();
gpio_register_callback(BUTTON_0_PIN, gpio_callback,
GPIO_CALLBACK_FALLING);
gpio_enable_callback(BUTTON_0_PIN);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. */
|
void FLEXCAN_TransferAbortReceiveFifo(CAN_Type *base, flexcan_handle_t *handle)
|
/* param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. */
void FLEXCAN_TransferAbortReceiveFifo(CAN_Type *base, flexcan_handle_t *handle)
|
{
assert(NULL != handle);
if (0U != (base->MCR & CAN_MCR_RFEN_MASK))
{
FLEXCAN_DisableMbInterrupts(base, (uint32_t)kFLEXCAN_RxFifoOverflowFlag | (uint32_t)kFLEXCAN_RxFifoWarningFlag |
(uint32_t)kFLEXCAN_RxFifoFrameAvlFlag);
handle->rxFifoFrameBuf = NULL;
}
handle->rxFifoState = (uint8_t)kFLEXCAN_StateIdle;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ` */
|
char* strerror(int num)
|
/* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ` */
char* strerror(int num)
|
{
extern int sys_nerr;
extern char *sys_errlist[];
#define UPREFIX "Unknown error: "
static char ebuf[40] = UPREFIX;
register unsigned int errnum;
register char *p, *t;
char tmp[40];
errnum = num;
if (errnum < sys_nerr)
return(sys_errlist[errnum]);
t = tmp;
do {
*t++ = "0123456789"[errnum % 10];
} while (errnum /= 10);
for (p = ebuf + sizeof(UPREFIX) - 1;;) {
*p++ = *--t;
if (t <= tmp)
break;
}
return(ebuf);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Disables the SPI module.
This function will disable the SPI module. */
|
void spi_disable(struct spi_module *const module)
|
/* Disables the SPI module.
This function will disable the SPI module. */
void spi_disable(struct spi_module *const module)
|
{
Spi *const spi_module = (module->hw);
# if SPI_CALLBACK_MODE == true
if(spi_module == SPI0) {
NVIC_DisableIRQ(SPI0_RX_IRQn);
NVIC_DisableIRQ(SPI0_TX_IRQn);
} else if(spi_module == SPI1) {
NVIC_DisableIRQ(SPI1_RX_IRQn);
NVIC_DisableIRQ(SPI1_TX_IRQn);
}
# endif
spi_module->SPI_MODULE_ENABLE.reg = (0x0ul << SPI_MODULE_ENABLE_ENABLE_Pos);
_spi_clock_disable(module);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* This routine is called when the user clicks the "Clear" button in the "Decode As..." dialog window. This routine resets all the dissector values and performs other housekeeping functions. */
|
static void decode_clear_cb(GtkWidget *clear_bt _U_, gpointer user_data _U_)
|
/* This routine is called when the user clicks the "Clear" button in the "Decode As..." dialog window. This routine resets all the dissector values and performs other housekeeping functions. */
static void decode_clear_cb(GtkWidget *clear_bt _U_, gpointer user_data _U_)
|
{
decode_clear_all();
redissect_packets();
redissect_all_packet_windows();
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Tell whether this Operand is an Expression OpCode or not */
|
BOOLEAN IsExpressionOpCode(IN UINT8 Operand)
|
/* Tell whether this Operand is an Expression OpCode or not */
BOOLEAN IsExpressionOpCode(IN UINT8 Operand)
|
{
if (((Operand >= EFI_IFR_EQ_ID_VAL_OP) && (Operand <= EFI_IFR_NOT_OP)) ||
((Operand >= EFI_IFR_MATCH_OP) && (Operand <= EFI_IFR_SET_OP)) ||
((Operand >= EFI_IFR_EQUAL_OP) && (Operand <= EFI_IFR_SPAN_OP)) ||
(Operand == EFI_IFR_CATENATE_OP) ||
(Operand == EFI_IFR_TO_LOWER_OP) ||
(Operand == EFI_IFR_TO_UPPER_OP) ||
(Operand == EFI_IFR_MAP_OP) ||
(Operand == EFI_IFR_VERSION_OP) ||
(Operand == EFI_IFR_SECURITY_OP) ||
(Operand == EFI_IFR_MATCH2_OP))
{
return TRUE;
} else {
return FALSE;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns the most recent received data by the spi peripheral. */
|
u32 SPI_ReceiveData(SPI_TypeDef *spi)
|
/* Returns the most recent received data by the spi peripheral. */
u32 SPI_ReceiveData(SPI_TypeDef *spi)
|
{
u32 temp;
u8 templen;
__asm volatile("cpsid i");
temp = READ_REG(spi->RDR);
templen = READ_REG(spi->ECR);
if(templen == 0)
templen = 32;
if (templen > 8)
temp |= (u32)(READ_REG(spi->RDR) << 8);
if (templen > 16)
temp |= (u32)(READ_REG(spi->RDR) << 16);
if (templen > 24)
temp |= (u32)(READ_REG(spi->RDR) << 24);
__asm volatile("cpsie i");
return temp;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Description: Handle network device events, although at present all we care about is a network device going away. In the case of a device going away we clear any related entries from the unlabeled connection hash table. */
|
static int netlbl_unlhsh_netdev_handler(struct notifier_block *this, unsigned long event, void *ptr)
|
/* Description: Handle network device events, although at present all we care about is a network device going away. In the case of a device going away we clear any related entries from the unlabeled connection hash table. */
static int netlbl_unlhsh_netdev_handler(struct notifier_block *this, unsigned long event, void *ptr)
|
{
struct net_device *dev = ptr;
struct netlbl_unlhsh_iface *iface = NULL;
if (!net_eq(dev_net(dev), &init_net))
return NOTIFY_DONE;
if (event == NETDEV_DOWN) {
spin_lock(&netlbl_unlhsh_lock);
iface = netlbl_unlhsh_search_iface(dev->ifindex);
if (iface != NULL && iface->valid) {
iface->valid = 0;
list_del_rcu(&iface->list);
} else
iface = NULL;
spin_unlock(&netlbl_unlhsh_lock);
}
if (iface != NULL)
call_rcu(&iface->rcu, netlbl_unlhsh_free_iface);
return NOTIFY_DONE;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* load the last error code in the error list */
|
void scsi_sense_code(usb_core_driver *pudev, uint8_t lun, uint8_t skey, uint8_t asc)
|
/* load the last error code in the error list */
void scsi_sense_code(usb_core_driver *pudev, uint8_t lun, uint8_t skey, uint8_t asc)
|
{
usbd_msc_handler *msc = (usbd_msc_handler *)pudev->dev.class_data[USBD_MSC_INTERFACE];
msc->scsi_sense[msc->scsi_sense_tail].SenseKey = skey;
msc->scsi_sense[msc->scsi_sense_tail].ASC = asc << 8U;
msc->scsi_sense_tail++;
if (SENSE_LIST_DEEPTH == msc->scsi_sense_tail) {
msc->scsi_sense_tail = 0U;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If HmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
|
BOOLEAN EFIAPI HmacSha384SetKey(OUT VOID *HmacSha384Context, IN CONST UINT8 *Key, IN UINTN KeySize)
|
/* If HmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI HmacSha384SetKey(OUT VOID *HmacSha384Context, IN CONST UINT8 *Key, IN UINTN KeySize)
|
{
CALL_CRYPTO_SERVICE (HmacSha384SetKey, (HmacSha384Context, Key, KeySize), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Reads a byte of data from the memory of the LCD controller. DMDIF_prepareDataAccess() needs to be called before using this function. DOESN'T WORK. */
|
uint32_t DMDIF_readData(void)
|
/* Reads a byte of data from the memory of the LCD controller. DMDIF_prepareDataAccess() needs to be called before using this function. DOESN'T WORK. */
uint32_t DMDIF_readData(void)
|
{
uint32_t data;
data = *data_register;
return data;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* tipc_nametbl_publish - add name publication to network name tables */
|
struct publication* tipc_nametbl_publish(u32 type, u32 lower, u32 upper, u32 scope, u32 port_ref, u32 key)
|
/* tipc_nametbl_publish - add name publication to network name tables */
struct publication* tipc_nametbl_publish(u32 type, u32 lower, u32 upper, u32 scope, u32 port_ref, u32 key)
|
{
struct publication *publ;
if (table.local_publ_count >= tipc_max_publications) {
warn("Publication failed, local publication limit reached (%u)\n",
tipc_max_publications);
return NULL;
}
if ((type < TIPC_RESERVED_TYPES) && !atomic_read(&rsv_publ_ok)) {
warn("Publication failed, reserved name {%u,%u,%u}\n",
type, lower, upper);
return NULL;
}
write_lock_bh(&tipc_nametbl_lock);
table.local_publ_count++;
publ = tipc_nametbl_insert_publ(type, lower, upper, scope,
tipc_own_addr, port_ref, key);
if (publ && (scope != TIPC_NODE_SCOPE)) {
tipc_named_publish(publ);
}
write_unlock_bh(&tipc_nametbl_lock);
return publ;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* ADC Set the Sample Time Selection for a Single Channel. */
|
void adc_set_channel_sample_time_selection(uint32_t adc, uint8_t channel, uint8_t selection)
|
/* ADC Set the Sample Time Selection for a Single Channel. */
void adc_set_channel_sample_time_selection(uint32_t adc, uint8_t channel, uint8_t selection)
|
{
uint32_t reg32;
reg32 = ADC_SMPR1(adc);
reg32 &= ~(ADC_SMPR_SMPSEL_CHANNEL_MASK << ADC_SMPR_SMPSEL_CHANNEL_SHIFT(channel));
reg32 |= (selection << ADC_SMPR_SMPSEL_CHANNEL_SHIFT(channel));
ADC_SMPR1(adc) = reg32;
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Enables or disables the selected ADC start of the injected channels conversion. */
|
void ADC_SoftwareStartInjectedConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
|
/* Enables or disables the selected ADC start of the injected channels conversion. */
void ADC_SoftwareStartInjectedConvCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
|
{
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
ADCx->CR2 |= (ADC_CR2_JSWSTART | ADC_CR2_JEXTTRIG);
}
else
{
ADCx->CR2 &= (uint32_t) ~(ADC_CR2_JSWSTART | ADC_CR2_JEXTTRIG);
}
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* Returns: The address of the specific IE found, or NULL */
|
u8* rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, uint *ielen)
|
/* Returns: The address of the specific IE found, or NULL */
u8* rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, uint *ielen)
|
{
uint cnt;
u8 *target_ie = NULL;
if(ielen)
*ielen = 0;
if(!in_ie || in_len<=0)
return target_ie;
cnt = 0;
while(cnt<in_len)
{
if(eid == in_ie[cnt]
&& ( !oui || _rtw_memcmp(&in_ie[cnt+2], oui, oui_len) == _TRUE))
{
target_ie = &in_ie[cnt];
if(ie)
_rtw_memcpy(ie, &in_ie[cnt], in_ie[cnt+1]+2);
if(ielen)
*ielen = in_ie[cnt+1]+2;
break;
}
else
{
cnt+=in_ie[cnt+1]+2;
}
}
return target_ie;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Check whether this object is used by multiple users */
|
int nl_object_shared(struct nl_object *obj)
|
/* Check whether this object is used by multiple users */
int nl_object_shared(struct nl_object *obj)
|
{
return obj->ce_refcnt > 1;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Refresh display on terminal.
Update the terminal display to show the current menu and the current time depending on the device state. */
|
static void refresh_display(void)
|
/* Refresh display on terminal.
Update the terminal display to show the current menu and the current time depending on the device state. */
static void refresh_display(void)
|
{
printf("%c[2J\r", 27);
printf("Time: %u\n\r", (unsigned int)rtt_read_timer_value(RTT));
if (g_uc_alarmed) {
puts("!!! ALARM !!!\r");
}
if (g_uc_state == STATE_MAIN_MENU) {
puts("Menu:\n\r"
" r - Reset timer\n\r"
" s - Set alarm\r");
if (g_uc_alarmed) {
puts(" c - Clear alarm notification\r");
}
puts("\n\rChoice? ");
} else {
if (g_uc_state == STATE_SET_ALARM) {
puts("Enter alarm time: ");
if (g_ul_new_alarm != 0) {
printf("%u", (unsigned)g_ul_new_alarm);
}
}
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Enable the specified ADC discontinuous mode for injected group. */
|
void ADC_EnableInjectedDiscMode(ADC_T *adc)
|
/* Enable the specified ADC discontinuous mode for injected group. */
void ADC_EnableInjectedDiscMode(ADC_T *adc)
|
{
adc->CTRL1_B.INJDISCEN = BIT_SET;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* RTC set Prescaler value.
The clock needs to be stopped for this to have any effect. */
|
void rtc_set_prescaler(uint32_t rtc, uint16_t presc)
|
/* RTC set Prescaler value.
The clock needs to be stopped for this to have any effect. */
void rtc_set_prescaler(uint32_t rtc, uint16_t presc)
|
{
RTC_PRESCALER(rtc) = presc & 0xfff;
}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT8 EFIAPI PciBitFieldAnd8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciBitFieldAnd8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData)
|
{
return PciExpressBitFieldAnd8 (Address, StartBit, EndBit, AndData);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* externally visible scheduler statistics: current number of runnable threads, current number of uninterruptible-sleeping threads, total number of context switches performed since bootup. */
|
unsigned long nr_running(void)
|
/* externally visible scheduler statistics: current number of runnable threads, current number of uninterruptible-sleeping threads, total number of context switches performed since bootup. */
unsigned long nr_running(void)
|
{
unsigned long i, sum = 0;
for_each_online_cpu(i)
sum += cpu_rq(i)->nr_running;
return sum;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enable card status IRQs on (re-)initialisation. This can be called at initialisation, power management event, or pcmcia event. */
|
static void e740_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
|
/* Enable card status IRQs on (re-)initialisation. This can be called at initialisation, power management event, or pcmcia event. */
static void e740_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
|
{
soc_pcmcia_enable_irqs(skt, cd_irqs, ARRAY_SIZE(cd_irqs));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Un-Register the Service B.4 and all its Characteristics... */
|
void service_b_4_1_remove(void)
|
/* Un-Register the Service B.4 and all its Characteristics... */
void service_b_4_1_remove(void)
|
{
bt_gatt_service_unregister(&service_b_4_1_svc);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Opens a pipe of the Low Level Driver. */
|
USBH_StatusTypeDef USBH_LL_OpenPipe(USBH_HandleTypeDef *phost, uint8_t pipe, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps)
|
/* Opens a pipe of the Low Level Driver. */
USBH_StatusTypeDef USBH_LL_OpenPipe(USBH_HandleTypeDef *phost, uint8_t pipe, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps)
|
{
HAL_HCD_HC_Init(phost->pData,
pipe,
epnum,
dev_address,
speed,
ep_type,
mps);
return USBH_OK;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* @attr: the first WSS information attribute in message @neighbor: the neighbor whose cache will be populated @buflen: size of the input buffer */
|
static ssize_t wlp_get_wss_info_to_cache(struct wlp *wlp, struct wlp_attr_wss_info *attr, struct wlp_neighbor_e *neighbor, ssize_t buflen)
|
/* @attr: the first WSS information attribute in message @neighbor: the neighbor whose cache will be populated @buflen: size of the input buffer */
static ssize_t wlp_get_wss_info_to_cache(struct wlp *wlp, struct wlp_attr_wss_info *attr, struct wlp_neighbor_e *neighbor, ssize_t buflen)
|
{
return wlp_get_all_wss_info(wlp, attr, neighbor, NULL, buflen);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Function for processing the BLE_GAP_EVT_AUTH_STATUS event from the SoftDevice, when the auth_status is failure. */
|
static void auth_status_failure_process(ble_gap_evt_t *p_gap_evt)
|
/* Function for processing the BLE_GAP_EVT_AUTH_STATUS event from the SoftDevice, when the auth_status is failure. */
static void auth_status_failure_process(ble_gap_evt_t *p_gap_evt)
|
{
link_secure_failure(p_gap_evt->conn_handle,
p_gap_evt->params.auth_status.auth_status,
p_gap_evt->params.auth_status.error_src);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* if NZ = 1, rate = 1.mmmmmmmmm x 2^(eeeee) cells/sec */
|
static u16 cellrate_to_float(u32 cr)
|
/* if NZ = 1, rate = 1.mmmmmmmmm x 2^(eeeee) cells/sec */
static u16 cellrate_to_float(u32 cr)
|
{
#define NZ 0x4000
#define M_BITS 9
#define E_BITS 5
#define M_MASK 0x1ff#define E_MASK 0x1f
u16 flot;
u32 tmp = cr & 0x00ffffff;
int i = 0;
if (cr == 0)
return 0;
while (tmp != 1) {
tmp >>= 1;
i++;
}
if (i == M_BITS)
flot = NZ | (i << M_BITS) | (cr & M_MASK);
else if (i < M_BITS)
flot = NZ | (i << M_BITS) | ((cr << (M_BITS - i)) & M_MASK);
else
flot = NZ | (i << M_BITS) | ((cr >> (i - M_BITS)) & M_MASK);
return flot;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function will add an endpoint to an alternate setting. */
|
rt_err_t rt_usbd_altsetting_add_endpoint(ualtsetting_t setting, uep_t ep)
|
/* This function will add an endpoint to an alternate setting. */
rt_err_t rt_usbd_altsetting_add_endpoint(ualtsetting_t setting, uep_t ep)
|
{
LOG_D("rt_usbd_altsetting_add_endpoint");
RT_ASSERT(setting != RT_NULL);
RT_ASSERT(ep != RT_NULL);
rt_list_insert_before(&setting->ep_list, &ep->list);
return RT_EOK;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Allocate a free cluster and return the cluster index. */
|
STATIC UINTN FatAllocateCluster(IN FAT_VOLUME *Volume)
|
/* Allocate a free cluster and return the cluster index. */
STATIC UINTN FatAllocateCluster(IN FAT_VOLUME *Volume)
|
{
UINTN Cluster;
if (Volume->DiskError) {
return (UINTN)FAT_CLUSTER_LAST;
}
for ( ; ;) {
if (Volume->FatInfoSector.FreeInfo.NextCluster > (Volume->MaxCluster + 1)) {
if (Volume->FreeInfoValid && (0 < (INT32)(Volume->FatInfoSector.FreeInfo.ClusterCount))) {
Volume->FreeInfoValid = FALSE;
}
FatComputeFreeInfo (Volume);
if (Volume->FatInfoSector.FreeInfo.NextCluster > (Volume->MaxCluster + 1)) {
return (UINTN)FAT_CLUSTER_LAST;
}
}
Cluster = FatGetFatEntry (Volume, Volume->FatInfoSector.FreeInfo.NextCluster);
if (Cluster == FAT_CLUSTER_FREE) {
break;
}
Volume->FatInfoSector.FreeInfo.NextCluster += 1;
}
Cluster = Volume->FatInfoSector.FreeInfo.NextCluster;
Volume->FatInfoSector.FreeInfo.NextCluster += 1;
return Cluster;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Configurate The Timer's mode and tick frequency.
The */
|
void xTimerInitConfig(unsigned long ulBase, unsigned long ulChannel, unsigned long ulConfig, unsigned long ulTickFreq)
|
/* Configurate The Timer's mode and tick frequency.
The */
void xTimerInitConfig(unsigned long ulBase, unsigned long ulChannel, unsigned long ulConfig, unsigned long ulTickFreq)
|
{
TimerInitConfig(ulBase, ulConfig, ulTickFreq);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* igbvf_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */
|
static void igbvf_tx_timeout(struct net_device *netdev)
|
/* igbvf_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */
static void igbvf_tx_timeout(struct net_device *netdev)
|
{
struct igbvf_adapter *adapter = netdev_priv(netdev);
adapter->tx_timeout_count++;
schedule_work(&adapter->reset_task);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* atlx_irq_disable - Mask off interrupt generation on the NIC @adapter: board private structure */
|
static void atlx_irq_disable(struct atlx_adapter *adapter)
|
/* atlx_irq_disable - Mask off interrupt generation on the NIC @adapter: board private structure */
static void atlx_irq_disable(struct atlx_adapter *adapter)
|
{
iowrite32(0, adapter->hw.hw_addr + REG_IMR);
ioread32(adapter->hw.hw_addr + REG_IMR);
synchronize_irq(adapter->pdev->irq);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base CSI peripheral base address. param fifo The FIFO DMA to reflash. */
|
void CSI_ReflashFifoDma(CSI_Type *base, csi_fifo_t fifo)
|
/* param base CSI peripheral base address. param fifo The FIFO DMA to reflash. */
void CSI_ReflashFifoDma(CSI_Type *base, csi_fifo_t fifo)
|
{
uint32_t cr3 = 0U;
if (0U != ((uint32_t)fifo & (uint32_t)kCSI_RxFifo))
{
cr3 |= CSI_CSICR3_DMA_REFLASH_RFF_MASK;
}
if (0U != ((uint32_t)fifo & (uint32_t)kCSI_StatFifo))
{
cr3 |= CSI_CSICR3_DMA_REFLASH_SFF_MASK;
}
base->CSICR3 |= cr3;
while (0U != (base->CSICR3 & cr3))
{
}
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Function will replace the current Argc and Argv in the ShellParameters protocol structure with Argv and Argc. The current values are de-allocated and the OldArgv must not be deallocated by the caller. */
|
VOID RestoreArgcArgv(IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CHAR16 ***OldArgv, IN UINTN *OldArgc)
|
/* Function will replace the current Argc and Argv in the ShellParameters protocol structure with Argv and Argc. The current values are de-allocated and the OldArgv must not be deallocated by the caller. */
VOID RestoreArgcArgv(IN OUT EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters, IN CHAR16 ***OldArgv, IN UINTN *OldArgc)
|
{
UINTN LoopCounter;
ASSERT (ShellParameters != NULL);
ASSERT (OldArgv != NULL);
ASSERT (OldArgc != NULL);
if (ShellParameters->Argv != NULL) {
for ( LoopCounter = 0
; LoopCounter < ShellParameters->Argc
; LoopCounter++
)
{
FreePool (ShellParameters->Argv[LoopCounter]);
}
FreePool (ShellParameters->Argv);
}
ShellParameters->Argv = *OldArgv;
*OldArgv = NULL;
ShellParameters->Argc = *OldArgc;
*OldArgc = 0;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set the smk_{in,out} state of an existing sock based on the process that is creating the new socket. */
|
static void smack_sock_graft(struct sock *sk, struct socket *parent)
|
/* Set the smk_{in,out} state of an existing sock based on the process that is creating the new socket. */
static void smack_sock_graft(struct sock *sk, struct socket *parent)
|
{
struct socket_smack *ssp;
if (sk == NULL ||
(sk->sk_family != PF_INET && sk->sk_family != PF_INET6))
return;
ssp = sk->sk_security;
ssp->smk_in = ssp->smk_out = current_security();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* return The enabled interrupts. This is the logical OR of members of the enumeration ::qtmr_interrupt_enable_t */
|
uint32_t QTMR_GetEnabledInterrupts(TMR_Type *base, qtmr_channel_selection_t channel)
|
/* return The enabled interrupts. This is the logical OR of members of the enumeration ::qtmr_interrupt_enable_t */
uint32_t QTMR_GetEnabledInterrupts(TMR_Type *base, qtmr_channel_selection_t channel)
|
{
uint32_t enabledInterrupts = 0;
uint16_t reg;
reg = base->CHANNEL[channel].SCTRL;
if (reg & TMR_SCTRL_TCFIE_MASK)
{
enabledInterrupts |= kQTMR_CompareFlag;
}
if (reg & TMR_SCTRL_TOFIE_MASK)
{
enabledInterrupts |= kQTMR_OverflowInterruptEnable;
}
if (reg & TMR_SCTRL_IEFIE_MASK)
{
enabledInterrupts |= kQTMR_EdgeInterruptEnable;
}
reg = base->CHANNEL[channel].CSCTRL;
if (reg & TMR_CSCTRL_TCF1EN_MASK)
{
enabledInterrupts |= kQTMR_Compare1InterruptEnable;
}
if (reg & TMR_CSCTRL_TCF2EN_MASK)
{
enabledInterrupts |= kQTMR_Compare2InterruptEnable;
}
return enabledInterrupts;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* send get report descriptor command to the device */
|
static usbh_status usbh_hid_reportdesc_get(usbh_host *uhost, uint16_t len)
|
/* send get report descriptor command to the device */
static usbh_status usbh_hid_reportdesc_get(usbh_host *uhost, uint16_t len)
|
{
usbh_status status = USBH_BUSY;
if (CTL_IDLE == uhost->control.ctl_state) {
uhost->control.setup.req = (usb_req) {
.bmRequestType = USB_TRX_IN | USB_RECPTYPE_ITF | USB_REQTYPE_STRD,
.bRequest = USB_GET_DESCRIPTOR,
.wValue = USBH_DESC(USB_DESCTYPE_REPORT),
.wIndex = 0U,
.wLength = len
};
usbh_ctlstate_config (uhost, uhost->dev_prop.data, len);
}
status = usbh_ctl_handler (uhost);
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Initializes the SDIO peripheral according to the specified parameters in the SDIO_InitStruct. */
|
void SDIO_Init(SDIO_InitTypeDef *SDIO_InitStruct)
|
/* Initializes the SDIO peripheral according to the specified parameters in the SDIO_InitStruct. */
void SDIO_Init(SDIO_InitTypeDef *SDIO_InitStruct)
|
{
SDIO->MMC_CTRL &= 0x700;
SDIO->MMC_CTRL |= (SDIO_InitStruct->SDIO_OPMSel | SDIO_InitStruct->SDIO_SelSM |
SDIO_InitStruct->SDIO_OUTM | SDIO_InitStruct->SDIO_CLKSP |
SDIO_InitStruct->SDIO_SelPTSM | SDIO_InitStruct->SDIO_DATWT |
SDIO_InitStruct->SDIO_MDEN);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* function to be used with macro "fasttm": optimized for absence of tag methods */
|
const TValue* luaT_gettm(Table *events, TMS event, TString *ename)
|
/* function to be used with macro "fasttm": optimized for absence of tag methods */
const TValue* luaT_gettm(Table *events, TMS event, TString *ename)
|
{
if (isrwtable(events))
events->flags |= cast_byte(1u<<event);
return NULL;
}
else return tm;
}
|
nodemcu/nodemcu-firmware
|
C++
|
MIT License
| 7,566
|
/* Prepares for the data used by CPU feature detection and initialization. */
|
VOID* EFIAPI X2ApicGetConfigData(IN UINTN NumberOfProcessors)
|
/* Prepares for the data used by CPU feature detection and initialization. */
VOID* EFIAPI X2ApicGetConfigData(IN UINTN NumberOfProcessors)
|
{
BOOLEAN *ConfigData;
ConfigData = AllocateZeroPool (sizeof (BOOLEAN) * NumberOfProcessors);
ASSERT (ConfigData != NULL);
return ConfigData;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function will install a interrupt service routine to a interrupt. */
|
void rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler, rt_isr_handler_t *old_handler)
|
/* This function will install a interrupt service routine to a interrupt. */
void rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler, rt_isr_handler_t *old_handler)
|
{
if(vector >= 0 && vector < MAX_HANDLERS)
{
if (*old_handler != RT_NULL) *old_handler = (rt_isr_handler_t)AT91C_AIC_SVR(vector);
if (new_handler != RT_NULL) AT91C_AIC_SVR(vector) = (rt_uint32_t)new_handler;
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Check whether an HCI event is available in the input-copy queue. */
|
static void has_event(uint16_t size)
|
/* Check whether an HCI event is available in the input-copy queue. */
static void has_event(uint16_t size)
|
{
struct has_event_resp {
uint16_t response;
uint16_t size;
uint8_t count;
} __packed;
struct has_event_resp le_response = {
.response = sys_cpu_to_le16(CMD_HAS_EVENT_RSP),
.size = sys_cpu_to_le16(1),
.count = m_events
};
if (size > 0) {
read_excess_bytes(size);
}
edtt_write((uint8_t *)&le_response, sizeof(le_response), EDTTT_BLOCK);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* This function handles external line 15_10 interrupt request. */
|
void EXTI15_10_IRQHandler(void)
|
/* This function handles external line 15_10 interrupt request. */
void EXTI15_10_IRQHandler(void)
|
{
HAL_GPIO_EXTI_IRQHandler(USER_BUTTON_PIN);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Get current value of each Peripheral Clock Selection. */
|
uint32_t CLKPWR_GetPCLKSEL(uint32_t ClkType)
|
/* Get current value of each Peripheral Clock Selection. */
uint32_t CLKPWR_GetPCLKSEL(uint32_t ClkType)
|
{
uint32_t bitpos, retval;
if (ClkType < 32)
{
bitpos = ClkType;
retval = LPC_SC->PCLKSEL0;
}
else
{
bitpos = ClkType - 32;
retval = LPC_SC->PCLKSEL1;
}
retval = CLKPWR_PCLKSEL_GET(bitpos, retval);
return retval;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* This file is part of the Simba project. */
|
int mock_write_esp_wifi_softap_init(const char *ssid_p, const char *password_p, int res)
|
/* This file is part of the Simba project. */
int mock_write_esp_wifi_softap_init(const char *ssid_p, const char *password_p, int res)
|
{
harness_mock_write("esp_wifi_softap_init(ssid_p)",
ssid_p,
strlen(ssid_p) + 1);
harness_mock_write("esp_wifi_softap_init(password_p)",
password_p,
strlen(password_p) + 1);
harness_mock_write("esp_wifi_softap_init(): return (res)",
&res,
sizeof(res));
return (0);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* 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_int8u first_sector;
blt_int8u last_sector;
addr = FlashTranslateToNonCachedAddress(addr);
if ((len - 1) > (FLASH_END_ADDRESS - addr))
{
return BLT_FALSE;
}
first_sector = FlashGetSector(addr);
last_sector = FlashGetSector(addr+len-1);
if ((first_sector == FLASH_INVALID_SECTOR) || (last_sector == FLASH_INVALID_SECTOR))
{
return BLT_FALSE;
}
return FlashEraseSectors(first_sector, last_sector);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Caller should ensure that it is the only one to call this function. This function cannot be called concurrently. */
|
XENSTORE_STATUS XenBusEnumerateBus(XENBUS_DEVICE *Dev)
|
/* Caller should ensure that it is the only one to call this function. This function cannot be called concurrently. */
XENSTORE_STATUS XenBusEnumerateBus(XENBUS_DEVICE *Dev)
|
{
CONST CHAR8 **Types;
UINTN Index;
UINT32 Count;
XENSTORE_STATUS Status;
Status = XenStoreListDirectory (
XST_NIL,
"device",
"",
&Count,
&Types
);
if (Status != XENSTORE_STATUS_SUCCESS) {
return Status;
}
for (Index = 0; Index < Count; Index++) {
XenBusEnumerateDeviceType (Dev, Types[Index]);
}
FreePool ((VOID *)Types);
return XENSTORE_STATUS_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Function to retrieve the EFI_HANDLE from the human-friendly index. */
|
EFI_HANDLE EFIAPI ConvertHandleIndexToHandle(IN CONST UINTN TheIndex)
|
/* Function to retrieve the EFI_HANDLE from the human-friendly index. */
EFI_HANDLE EFIAPI ConvertHandleIndexToHandle(IN CONST UINTN TheIndex)
|
{
EFI_STATUS Status;
EFI_GUID **ProtocolBuffer;
UINTN ProtocolCount;
HANDLE_LIST *ListWalker;
InternalShellInitHandleList ();
if (TheIndex >= mHandleList.NextIndex) {
return NULL;
}
for (ListWalker = (HANDLE_LIST *)GetFirstNode (&mHandleList.List.Link)
; !IsNull (&mHandleList.List.Link, &ListWalker->Link)
; ListWalker = (HANDLE_LIST *)GetNextNode (&mHandleList.List.Link, &ListWalker->Link)
)
{
if ((ListWalker->TheIndex == TheIndex) && (ListWalker->TheHandle != NULL)) {
Status = gBS->ProtocolsPerHandle (ListWalker->TheHandle, &ProtocolBuffer, &ProtocolCount);
if (!EFI_ERROR (Status)) {
FreePool (ProtocolBuffer);
} else {
ListWalker->TheHandle = NULL;
}
return (ListWalker->TheHandle);
}
}
return NULL;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If the security protocol command completes without an error, the function shall return EFI_SUCCESS. If the security protocol command completes with an error, the function shall return EFI_DEVICE_ERROR. */
|
EFI_STATUS EFIAPI SecuritySendData(IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Timeout, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN PayloadBufferSize, IN VOID *PayloadBuffer)
|
/* If the security protocol command completes without an error, the function shall return EFI_SUCCESS. If the security protocol command completes with an error, the function shall return EFI_DEVICE_ERROR. */
EFI_STATUS EFIAPI SecuritySendData(IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Timeout, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN PayloadBufferSize, IN VOID *PayloadBuffer)
|
{
OPAL_PEI_DEVICE *PeiDev;
PeiDev = OPAL_PEI_DEVICE_FROM_THIS (This);
if (PeiDev == NULL) {
return EFI_DEVICE_ERROR;
}
return PeiDev->SscPpi->SendData (
PeiDev->SscPpi,
PeiDev->DeviceIndex,
SSC_PPI_GENERIC_TIMEOUT,
SecurityProtocolId,
SecurityProtocolSpecificData,
PayloadBufferSize,
PayloadBuffer
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* In xAPIC mode, the initial local APIC ID may be different from current APIC ID. In x2APIC mode, the local APIC ID can't be changed and there is no concept of initial APIC ID. In this case, the 32-bit local APIC ID is returned as initial APIC ID. */
|
UINT32 EFIAPI GetInitialApicId(VOID)
|
/* In xAPIC mode, the initial local APIC ID may be different from current APIC ID. In x2APIC mode, the local APIC ID can't be changed and there is no concept of initial APIC ID. In this case, the 32-bit local APIC ID is returned as initial APIC ID. */
UINT32 EFIAPI GetInitialApicId(VOID)
|
{
UINT32 ApicId;
UINT32 MaxCpuIdIndex;
UINT32 RegEbx;
ASSERT (GetApicMode () == LOCAL_APIC_MODE_XAPIC);
AsmCpuid (CPUID_SIGNATURE, &MaxCpuIdIndex, NULL, NULL, NULL);
if (MaxCpuIdIndex >= CPUID_EXTENDED_TOPOLOGY) {
AsmCpuidEx (CPUID_EXTENDED_TOPOLOGY, 0, NULL, &RegEbx, NULL, &ApicId);
if ((RegEbx & (BIT16 - 1)) != 0) {
return ApicId;
}
}
AsmCpuid (CPUID_VERSION_INFO, NULL, &RegEbx, NULL, NULL);
return RegEbx >> 24;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This API configures the pins to fire the interrupt signal when it occurs. */
|
static int8_t set_intr_pin_config(const struct bmi160_int_settg *int_config, const struct bmi160_dev *dev)
|
/* This API configures the pins to fire the interrupt signal when it occurs. */
static int8_t set_intr_pin_config(const struct bmi160_int_settg *int_config, const struct bmi160_dev *dev)
|
{
int8_t rslt;
rslt = config_int_out_ctrl(int_config, dev);
if (rslt == BMI160_OK)
{
rslt = config_int_latch(int_config, dev);
}
return rslt;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* ioc3uart_intr - field all serial interrupts @is : submodule @idd: driver data @pending: interrupts to handle */
|
static int ioc3uart_intr(struct ioc3_submodule *is, struct ioc3_driver_data *idd, unsigned int pending)
|
/* ioc3uart_intr - field all serial interrupts @is : submodule @idd: driver data @pending: interrupts to handle */
static int ioc3uart_intr(struct ioc3_submodule *is, struct ioc3_driver_data *idd, unsigned int pending)
|
{
int ret = 0;
if (pending & SIO_IR_SA)
ret |= ioc3uart_intr_one(is, idd, pending & SIO_IR_SA);
if (pending & SIO_IR_SB)
ret |= ioc3uart_intr_one(is, idd, pending & SIO_IR_SB);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Port is isolated after EVFP exchange due to VF_ID mismatch (N and F). */
|
static void bfa_fcs_fabric_sm_isolated(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event)
|
/* Port is isolated after EVFP exchange due to VF_ID mismatch (N and F). */
static void bfa_fcs_fabric_sm_isolated(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event)
|
{
bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
bfa_trc(fabric->fcs, event);
bfa_log(fabric->fcs->logm, BFA_LOG_FCS_FABRIC_ISOLATED,
fabric->bport.port_cfg.pwwn, fabric->fcs->port_vfid,
fabric->event_arg.swp_vfid);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base The I3C peripheral base address. param i3c_ibi_type_t Type of #i3c_ibi_type_t. */
|
i3c_ibi_type_t I3C_GetIBIType(I3C_Type *base)
|
/* param base The I3C peripheral base address. param i3c_ibi_type_t Type of #i3c_ibi_type_t. */
i3c_ibi_type_t I3C_GetIBIType(I3C_Type *base)
|
{
uint32_t ibiValue = (base->MSTATUS & I3C_MSTATUS_IBITYPE_MASK) >> I3C_MSTATUS_IBITYPE_SHIFT;
i3c_ibi_type_t ibiType = kI3C_IbiNormal;
switch (ibiValue)
{
case 3L:
ibiType = kI3C_IbiHotJoin;
break;
case 2L:
ibiType = kI3C_IbiMasterRequest;
break;
default:
ibiType = kI3C_IbiNormal;
break;
}
return ibiType;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Called from the LLD when the network link is not ready. There may be multiple calls while the link is down. */
|
int fcoe_ctlr_link_down(struct fcoe_ctlr *fip)
|
/* Called from the LLD when the network link is not ready. There may be multiple calls while the link is down. */
int fcoe_ctlr_link_down(struct fcoe_ctlr *fip)
|
{
int link_dropped;
LIBFCOE_FIP_DBG(fip, "link down.\n");
spin_lock_bh(&fip->lock);
fcoe_ctlr_reset(fip);
link_dropped = fip->link;
fip->link = 0;
fip->last_link = 0;
fip->state = FIP_ST_LINK_WAIT;
spin_unlock_bh(&fip->lock);
if (link_dropped)
fc_linkdown(fip->lp);
return link_dropped;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check if the USB CDC Data(UsbIo) installed and return USB CDC Data Handle. */
|
BOOLEAN IsUsbCdcData(IN EFI_USB_IO_PROTOCOL *UsbIo)
|
/* Check if the USB CDC Data(UsbIo) installed and return USB CDC Data Handle. */
BOOLEAN IsUsbCdcData(IN EFI_USB_IO_PROTOCOL *UsbIo)
|
{
EFI_STATUS Status;
EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDescriptor);
if (EFI_ERROR (Status)) {
return FALSE;
}
if ((InterfaceDescriptor.InterfaceClass == USB_CDC_DATA_CLASS) &&
(InterfaceDescriptor.InterfaceSubClass == USB_CDC_DATA_SUBCLASS) &&
(InterfaceDescriptor.InterfaceProtocol == USB_NO_CLASS_PROTOCOL))
{
return TRUE;
}
return FALSE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set TPM chip to ready state by sending ready command TIS_PC_STS_READY to Status Register in time. */
|
EFI_STATUS TisPcPrepareCommand(IN TIS_PC_REGISTERS_PTR TisReg)
|
/* Set TPM chip to ready state by sending ready command TIS_PC_STS_READY to Status Register in time. */
EFI_STATUS TisPcPrepareCommand(IN TIS_PC_REGISTERS_PTR TisReg)
|
{
EFI_STATUS Status;
if (TisReg == NULL) {
return EFI_INVALID_PARAMETER;
}
MmioWrite8 ((UINTN)&TisReg->Status, TIS_PC_STS_READY);
Status = TisPcWaitRegisterBits (
&TisReg->Status,
TIS_PC_STS_READY,
0,
TIS_TIMEOUT_B
);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* function to write the bypass register which requires a poll of the busy bit */
|
static void cm_write_bypass_mainpll(u32 val)
|
/* function to write the bypass register which requires a poll of the busy bit */
static void cm_write_bypass_mainpll(u32 val)
|
{
writel(val, &clock_manager_base->main_pll.bypass);
cm_wait_for_fsm();
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* If @count is smaller than the length of the string, copies @count bytes and returns @count. */
|
long strncpy_from_user(char *dst, const char __user *src, long count)
|
/* If @count is smaller than the length of the string, copies @count bytes and returns @count. */
long strncpy_from_user(char *dst, const char __user *src, long count)
|
{
long res = -EFAULT;
if (access_ok(VERIFY_READ, src, 1))
__do_strncpy_from_user(dst, src, count, res);
return res;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Return the position of the first alphabetic character in a string. */
|
int first_alpha(const char *string, const char *exempt)
|
/* Return the position of the first alphabetic character in a string. */
int first_alpha(const char *string, const char *exempt)
|
{
int i, in_paren = 0, c;
for (i = 0; i < strlen(string); i++) {
c = tolower((int)string[i]);
if (strchr("<[(", c))
++in_paren;
if (strchr(">])", c) && in_paren > 0)
--in_paren;
if ((!in_paren) && isalpha(c) && strchr(exempt, c) == 0)
return i;
}
return 0;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* This function uses tomoyo_alloc(), so the caller must call tomoyo_free() if this function didn't return NULL. */
|
static const char* tomoyo_get_exe(void)
|
/* This function uses tomoyo_alloc(), so the caller must call tomoyo_free() if this function didn't return NULL. */
static const char* tomoyo_get_exe(void)
|
{
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
const char *cp = NULL;
if (!mm)
return NULL;
down_read(&mm->mmap_sem);
for (vma = mm->mmap; vma; vma = vma->vm_next) {
if ((vma->vm_flags & VM_EXECUTABLE) && vma->vm_file) {
cp = tomoyo_realpath_from_path(&vma->vm_file->f_path);
break;
}
}
up_read(&mm->mmap_sem);
return cp;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Return value: ibmvfc_target struct / NULL if not found */
|
static struct ibmvfc_target* ibmvfc_get_target(struct scsi_target *starget)
|
/* Return value: ibmvfc_target struct / NULL if not found */
static struct ibmvfc_target* ibmvfc_get_target(struct scsi_target *starget)
|
{
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
struct ibmvfc_target *tgt;
unsigned long flags;
spin_lock_irqsave(shost->host_lock, flags);
tgt = __ibmvfc_get_target(starget);
spin_unlock_irqrestore(shost->host_lock, flags);
return tgt;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* LOCKING: Defined by SCSI layer. We don't really care. */
|
int ata_scsi_slave_config(struct scsi_device *sdev)
|
/* LOCKING: Defined by SCSI layer. We don't really care. */
int ata_scsi_slave_config(struct scsi_device *sdev)
|
{
struct ata_port *ap = ata_shost_to_port(sdev->host);
struct ata_device *dev = __ata_scsi_find_dev(ap, sdev);
int rc = 0;
ata_scsi_sdev_config(sdev);
if (dev)
rc = ata_scsi_dev_config(sdev, dev);
return rc;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.