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
|
|---|---|---|---|---|---|---|---|
/* Check whether the specified ADC flag is set or not. */
|
flag_status_t ald_adc_get_flag_status(ald_adc_handle_t *hperh, ald_adc_flag_t flag)
|
/* Check whether the specified ADC flag is set or not. */
flag_status_t ald_adc_get_flag_status(ald_adc_handle_t *hperh, ald_adc_flag_t flag)
|
{
assert_param(IS_ADC_TYPE(hperh->perh));
assert_param(IS_ADC_FLAGS_TYPE(flag));
if (READ_BIT(hperh->perh->STAT, flag))
return SET;
return RESET;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The function is used to Set Bus Clock. */
|
void SysCtlBusClkSet(unsigned long ulBusClk)
|
/* The function is used to Set Bus Clock. */
void SysCtlBusClkSet(unsigned long ulBusClk)
|
{
unsigned long ulHclk = 0, ulSysDiv;
xASSERT((ulBusClk > 0 && ulBusClk <= 24000000));
ulHclk = SysCtlHClockGet();
if (ulBusClk <= ulHclk)
{
xASSERT(ulBusClk <= ulHclk);
for(ulSysDiv = 1; ulSysDiv < 8; ulSysDiv++)
{
if((ulHclk / (ulSysDiv + 1)) <= ulBusClk)
{
break;
}
}
xHWREG(SIM_CLKDIV1) &= ~SIM_CLKDIV1_OUTDIV4_M;
xHWREG(SIM_CLKDIV1) |= (ulSysDiv << SIM_CLKDIV1_OUTDIV4_S);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* In particular, the fast memcpy routine is like this. It's fix-up is just to fall back to a slow byte-at-a-time copy, which is handled the conventional way. So it's functionally OK to just handle any trap occurring in the fast memcpy with that fixup. */
|
static const struct exception_table_entry* check_exception_ranges(unsigned long addr)
|
/* In particular, the fast memcpy routine is like this. It's fix-up is just to fall back to a slow byte-at-a-time copy, which is handled the conventional way. So it's functionally OK to just handle any trap occurring in the fast memcpy with that fixup. */
static const struct exception_table_entry* check_exception_ranges(unsigned long addr)
|
{
if ((addr >= (unsigned long)©_user_memcpy) &&
(addr <= (unsigned long)©_user_memcpy_end))
return &__copy_user_fixup_ex;
return NULL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Initialize clock management protocol and install protocol on a given handle. */
|
EFI_STATUS ScmiClockProtocolInit(IN EFI_HANDLE *Handle)
|
/* Initialize clock management protocol and install protocol on a given handle. */
EFI_STATUS ScmiClockProtocolInit(IN EFI_HANDLE *Handle)
|
{
return gBS->InstallMultipleProtocolInterfaces (
Handle,
&gArmScmiClockProtocolGuid,
&ScmiClockProtocol,
&gArmScmiClock2ProtocolGuid,
&ScmiClock2Protocol,
NULL
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns -1 in case of error, 0 otherwise, in any case @buffer is freed */
|
int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer)
|
/* Returns -1 in case of error, 0 otherwise, in any case @buffer is freed */
int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer)
|
{
xmlBufferFree(buffer);
return(-1);
}
CHECK_COMPAT(buf)
if ((buffer != NULL) && (buffer->content != NULL) &&
(buffer->use > 0)) {
ret = xmlBufAdd(buf, buffer->content, buffer->use);
}
xmlBufferFree(buffer);
return(ret);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Insert a blocked lock into the global list */
|
static void nlmsvc_insert_block(struct nlm_block *block, unsigned long)
|
/* Insert a blocked lock into the global list */
static void nlmsvc_insert_block(struct nlm_block *block, unsigned long)
|
{
struct nlm_block *b;
struct list_head *pos;
dprintk("lockd: nlmsvc_insert_block(%p, %ld)\n", block, when);
if (list_empty(&block->b_list)) {
kref_get(&block->b_count);
} else {
list_del_init(&block->b_list);
}
pos = &nlm_blocked;
if (when != NLM_NEVER) {
if ((when += jiffies) == NLM_NEVER)
when ++;
list_for_each(pos, &nlm_blocked) {
b = list_entry(pos, struct nlm_block, b_list);
if (time_after(b->b_when,when) || b->b_when == NLM_NEVER)
break;
}
}
list_add_tail(&block->b_list, pos);
block->b_when = when;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Queries the memory controller for the possible regions that will support SMRAM. */
|
STATIC EFI_STATUS EFIAPI SmmAccessPeiGetCapabilities(IN EFI_PEI_SERVICES **PeiServices, IN PEI_SMM_ACCESS_PPI *This, IN OUT UINTN *SmramMapSize, IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap)
|
/* Queries the memory controller for the possible regions that will support SMRAM. */
STATIC EFI_STATUS EFIAPI SmmAccessPeiGetCapabilities(IN EFI_PEI_SERVICES **PeiServices, IN PEI_SMM_ACCESS_PPI *This, IN OUT UINTN *SmramMapSize, IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap)
|
{
return SmramAccessGetCapabilities (
This->LockState,
This->OpenState,
SmramMapSize,
SmramMap
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Message: RegisterRejectMessage Opcode: 0x009d Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */
|
static void handle_RegisterRejectMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
/* Message: RegisterRejectMessage Opcode: 0x009d Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */
static void handle_RegisterRejectMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
{
ptvcursor_add(cursor, hf_skinny_text, 32, ENC_ASCII|ENC_NA);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Enable use of MSG_PEEK when reading from socket */
|
void nl_socket_enable_msg_peek(struct nl_sock *sk)
|
/* Enable use of MSG_PEEK when reading from socket */
void nl_socket_enable_msg_peek(struct nl_sock *sk)
|
{
sk->s_flags |= NL_MSG_PEEK;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* When the buffer is no longer used, free it with usb_buffer_free(). */
|
void* usb_buffer_alloc(struct usb_device *dev, size_t size, gfp_t mem_flags, dma_addr_t *dma)
|
/* When the buffer is no longer used, free it with usb_buffer_free(). */
void* usb_buffer_alloc(struct usb_device *dev, size_t size, gfp_t mem_flags, dma_addr_t *dma)
|
{
if (!dev || !dev->bus)
return NULL;
return hcd_buffer_alloc(dev->bus, size, mem_flags, dma);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initialize the core and memory buck converters.
This function is intended to be used for first time core and memory buck converters initialization. */
|
void am_hal_pwrctrl_bucks_init(void)
|
/* Initialize the core and memory buck converters.
This function is intended to be used for first time core and memory buck converters initialization. */
void am_hal_pwrctrl_bucks_init(void)
|
{
am_hal_pwrctrl_bucks_enable();
while ( ( AM_REG(PWRCTRL, POWERSTATUS) &
( AM_REG_PWRCTRL_POWERSTATUS_COREBUCKON_M |
AM_REG_PWRCTRL_POWERSTATUS_MEMBUCKON_M ) ) !=
( AM_REG_PWRCTRL_POWERSTATUS_COREBUCKON_M |
AM_REG_PWRCTRL_POWERSTATUS_MEMBUCKON_M ) );
am_hal_flash_delay(200 / 3);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This API configures ADC module to be ready for convert the input from selected channel. */
|
void ADC_Open(ADC_T *adc, uint32_t u32InputMode, uint32_t u32OpMode, uint32_t u32ChMask)
|
/* This API configures ADC module to be ready for convert the input from selected channel. */
void ADC_Open(ADC_T *adc, uint32_t u32InputMode, uint32_t u32OpMode, uint32_t u32ChMask)
|
{
uint32_t u32Ch = 0, i;
if (u32InputMode == ADC_INPUT_MODE_NORMAL_CONV)
{
for (i = 0; i < ADC_CH_NUM; i++)
{
if (u32ChMask & (1 << i))
{
u32Ch = i;
break;
}
}
adc->CONF = (u32Ch << ADC_CONF_CHSEL_Pos) | u32OpMode | ADC_CONF_NACEN_Msk;
}
else if (u32InputMode == ADC_INPUT_MODE_4WIRE_TOUCH)
{
adc->CONF = 0;
}
else
{
adc->CTL |= ADC_CTL_WMSWCH_Msk;
adc->CONF = 0;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Prepare a MMC request. This just filters out odd stuff. */
|
static int mmc_prep_request(struct request_queue *q, struct request *req)
|
/* Prepare a MMC request. This just filters out odd stuff. */
static int mmc_prep_request(struct request_queue *q, struct request *req)
|
{
if (!blk_fs_request(req)) {
blk_dump_rq_flags(req, "MMC bad request");
return BLKPREP_KILL;
}
req->cmd_flags |= REQ_DONTPREP;
return BLKPREP_OK;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Adds a region of memory to the descriptor ring. Note that it may take multiple descriptors for each region of memory. It is the callers responsibility to allocate a sufficiently large descriptor ring. */
|
int dma_add_descriptors(DMA_DescriptorRing_t *ring, DMA_Device_t device, dma_addr_t srcData, dma_addr_t dstData, size_t numBytes)
|
/* Adds a region of memory to the descriptor ring. Note that it may take multiple descriptors for each region of memory. It is the callers responsibility to allocate a sufficiently large descriptor ring. */
int dma_add_descriptors(DMA_DescriptorRing_t *ring, DMA_Device_t device, dma_addr_t srcData, dma_addr_t dstData, size_t numBytes)
|
{
int rc;
DMA_DeviceAttribute_t *devAttr;
if (!IsDeviceValid(device)) {
return -ENODEV;
}
devAttr = &DMA_gDeviceAttribute[device];
rc = dmacHw_setDataDescriptor(&devAttr->config,
ring->virtAddr,
(void *)srcData,
(void *)dstData, numBytes);
if (rc < 0) {
printk(KERN_ERR
"dma_add_descriptors: dmacHw_setDataDescriptor failed with code: %d\n",
rc);
return -ENOMEM;
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Configure Timer Counter 0 to generate an interrupt every 200ms. */
|
static void configure_tc(void)
|
/* Configure Timer Counter 0 to generate an interrupt every 200ms. */
static void configure_tc(void)
|
{
uint32_t ul_div;
uint32_t ul_tcclks;
uint32_t ul_sysclk = sysclk_get_cpu_hz();
sysclk_enable_peripheral_clock(TC0);
if (!tc_find_mck_divisor(5, ul_sysclk, &ul_div, &ul_tcclks, ul_sysclk)) {
puts("No valid divisor found!\r");
return;
}
tc_init(TC0, 0, ul_tcclks | TC_CMR_CPCTRG);
tc_write_rc(TC0, 0, (ul_sysclk / ul_div) / 5);
NVIC_EnableIRQ((IRQn_Type) TC00_IRQn);
tc_enable_interrupt(TC0, 0, TC_IER_CPCS);
tc_start(TC0, 0);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Dispatch the display to the next page based on NewPageId. */
|
VOID UpdatePageId(BMM_CALLBACK_DATA *Private, UINT16 NewPageId)
|
/* Dispatch the display to the next page based on NewPageId. */
VOID UpdatePageId(BMM_CALLBACK_DATA *Private, UINT16 NewPageId)
|
{
if ((NewPageId < FILE_OPTION_OFFSET) && (NewPageId >= HANDLE_OPTION_OFFSET)) {
NewPageId = FORM_DRV_ADD_HANDLE_DESC_ID;
} else if ((NewPageId == KEY_VALUE_SAVE_AND_EXIT) || (NewPageId == KEY_VALUE_NO_SAVE_AND_EXIT)) {
NewPageId = FORM_MAIN_ID;
} else if ((NewPageId >= TERMINAL_OPTION_OFFSET) && (NewPageId < CONSOLE_OPTION_OFFSET)) {
NewPageId = FORM_CON_COM_SETUP_ID;
}
if ((NewPageId > 0) && (NewPageId < MAXIMUM_FORM_ID)) {
Private->BmmPreviousPageId = Private->BmmCurrentPageId;
Private->BmmCurrentPageId = NewPageId;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* brief Returns instance number for USART peripheral base address. */
|
uint32_t USART_GetInstance(USART_Type *base)
|
/* brief Returns instance number for USART peripheral base address. */
uint32_t USART_GetInstance(USART_Type *base)
|
{
uint32_t i;
for (i = 0; i < (uint32_t)FSL_FEATURE_SOC_USART_COUNT; i++)
{
if ((uint32_t)base == s_usartBaseAddrs[i])
{
break;
}
}
assert(i < FSL_FEATURE_SOC_USART_COUNT);
return i;
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* This service enables a given PEIM to register an interface into the PEI Foundation. */
|
EFI_STATUS EFIAPI PeiServicesInstallPpi(IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList)
|
/* This service enables a given PEIM to register an interface into the PEI Foundation. */
EFI_STATUS EFIAPI PeiServicesInstallPpi(IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList)
|
{
CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->InstallPpi (PeiServices, PpiList);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* enable or disable channel capture/compare control shadow register */
|
void timer_channel_control_shadow_config(uint32_t timer_periph, ControlStatus newvalue)
|
/* enable or disable channel capture/compare control shadow register */
void timer_channel_control_shadow_config(uint32_t timer_periph, ControlStatus newvalue)
|
{
if(ENABLE == newvalue){
TIMER_CTL1(timer_periph) |= (uint32_t)TIMER_CTL1_CCSE;
}else{
TIMER_CTL1(timer_periph) &= (~(uint32_t)TIMER_CTL1_CCSE);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* pm8001_task_prep_ssp_tm - the dispatcher function, prepare task management data @pm8001_ha: our hba card information @ccb: the ccb which attached to TM @tmf: the task management IU */
|
static int pm8001_task_prep_ssp_tm(struct pm8001_hba_info *pm8001_ha, struct pm8001_ccb_info *ccb, struct pm8001_tmf_task *tmf)
|
/* pm8001_task_prep_ssp_tm - the dispatcher function, prepare task management data @pm8001_ha: our hba card information @ccb: the ccb which attached to TM @tmf: the task management IU */
static int pm8001_task_prep_ssp_tm(struct pm8001_hba_info *pm8001_ha, struct pm8001_ccb_info *ccb, struct pm8001_tmf_task *tmf)
|
{
return PM8001_CHIP_DISP->ssp_tm_req(pm8001_ha, ccb, tmf);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Restart the card from scratch, as if from a cold-boot. At this point, the card has exprienced a hard reset, followed by fixups by BIOS, and has its config space set up identically to what it was at cold boot. */
|
static pci_ers_result_t vxge_io_slot_reset(struct pci_dev *pdev)
|
/* Restart the card from scratch, as if from a cold-boot. At this point, the card has exprienced a hard reset, followed by fixups by BIOS, and has its config space set up identically to what it was at cold boot. */
static pci_ers_result_t vxge_io_slot_reset(struct pci_dev *pdev)
|
{
struct __vxge_hw_device *hldev =
(struct __vxge_hw_device *) pci_get_drvdata(pdev);
struct net_device *netdev = hldev->ndev;
struct vxgedev *vdev = netdev_priv(netdev);
if (pci_enable_device(pdev)) {
printk(KERN_ERR "%s: "
"Cannot re-enable device after reset\n",
VXGE_DRIVER_NAME);
return PCI_ERS_RESULT_DISCONNECT;
}
pci_set_master(pdev);
vxge_reset(vdev);
return PCI_ERS_RESULT_RECOVERED;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns second word of the unique device identifier (UID based on 96 bits) */
|
u32 Get_ChipsetUIDw1(void)
|
/* Returns second word of the unique device identifier (UID based on 96 bits) */
u32 Get_ChipsetUIDw1(void)
|
{
return(READ_REG(*((vu32*)(UID_BASE + 4U))));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Called on a new task very soon before adding it to the tasklist. No need to take any locks since no-one can be operating on this task. */
|
void cgroup_fork_callbacks(struct task_struct *child)
|
/* Called on a new task very soon before adding it to the tasklist. No need to take any locks since no-one can be operating on this task. */
void cgroup_fork_callbacks(struct task_struct *child)
|
{
if (need_forkexit_callback) {
int i;
for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
if (ss->fork)
ss->fork(ss, child);
}
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function is called when user wants to create a connection to a peer host. */
|
static int winc1500_connect(struct net_context *context, const struct sockaddr *addr, socklen_t addrlen, net_context_connect_cb_t cb, int32_t timeout, void *user_data)
|
/* This function is called when user wants to create a connection to a peer host. */
static int winc1500_connect(struct net_context *context, const struct sockaddr *addr, socklen_t addrlen, net_context_connect_cb_t cb, int32_t timeout, void *user_data)
|
{
SOCKET socket = (int)context->offload_context;
int ret;
w1500_data.socket_data[socket].connect_cb = cb;
w1500_data.socket_data[socket].connect_user_data = user_data;
w1500_data.socket_data[socket].ret_code = 0;
ret = connect(socket, (struct sockaddr *)addr, addrlen);
if (ret) {
LOG_ERR("connect error %d %s!",
ret, socket_error_string(ret));
return ret;
}
if (timeout != 0 &&
k_sem_take(&w1500_data.socket_data[socket].wait_sem, K_MSEC(timeout))) {
return -ETIMEDOUT;
}
return w1500_data.socket_data[socket].ret_code;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Description: Process a user generated ACCEPT message and set the accept flag accordingly. Returns zero on success, negative values on failure. */
|
static int netlbl_unlabel_accept(struct sk_buff *skb, struct genl_info *info)
|
/* Description: Process a user generated ACCEPT message and set the accept flag accordingly. Returns zero on success, negative values on failure. */
static int netlbl_unlabel_accept(struct sk_buff *skb, struct genl_info *info)
|
{
u8 value;
struct netlbl_audit audit_info;
if (info->attrs[NLBL_UNLABEL_A_ACPTFLG]) {
value = nla_get_u8(info->attrs[NLBL_UNLABEL_A_ACPTFLG]);
if (value == 1 || value == 0) {
netlbl_netlink_auditinfo(skb, &audit_info);
netlbl_unlabel_acceptflg_set(value, &audit_info);
return 0;
}
}
return -EINVAL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* rewrite the time-stamp of the event record with the curren time of the given queue. return non-zero if updated. */
|
static int update_timestamp_of_queue(struct snd_seq_event *event, int queue, int real_time)
|
/* rewrite the time-stamp of the event record with the curren time of the given queue. return non-zero if updated. */
static int update_timestamp_of_queue(struct snd_seq_event *event, int queue, int real_time)
|
{
struct snd_seq_queue *q;
q = queueptr(queue);
if (! q)
return 0;
event->queue = queue;
event->flags &= ~SNDRV_SEQ_TIME_STAMP_MASK;
if (real_time) {
event->time.time = snd_seq_timer_get_cur_time(q->timer);
event->flags |= SNDRV_SEQ_TIME_STAMP_REAL;
} else {
event->time.tick = snd_seq_timer_get_cur_tick(q->timer);
event->flags |= SNDRV_SEQ_TIME_STAMP_TICK;
}
queuefree(q);
return 1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base Pointer to the FLEXIO_CAMERA_Type. param handle Pointer to the flexio_camera_edma_handle_t structure. */
|
void FLEXIO_CAMERA_TransferAbortReceiveEDMA(FLEXIO_CAMERA_Type *base, flexio_camera_edma_handle_t *handle)
|
/* param base Pointer to the FLEXIO_CAMERA_Type. param handle Pointer to the flexio_camera_edma_handle_t structure. */
void FLEXIO_CAMERA_TransferAbortReceiveEDMA(FLEXIO_CAMERA_Type *base, flexio_camera_edma_handle_t *handle)
|
{
assert(handle->rxEdmaHandle);
FLEXIO_CAMERA_EnableRxDMA(base, false);
EDMA_StopTransfer(handle->rxEdmaHandle);
handle->rxState = kFLEXIO_CAMERA_RxIdle;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
|
EFI_STATUS EFIAPI Mtftp4ComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
|
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI Mtftp4ComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
|
{
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mMtftp4DriverNameTable,
DriverName,
(BOOLEAN)(This == &gMtftp4ComponentName)
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function is called by the lpfc_get_cfgparam() routine to set the module lpfc_log_verbose into the @phba cfg_log_verbose for use with log messsage according to the module's lpfc_log_verbose parameter setting before hba port or vport created. */
|
static void lpfc_hba_log_verbose_init(struct lpfc_hba *phba, uint32_t verbose)
|
/* This function is called by the lpfc_get_cfgparam() routine to set the module lpfc_log_verbose into the @phba cfg_log_verbose for use with log messsage according to the module's lpfc_log_verbose parameter setting before hba port or vport created. */
static void lpfc_hba_log_verbose_init(struct lpfc_hba *phba, uint32_t verbose)
|
{
phba->cfg_log_verbose = verbose;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function disables the wakeup function of USCI_I2C module. */
|
void UI2C_DisableWakeup(UI2C_T *ui2c)
|
/* This function disables the wakeup function of USCI_I2C module. */
void UI2C_DisableWakeup(UI2C_T *ui2c)
|
{
ui2c->WKCTL &= ~UI2C_WKCTL_WKEN_Msk;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Gets the 8-bit manufacturer ID and device ID for the flash. */
|
void spiflashGetManufacturerInfo(uint8_t *manufID, uint8_t *deviceID)
|
/* Gets the 8-bit manufacturer ID and device ID for the flash. */
void spiflashGetManufacturerInfo(uint8_t *manufID, uint8_t *deviceID)
|
{
if (!_w25q16bvInitialised) spiflashInit();
W25Q16BV_SELECT();
w25q16bv_TransferByte(W25Q16BV_CMD_MANUFDEVID);
w25q16bv_TransferByte(0x00);
w25q16bv_TransferByte(0x00);
w25q16bv_TransferByte(0x00);
*manufID = w25q16bv_TransferByte(0xFF);
*deviceID = w25q16bv_TransferByte(0xFF);
W25Q16BV_DESELECT();
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* Selects the TIM Group Channel 5 and Channel 1, OC1REFC is the logical AND of OC1REFC and OC5REF. */
|
void TIM_SelectGC5C1(TIM_TypeDef *TIMx, FunctionalState NewState)
|
/* Selects the TIM Group Channel 5 and Channel 1, OC1REFC is the logical AND of OC1REFC and OC5REF. */
void TIM_SelectGC5C1(TIM_TypeDef *TIMx, FunctionalState NewState)
|
{
assert_param(IS_TIM_LIST4_PERIPH(TIMx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
TIMx->CCR5 |= TIM_CCR5_GC5C1;
}
else
{
TIMx->CCR5 &= (uint32_t)~TIM_CCR5_GC5C1;
}
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Call the browser and display the front page */
|
EFI_STATUS CallFrontPage(VOID)
|
/* Call the browser and display the front page */
EFI_STATUS CallFrontPage(VOID)
|
{
EFI_STATUS Status;
EFI_BROWSER_ACTION_REQUEST ActionRequest;
REPORT_STATUS_CODE (
EFI_PROGRESS_CODE,
(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT)
);
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
Status = gFormBrowser2->SendForm (
gFormBrowser2,
&gFrontPagePrivate.HiiHandle,
1,
&mFrontPageGuid,
0,
NULL,
&ActionRequest
);
if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {
EnableResetRequired ();
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If String has only pad spaces, then 0 is returned. If String has no pad spaces or valid decimal digits, then 0 is returned. */
|
EFI_STATUS InternalShellStrDecimalToUint64(IN CONST CHAR16 *String, OUT UINT64 *Value, IN CONST BOOLEAN StopAtSpace)
|
/* If String has only pad spaces, then 0 is returned. If String has no pad spaces or valid decimal digits, then 0 is returned. */
EFI_STATUS InternalShellStrDecimalToUint64(IN CONST CHAR16 *String, OUT UINT64 *Value, IN CONST BOOLEAN StopAtSpace)
|
{
UINT64 Result;
if ((String == NULL) || (StrSize (String) == 0) || (Value == NULL)) {
return (EFI_INVALID_PARAMETER);
}
while ((*String == L' ') || (*String == L'\t')) {
String++;
}
while (*String == L'0') {
String++;
}
Result = 0;
if (StopAtSpace && (*String == L' ')) {
*Value = Result;
return (EFI_SUCCESS);
}
while (ShellIsDecimalDigitCharacter (*String)) {
if (!(Result <= (DivU64x32 ((((UINT64) ~0) - (*String - L'0')), 10)))) {
return (EFI_DEVICE_ERROR);
}
Result = MultU64x32 (Result, 10) + (*String - L'0');
String++;
if (StopAtSpace && (*String == L' ')) {
break;
}
}
*Value = Result;
return (EFI_SUCCESS);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Unregisters an interrupt handler for the SHA/MD5 module. */
|
void SHAMD5IntUnregister(uint32_t ui32Base)
|
/* Unregisters an interrupt handler for the SHA/MD5 module. */
void SHAMD5IntUnregister(uint32_t ui32Base)
|
{
ASSERT(ui32Base == SHAMD5_BASE);
IntDisable(INT_SHA);
IntUnregister(INT_SHA);
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* Writes the given value in the status register of the serial flash device. */
|
static void s25fl1xx_write_volatile_status(struct qspid_t *qspid, uint8_t *status)
|
/* Writes the given value in the status register of the serial flash device. */
static void s25fl1xx_write_volatile_status(struct qspid_t *qspid, uint8_t *status)
|
{
s25fl1xx_exec_command(qspid, 0x50, 0, 0 , QSPI_CMD_ACCESS, 0);
s25fl1xx_exec_command(qspid, S25FL1XX_WRITE_STATUS, (uint32_t *)status, 0 , QSPI_WRITE_ACCESS, 3);
s25fl1xx_disable_write(qspid);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* DAC Channel Output Buffer Disable.
Disable a digital to analog converter channel output drive buffer. Disabling this will reduce power consumption slightly and will increase the output impedance of the DAC. The buffers are enabled by default after a reset. */
|
void dac_buffer_disable(uint32_t dac, int channel)
|
/* DAC Channel Output Buffer Disable.
Disable a digital to analog converter channel output drive buffer. Disabling this will reduce power consumption slightly and will increase the output impedance of the DAC. The buffers are enabled by default after a reset. */
void dac_buffer_disable(uint32_t dac, int channel)
|
{
switch (channel) {
case DAC_CHANNEL1:
DAC_CR(dac) |= DAC_CR_BOFF1;
break;
case DAC_CHANNEL2:
DAC_CR(dac) |= DAC_CR_BOFF2;
break;
case DAC_CHANNEL_BOTH:
DAC_CR(dac) |= (DAC_CR_BOFF1 | DAC_CR_BOFF2);
break;
}
}
/**@}
|
libopencm3/libopencm3
|
C++
|
GNU General Public License v3.0
| 2,931
|
/* Returns the endpoint interrupt status on a given USB controller. */
|
uint32_t USBIntStatusEndpoint(uint32_t ui32Base)
|
/* Returns the endpoint interrupt status on a given USB controller. */
uint32_t USBIntStatusEndpoint(uint32_t ui32Base)
|
{
uint32_t ui32Status;
ASSERT(ui32Base == USB0_BASE);
ui32Status = HWREGH(ui32Base + USB_O_TXIS);
ui32Status |= ((uint32_t)HWREGH(ui32Base + USB_O_RXIS) << USB_INTEP_RX_SHIFT);
return(ui32Status);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* if the callback is broken on this vnode, then the lock may now be available */
|
void afs_lock_may_be_available(struct afs_vnode *vnode)
|
/* if the callback is broken on this vnode, then the lock may now be available */
void afs_lock_may_be_available(struct afs_vnode *vnode)
|
{
_enter("{%x:%u}", vnode->fid.vid, vnode->fid.vnode);
queue_delayed_work(afs_lock_manager, &vnode->lock_work, 0);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* @pool: FPA pool to free @size: Size of each buffer in the pool @elements: Number of buffers that should be in the pool */
|
static void cvm_oct_free_hw_memory(int pool, int size, int elements)
|
/* @pool: FPA pool to free @size: Size of each buffer in the pool @elements: Number of buffers that should be in the pool */
static void cvm_oct_free_hw_memory(int pool, int size, int elements)
|
{
if (USE_32BIT_SHARED) {
pr_warning("Warning: 32 shared memory is not freeable\n");
} else {
char *memory;
do {
memory = cvmx_fpa_alloc(pool);
if (memory) {
elements--;
kfree(phys_to_virt(cvmx_ptr_to_phys(memory)));
}
} while (memory);
if (elements < 0)
pr_warning("Freeing of pool %u had too many "
"buffers (%d)\n",
pool, elements);
else if (elements > 0)
pr_warning("Warning: Freeing of pool %u is "
"missing %d buffers\n",
pool, elements);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* LTDC MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
|
/* LTDC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
|
{
if(hltdc->Instance==LTDC)
{
__HAL_RCC_LTDC_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOI, GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15);
HAL_GPIO_DeInit(GPIOJ, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15);
HAL_GPIO_DeInit(GPIOK, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Get the number of multi-dimensional axis controls on a joystick */
|
int SDL_JoystickNumAxes(SDL_Joystick *joystick)
|
/* Get the number of multi-dimensional axis controls on a joystick */
int SDL_JoystickNumAxes(SDL_Joystick *joystick)
|
{
if ( ! ValidJoystick(&joystick) ) {
return(-1);
}
return(joystick->naxes);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* In TDX a serial of TdIoWrite8 is invoked to write data to the I/O port. */
|
VOID EFIAPI IoWriteFifo8(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
|
/* In TDX a serial of TdIoWrite8 is invoked to write data to the I/O port. */
VOID EFIAPI IoWriteFifo8(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
|
{
if (IsTdxGuest ()) {
TdIoWriteFifo8 (Port, Count, Buffer);
} else {
SevIoWriteFifo8 (Port, Count, Buffer);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base LCDIF v2 peripheral base address. param layerIndex Which layer to set. param lutData The LUT data to load. param count Count of lutData. retval kStatus_Success Set success. retval kStatus_Fail Previous LUT data is not loaded to hardware yet. */
|
status_t LCDIFV2_SetLut(LCDIFV2_Type *base, uint8_t layerIndex, const uint32_t *lutData, uint16_t count, bool useShadowLoad)
|
/* param base LCDIF v2 peripheral base address. param layerIndex Which layer to set. param lutData The LUT data to load. param count Count of lutData. retval kStatus_Success Set success. retval kStatus_Fail Previous LUT data is not loaded to hardware yet. */
status_t LCDIFV2_SetLut(LCDIFV2_Type *base, uint8_t layerIndex, const uint32_t *lutData, uint16_t count, bool useShadowLoad)
|
{
assert(count <= LCDIFV2_LUT_ENTRY_NUM);
uint16_t i;
status_t status;
if ((base->CLUT_LOAD & LCDIFV2_CLUT_LOAD_CLUT_UPDATE_EN_MASK) != 0U)
{
status = kStatus_Fail;
}
else
{
if (useShadowLoad)
{
base->CLUT_LOAD = LCDIFV2_CLUT_LOAD_SEL_CLUT_NUM(layerIndex) | LCDIFV2_CLUT_LOAD_CLUT_UPDATE_EN_MASK;
}
else
{
base->CLUT_LOAD = LCDIFV2_CLUT_LOAD_SEL_CLUT_NUM(layerIndex);
}
for (i = 0; i < count; i++)
{
(LCDIFV2_LUT_MEM(base))[i + LCDIFV2_LUT_ENTRY_NUM * layerIndex] = lutData[i];
}
status = kStatus_Success;
}
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Initializes DMA channel used by the I2C EEPROM driver. */
|
void sEE_LowLevel_DMAConfig(uint32_t pBuffer, uint32_t BufferSize, uint32_t Direction)
|
/* Initializes DMA channel used by the I2C EEPROM driver. */
void sEE_LowLevel_DMAConfig(uint32_t pBuffer, uint32_t BufferSize, uint32_t Direction)
|
{
if (Direction == sEE_DIRECTION_TX)
{
sEEDMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)pBuffer;
sEEDMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
sEEDMA_InitStructure.DMA_BufferSize = (uint32_t)BufferSize;
DMA_Init(sEE_I2C_DMA_CHANNEL_TX, &sEEDMA_InitStructure);
}
else
{
sEEDMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)pBuffer;
sEEDMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
sEEDMA_InitStructure.DMA_BufferSize = (uint32_t)BufferSize;
DMA_Init(sEE_I2C_DMA_CHANNEL_RX, &sEEDMA_InitStructure);
}
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* Returns current physical destination address for the given DMA channel. If the channel is running the caller must disable interrupts prior calling this function and process the returned value before re-enabling interrupt to prevent races with the interrupt handler. Note that in continuous mode there is a chance for CDSA_L register overflow inbetween the two reads resulting in incorrect return value. */
|
dma_addr_t omap_get_dma_dst_pos(int lch)
|
/* Returns current physical destination address for the given DMA channel. If the channel is running the caller must disable interrupts prior calling this function and process the returned value before re-enabling interrupt to prevent races with the interrupt handler. Note that in continuous mode there is a chance for CDSA_L register overflow inbetween the two reads resulting in incorrect return value. */
dma_addr_t omap_get_dma_dst_pos(int lch)
|
{
dma_addr_t offset = 0;
if (cpu_is_omap15xx())
offset = dma_read(CPC(lch));
else
offset = dma_read(CDAC(lch));
if (!cpu_is_omap15xx() && offset == 0)
offset = dma_read(CDAC(lch));
if (cpu_class_is_omap1())
offset |= (dma_read(CDSA_U(lch)) << 16);
return offset;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Returns 1 if SHPC finishes executing a command within 1 sec, otherwise returns 0. */
|
static int shpc_poll_ctrl_busy(struct controller *ctrl)
|
/* Returns 1 if SHPC finishes executing a command within 1 sec, otherwise returns 0. */
static int shpc_poll_ctrl_busy(struct controller *ctrl)
|
{
int i;
if (!is_ctrl_busy(ctrl))
return 1;
for (i = 0; i < 10; i++) {
msleep(100);
if (!is_ctrl_busy(ctrl))
return 1;
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Message: DialedNumberMessage Opcode: 0x011d Type: CallControl Direction: pbx2dev VarLength: no */
|
static void handle_DialedNumberMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
/* Message: DialedNumberMessage Opcode: 0x011d Type: CallControl Direction: pbx2dev VarLength: no */
static void handle_DialedNumberMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
{
guint32 hdr_version = tvb_get_letohl(ptvcursor_tvbuff(cursor), 4);
guint32 VariableDirnumSize = (hdr_version >= V18_MSG_TYPE) ? 25 : 24;
ptvcursor_add(cursor, hf_skinny_dialedNumber, VariableDirnumSize, ENC_ASCII|ENC_NA);
si->lineId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_lineInstance, 4, ENC_LITTLE_ENDIAN);
si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Displays the associated file and line informations for the current input */
|
void xmlParserPrintFileInfo(xmlParserInputPtr input)
|
/* Displays the associated file and line informations for the current input */
void xmlParserPrintFileInfo(xmlParserInputPtr input)
|
{
if (input->filename)
xmlGenericError(xmlGenericErrorContext,
"%s:%d: ", input->filename,
input->line);
else
xmlGenericError(xmlGenericErrorContext,
"Entity: line %d: ", input->line);
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* xfs_filestream_init() is called at xfs initialisation time to set up the memory zone that will be used for filestream data structure allocation. */
|
int xfs_filestream_init(void)
|
/* xfs_filestream_init() is called at xfs initialisation time to set up the memory zone that will be used for filestream data structure allocation. */
int xfs_filestream_init(void)
|
{
item_zone = kmem_zone_init(sizeof(fstrm_item_t), "fstrm_item");
if (!item_zone)
return -ENOMEM;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Fills each GPIO_InitStruct member with its default value. */
|
void GPIO_InitStruct(GPIO_InitType *GPIO_InitStruct)
|
/* Fills each GPIO_InitStruct member with its default value. */
void GPIO_InitStruct(GPIO_InitType *GPIO_InitStruct)
|
{
GPIO_InitStruct->Pin = GPIO_PIN_ALL;
GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN_FLOATING;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Select the cache configuration type.
This functions only sets the CACHECFG CONFIG field. */
|
void am_hal_cachectrl_cache_config(uint32_t ui32CacheConfig)
|
/* Select the cache configuration type.
This functions only sets the CACHECFG CONFIG field. */
void am_hal_cachectrl_cache_config(uint32_t ui32CacheConfig)
|
{
AM_REG(CACHECTRL, CACHECFG) &= ~AM_REG_CACHECTRL_CACHECFG_CONFIG_M;
AM_REG(CACHECTRL, CACHECFG) |= ui32CacheConfig &
AM_REG_CACHECTRL_CACHECFG_CONFIG_M;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Description: This function is designed to be used as a callback to the call_rcu() function so that memory allocated to a hash table port entry can be released safely. */
|
static void sel_netport_free(struct rcu_head *p)
|
/* Description: This function is designed to be used as a callback to the call_rcu() function so that memory allocated to a hash table port entry can be released safely. */
static void sel_netport_free(struct rcu_head *p)
|
{
struct sel_netport *port = container_of(p, struct sel_netport, rcu);
kfree(port);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Final actions when unmounting a file system. This will handle deallocation and release of our private data. */
|
static void ecryptfs_put_super(struct super_block *sb)
|
/* Final actions when unmounting a file system. This will handle deallocation and release of our private data. */
static void ecryptfs_put_super(struct super_block *sb)
|
{
struct ecryptfs_sb_info *sb_info = ecryptfs_superblock_to_private(sb);
lock_kernel();
ecryptfs_destroy_mount_crypt_stat(&sb_info->mount_crypt_stat);
kmem_cache_free(ecryptfs_sb_info_cache, sb_info);
ecryptfs_set_superblock_private(sb, NULL);
unlock_kernel();
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
|
void Vector49_handler(void)
|
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector49_handler(void)
|
{
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (49 * 2))
JMP 0,X
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Context switch functions. These are interrupt service routines. Manual context switch forced by calling portYIELD(). This is the SWI handler. */
|
void vPortYield(void)
|
/* Context switch functions. These are interrupt service routines. Manual context switch forced by calling portYIELD(). This is the SWI handler. */
void vPortYield(void)
|
{
portISR_HEAD();
portSAVE_CONTEXT();
vTaskSwitchContext();
portRESTORE_CONTEXT();
portISR_TAIL();
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Enables or disables the selected ADC software start conversion . */
|
void ADC_EnableSoftwareStartConv(ADC_Module *ADCx, FunctionalState Cmd)
|
/* Enables or disables the selected ADC software start conversion . */
void ADC_EnableSoftwareStartConv(ADC_Module *ADCx, FunctionalState Cmd)
|
{
assert_param(IsAdcModule(ADCx));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
ADCx->CTRL2 |= CTRL2_EXT_TRIG_SWSTART_SET;
}
else
{
ADCx->CTRL2 &= CTRL2_EXT_TRIG_SWSTART_RESET;
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* The 32KHz synchronized timer is an additional timer on 16xx. It is always running. */
|
static unsigned long omap_32k_sync_timer_read(void)
|
/* The 32KHz synchronized timer is an additional timer on 16xx. It is always running. */
static unsigned long omap_32k_sync_timer_read(void)
|
{
return omap_readl(TIMER_32K_SYNCHRONIZED);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* sysfs_chmod_file - update the modified mode value on an object attribute. @kobj: object we're acting for. @attr: attribute descriptor. @mode: file permissions. */
|
int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode)
|
/* sysfs_chmod_file - update the modified mode value on an object attribute. @kobj: object we're acting for. @attr: attribute descriptor. @mode: file permissions. */
int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode)
|
{
struct sysfs_dirent *sd;
struct iattr newattrs;
int rc;
mutex_lock(&sysfs_mutex);
rc = -ENOENT;
sd = sysfs_find_dirent(kobj->sd, attr->name);
if (!sd)
goto out;
newattrs.ia_mode = (mode & S_IALLUGO) | (sd->s_mode & ~S_IALLUGO);
newattrs.ia_valid = ATTR_MODE;
rc = sysfs_sd_setattr(sd, &newattrs);
out:
mutex_unlock(&sysfs_mutex);
return rc;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The function is used to configure a receive message object. */
|
int32_t CAN_SetRxMsg(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32IDType, uint32_t u32ID)
|
/* The function is used to configure a receive message object. */
int32_t CAN_SetRxMsg(CAN_T *tCAN, uint32_t u32MsgNum, uint32_t u32IDType, uint32_t u32ID)
|
{
uint32_t u32TimeOutCount = 0UL;
while(CAN_SetRxMsgObj(tCAN, (uint8_t)u32MsgNum, (uint8_t)u32IDType, u32ID, (uint8_t)TRUE) == (int32_t)FALSE)
{
if(++u32TimeOutCount >= RETRY_COUNTS)
{
return (int32_t)FALSE;
}
}
return (int32_t)TRUE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base USART peripheral base address. param handle USART handle pointer. */
|
void USART_TransferStopRingBuffer(USART_Type *base, usart_handle_t *handle)
|
/* param base USART peripheral base address. param handle USART handle pointer. */
void USART_TransferStopRingBuffer(USART_Type *base, usart_handle_t *handle)
|
{
assert(NULL != base);
assert(NULL != handle);
if (handle->rxState == (uint8_t)kUSART_RxIdle)
{
base->FIFOINTENCLR = USART_FIFOINTENCLR_RXLVL_MASK | USART_FIFOINTENCLR_RXERR_MASK;
}
handle->rxRingBuffer = NULL;
handle->rxRingBufferSize = 0U;
handle->rxRingBufferHead = 0U;
handle->rxRingBufferTail = 0U;
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* This routine returns the correct FP status register value in *status, based on the C-bit & V-bit returned by the FCMP emulation routine in new_status. The architecture type (PA83, PA89 or PA2.0) is available in fpu_type. The y_field and the architecture type are used to determine what flavor of FCMP is being emulated. */
|
static void update_status_cbit(u_int *, u_int, u_int, u_int)
|
/* This routine returns the correct FP status register value in *status, based on the C-bit & V-bit returned by the FCMP emulation routine in new_status. The architecture type (PA83, PA89 or PA2.0) is available in fpu_type. The y_field and the architecture type are used to determine what flavor of FCMP is being emulated. */
static void update_status_cbit(u_int *, u_int, u_int, u_int)
|
{
if ((fpu_type & TIMEX_EXTEN_FLAG) ||
(fpu_type & ROLEX_EXTEN_FLAG) ||
(fpu_type & PA2_0_FPU_FLAG)) {
if (y_field == 0) {
*status = ((*status & 0x04000000) >> 5) |
((*status & 0x003ff000) >> 1) |
(new_status & 0xffc007ff);
} else {
*status = (*status & 0x04000000) |
((new_status & 0x04000000) >> (y_field+4)) |
(new_status & ~0x04000000 &
~(0x04000000 >> (y_field+4)));
}
}
else {
*status = new_status;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Functions to read from/write to the mmio registers */
|
static u32 _aty_ld_le32(volatile unsigned int regindex, const struct aty128fb_par *par)
|
/* Functions to read from/write to the mmio registers */
static u32 _aty_ld_le32(volatile unsigned int regindex, const struct aty128fb_par *par)
|
{
return readl (par->regbase + regindex);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* @gpio: The numeric representation of the GPIO @desc: Returns description (desc->flags will always be 0) */
|
static int gpio_to_device(unsigned int gpio, struct gpio_desc *desc)
|
/* @gpio: The numeric representation of the GPIO @desc: Returns description (desc->flags will always be 0) */
static int gpio_to_device(unsigned int gpio, struct gpio_desc *desc)
|
{
struct gpio_dev_priv *uc_priv;
struct udevice *dev;
int ret;
for (ret = uclass_first_device(UCLASS_GPIO, &dev);
dev;
ret = uclass_next_device(&dev)) {
uc_priv = dev_get_uclass_priv(dev);
if (gpio >= uc_priv->gpio_base &&
gpio < uc_priv->gpio_base + uc_priv->gpio_count) {
gpio_desc_init(desc, dev, gpio - uc_priv->gpio_base);
return 0;
}
}
return ret ? ret : -ENOENT;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* start a charge-transfer sequence when TSI is in software trigger mode */
|
void tsi_software_start(void)
|
/* start a charge-transfer sequence when TSI is in software trigger mode */
void tsi_software_start(void)
|
{
TSI_CTL |= TSI_CTL_TSIS;
}
|
liuxuming/trochili
|
C++
|
Apache License 2.0
| 132
|
/* Cleans off leading and trailing spaces and tabs. */
|
STATIC EFI_STATUS TrimSpaces(IN CHAR16 *String)
|
/* Cleans off leading and trailing spaces and tabs. */
STATIC EFI_STATUS TrimSpaces(IN CHAR16 *String)
|
{
CHAR16 *Str;
UINTN Len;
ASSERT (String != NULL);
if (String == NULL) {
return EFI_INVALID_PARAMETER;
}
Str = String;
while (*Str == L' ' || *Str == L'\t') {
Str++;
}
do {
Len = StrLen (Str);
if (!Len || ((Str[Len - 1] != L' ') && (Str[Len - 1] != '\t'))) {
break;
}
Str[Len - 1] = CHAR_NULL;
} while (Len);
CopyMem (String, Str, StrSize (Str));
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Get the captured data from a sample sequence of injected channel. */
|
unsigned long ADCDataInjectedGet(unsigned long ulBase, unsigned long ulChannel)
|
/* Get the captured data from a sample sequence of injected channel. */
unsigned long ADCDataInjectedGet(unsigned long ulBase, unsigned long ulChannel)
|
{
unsigned long ulReturn = 0;
xASSERT((ulBase == ADC1_BASE) || (ulBase == ADC2_BASE) || (ulBase == ADC3_BASE));
xASSERT((ulChannel > 0) || (ulChannel < 5));
ulReturn = xHWREG(ulBase + ADC_JDR1 + (ulChannel-1)*4);
return ulReturn;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Get the frame counter and delay counter for both channels */
|
void XAxiVdma_ChannelGetFrmCnt(XAxiVdma_Channel *Channel, u8 *FrmCnt, u8 *DlyCnt)
|
/* Get the frame counter and delay counter for both channels */
void XAxiVdma_ChannelGetFrmCnt(XAxiVdma_Channel *Channel, u8 *FrmCnt, u8 *DlyCnt)
|
{
u32 CrBits;
if (!Channel->IsValid) {
PRINTF( "Channel not initialized\r\n");
*FrmCnt = 0;
return;
}
CrBits = XAxiVdma_ReadReg(Channel->ChanBase, XAXIVDMA_CR_OFFSET);
if (Channel->DbgFeatureFlags & XAXIVDMA_ENABLE_DBG_FRM_CNTR) {
*FrmCnt = (CrBits & XAXIVDMA_FRMCNT_MASK) >>
XAXIVDMA_FRMCNT_SHIFT;
} else {
PRINTF(
"Channel Frame counter is disabled\r\n");
}
if (Channel->DbgFeatureFlags & XAXIVDMA_ENABLE_DBG_DLY_CNTR) {
*DlyCnt = (CrBits & XAXIVDMA_DELAY_MASK) >>
XAXIVDMA_DELAY_SHIFT;
} else {
PRINTF(
"Channel Delay counter is disabled\r\n");
}
return;
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* Writes and returns a new value to DR4. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */
|
UINTN EFIAPI AsmWriteDr4(UINTN Dr4)
|
/* Writes and returns a new value to DR4. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmWriteDr4(UINTN Dr4)
|
{
__asm__ __volatile__ (
"movl %0, %%dr4"
:
: "r" (Dr4)
);
return Dr4;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set an output GPIO pin to the state specified (1, 0). Returns 0 on success, -EINVAL otherwise. */
|
int lpc178x_gpout_set(const struct lpc178x_gpio_dsc *dsc, int state)
|
/* Set an output GPIO pin to the state specified (1, 0). Returns 0 on success, -EINVAL otherwise. */
int lpc178x_gpout_set(const struct lpc178x_gpio_dsc *dsc, int state)
|
{
int rv;
rv = lpc178x_validate_gpio(dsc);
if (rv == 0) {
if (state)
LPC178X_GPIO(dsc->port)->fioset = (1 << dsc->pin);
else
LPC178X_GPIO(dsc->port)->fioclr = (1 << dsc->pin);
}
return rv;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* trun_remove_range - apply a replay entry for a truncation to the TNC. */
|
static int trun_remove_range(struct ubifs_info *c, struct replay_entry *r)
|
/* trun_remove_range - apply a replay entry for a truncation to the TNC. */
static int trun_remove_range(struct ubifs_info *c, struct replay_entry *r)
|
{
unsigned min_blk, max_blk;
union ubifs_key min_key, max_key;
ino_t ino;
min_blk = r->new_size / UBIFS_BLOCK_SIZE;
if (r->new_size & (UBIFS_BLOCK_SIZE - 1))
min_blk += 1;
max_blk = r->old_size / UBIFS_BLOCK_SIZE;
if ((r->old_size & (UBIFS_BLOCK_SIZE - 1)) == 0)
max_blk -= 1;
ino = key_inum(c, &r->key);
data_key_init(c, &min_key, ino, min_blk);
data_key_init(c, &max_key, ino, max_blk);
return ubifs_tnc_remove_range(c, &min_key, &max_key);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Enables the SLCD module.
Enables the SLCD module once it has been configured, ready for use. Most module configuration parameters cannot be altered while the module is enabled. */
|
void slcd_enable(void)
|
/* Enables the SLCD module.
Enables the SLCD module once it has been configured, ready for use. Most module configuration parameters cannot be altered while the module is enabled. */
void slcd_enable(void)
|
{
SLCD->CTRLA.reg |= SLCD_CTRLA_ENABLE;
while (slcd_is_syncing()) {
}
while (!slcd_get_vlcd_ready_status()) {
}
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Returns: 0: transport successfully registered -EEXIST: transport already registered -EINVAL: transport module being unloaded */
|
int xprt_register_transport(struct xprt_class *transport)
|
/* Returns: 0: transport successfully registered -EEXIST: transport already registered -EINVAL: transport module being unloaded */
int xprt_register_transport(struct xprt_class *transport)
|
{
struct xprt_class *t;
int result;
result = -EEXIST;
spin_lock(&xprt_list_lock);
list_for_each_entry(t, &xprt_list, list) {
if (t->ident == transport->ident)
goto out;
}
list_add_tail(&transport->list, &xprt_list);
printk(KERN_INFO "RPC: Registered %s transport module.\n",
transport->name);
result = 0;
out:
spin_unlock(&xprt_list_lock);
return result;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* sets the VLAN tag (the lower 3 bytes are the PVID) of a database filtering record
Note that this function is documented in the main component header file, IxEthDB.h. */
|
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBVlanTagSet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag vlanTag)
|
/* sets the VLAN tag (the lower 3 bytes are the PVID) of a database filtering record
Note that this function is documented in the main component header file, IxEthDB.h. */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBVlanTagSet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag vlanTag)
|
{
HashNode *searchResult;
MacDescriptor *descriptor;
IX_ETH_DB_CHECK_REFERENCE(macAddr);
IX_ETH_DB_CHECK_VLAN_TAG(vlanTag);
searchResult = ixEthDBSearch(macAddr, IX_ETH_DB_ALL_FILTERING_RECORDS);
if (searchResult == NULL)
{
return IX_ETH_DB_NO_SUCH_ADDR;
}
descriptor = (MacDescriptor *) searchResult->data;
descriptor->type = IX_ETH_DB_FILTERING_VLAN_RECORD;
descriptor->recordData.filteringVlanData.ieee802_1qTag = vlanTag;
ixEthDBReleaseHashNode(searchResult);
return IX_ETH_DB_SUCCESS;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Function for applying GATT Server & Client context.
Array of function pointers based on the types of service registered. */
|
static __INLINE ret_code_t gattsc_context_apply(dm_handle_t *p_handle)
|
/* Function for applying GATT Server & Client context.
Array of function pointers based on the types of service registered. */
static __INLINE ret_code_t gattsc_context_apply(dm_handle_t *p_handle)
|
{
uint32_t err_code;
DM_LOG("[DM]: --> gattsc_context_apply\r\n");
err_code = gatts_context_apply(p_handle);
if (err_code == NRF_SUCCESS)
{
err_code = gattc_context_apply(p_handle);
}
return err_code;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Free the resource related to the configure parameters. DHCP driver will make a copy of the user's configure such as the time out value. */
|
VOID DhcpCleanConfigure(IN OUT EFI_DHCP4_CONFIG_DATA *Config)
|
/* Free the resource related to the configure parameters. DHCP driver will make a copy of the user's configure such as the time out value. */
VOID DhcpCleanConfigure(IN OUT EFI_DHCP4_CONFIG_DATA *Config)
|
{
UINT32 Index;
if (Config->DiscoverTimeout != NULL) {
FreePool (Config->DiscoverTimeout);
}
if (Config->RequestTimeout != NULL) {
FreePool (Config->RequestTimeout);
}
if (Config->OptionList != NULL) {
for (Index = 0; Index < Config->OptionCount; Index++) {
if (Config->OptionList[Index] != NULL) {
FreePool (Config->OptionList[Index]);
}
}
FreePool (Config->OptionList);
}
ZeroMem (Config, sizeof (EFI_DHCP4_CONFIG_DATA));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* check if write data to tx fifo is permitted. */
|
int serial_writable(serial_t *obj)
|
/* check if write data to tx fifo is permitted. */
int serial_writable(serial_t *obj)
|
{
PMBED_UART_ADAPTER puart_adapter=&(uart_adapter[obj->uart_idx]);
if (UART_Writable(puart_adapter->UARTx)) {
return 1;
} else {
return 0;
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* See the Unified Extensible Firmware Interface (UEFI) specification for details. */
|
static efi_status_t EFIAPI efi_cin_unregister_key_notify(struct efi_simple_text_input_ex_protocol *this, void *notification_handle)
|
/* See the Unified Extensible Firmware Interface (UEFI) specification for details. */
static efi_status_t EFIAPI efi_cin_unregister_key_notify(struct efi_simple_text_input_ex_protocol *this, void *notification_handle)
|
{
efi_status_t ret = EFI_INVALID_PARAMETER;
struct efi_cin_notify_function *item, *notify_function =
notification_handle;
EFI_ENTRY("%p, %p", this, notification_handle);
if (!this || !notification_handle)
goto out;
list_for_each_entry(item, &cin_notify_functions, link) {
if (item == notify_function) {
ret = EFI_SUCCESS;
break;
}
}
if (ret != EFI_SUCCESS)
goto out;
list_del(¬ify_function->link);
free(notify_function);
out:
return EFI_EXIT(ret);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* This function sets bit to start execution of tuning. */
|
void XSdPs_SetExecTuning(XSdPs *InstancePtr)
|
/* This function sets bit to start execution of tuning. */
void XSdPs_SetExecTuning(XSdPs *InstancePtr)
|
{
u16 CtrlReg;
CtrlReg = XSdPs_ReadReg16(InstancePtr->Config.BaseAddress,
XSDPS_HOST_CTRL2_OFFSET);
CtrlReg |= XSDPS_HC2_EXEC_TNG_MASK;
XSdPs_WriteReg16(InstancePtr->Config.BaseAddress,
XSDPS_HOST_CTRL2_OFFSET, CtrlReg);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Return value: a pointer to the newly allocated string. */
|
gchar* avpl_to_str(AVPL *avpl)
|
/* Return value: a pointer to the newly allocated string. */
gchar* avpl_to_str(AVPL *avpl)
|
{
avp_s = avp_to_str(c->avp);
g_string_append_printf(s," %s;",avp_s);
g_free(avp_s);
}
r = g_string_free(s,FALSE);
return r;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* VmbusChannelRequestOffers - Send a request to get all our pending offers. */
|
int VmbusChannelRequestOffers(void)
|
/* VmbusChannelRequestOffers - Send a request to get all our pending offers. */
int VmbusChannelRequestOffers(void)
|
{
struct vmbus_channel_message_header *msg;
struct vmbus_channel_msginfo *msgInfo;
int ret;
DPRINT_ENTER(VMBUS);
msgInfo = kmalloc(sizeof(*msgInfo) +
sizeof(struct vmbus_channel_message_header),
GFP_KERNEL);
ASSERT(msgInfo != NULL);
msgInfo->WaitEvent = osd_WaitEventCreate();
msg = (struct vmbus_channel_message_header *)msgInfo->Msg;
msg->MessageType = ChannelMessageRequestOffers;
ret = VmbusPostMessage(msg,
sizeof(struct vmbus_channel_message_header));
if (ret != 0) {
DPRINT_ERR(VMBUS, "Unable to request offers - %d", ret);
goto Cleanup;
}
Cleanup:
if (msgInfo) {
kfree(msgInfo->WaitEvent);
kfree(msgInfo);
}
DPRINT_EXIT(VMBUS);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* based on the resolved device node GUID see if there already allocated device for this device. If there's no such, create one. */
|
static struct iser_device* iser_device_find_by_ib_device(struct rdma_cm_id *cma_id)
|
/* based on the resolved device node GUID see if there already allocated device for this device. If there's no such, create one. */
static struct iser_device* iser_device_find_by_ib_device(struct rdma_cm_id *cma_id)
|
{
struct iser_device *device;
mutex_lock(&ig.device_list_mutex);
list_for_each_entry(device, &ig.device_list, ig_list)
if (device->ib_device->node_guid == cma_id->device->node_guid)
goto inc_refcnt;
device = kzalloc(sizeof *device, GFP_KERNEL);
if (device == NULL)
goto out;
device->ib_device = cma_id->device;
if (iser_create_device_ib_res(device)) {
kfree(device);
device = NULL;
goto out;
}
list_add(&device->ig_list, &ig.device_list);
inc_refcnt:
device->refcount++;
out:
mutex_unlock(&ig.device_list_mutex);
return device;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* init_ohci1394_controller - Map the registers of the controller and init DMA This maps the registers of the specified controller and initializes it */
|
static void __init init_ohci1394_controller(int num, int slot, int func)
|
/* init_ohci1394_controller - Map the registers of the controller and init DMA This maps the registers of the specified controller and initializes it */
static void __init init_ohci1394_controller(int num, int slot, int func)
|
{
unsigned long ohci_base;
struct ti_ohci ohci;
printk(KERN_INFO "init_ohci1394_dma: initializing OHCI-1394"
" at %02x:%02x.%x\n", num, slot, func);
ohci_base = read_pci_config(num, slot, func, PCI_BASE_ADDRESS_0+(0<<2))
& PCI_BASE_ADDRESS_MEM_MASK;
set_fixmap_nocache(FIX_OHCI1394_BASE, ohci_base);
ohci.registers = (void *)fix_to_virt(FIX_OHCI1394_BASE);
init_ohci1394_reset_and_init_dma(&ohci);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check validity of HELLO message header and message TLVs */
|
static enum rfc5444_result check_msg_validity(struct rfc5444_reader_tlvblock_context *cont)
|
/* Check validity of HELLO message header and message TLVs */
static enum rfc5444_result check_msg_validity(struct rfc5444_reader_tlvblock_context *cont)
|
{
if (cont->has_hoplimit && cont->hoplimit != 1) {
return RFC5444_DROP_MESSAGE;
}
if (cont->has_hopcount && cont->hopcount != 0) {
return RFC5444_DROP_MESSAGE;
}
if (!(_nhdp_msg_tlvs[RFC5444_MSGTLV_VALIDITY_TIME].tlv)) {
return RFC5444_DROP_MESSAGE;
}
else if (_nhdp_msg_tlvs[RFC5444_MSGTLV_VALIDITY_TIME].tlv->next_entry) {
return RFC5444_DROP_MESSAGE;
}
if (_nhdp_msg_tlvs[RFC5444_MSGTLV_INTERVAL_TIME].tlv
&& _nhdp_msg_tlvs[RFC5444_MSGTLV_INTERVAL_TIME].tlv->next_entry) {
return RFC5444_DROP_MESSAGE;
}
return RFC5444_OKAY;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Allocate a skb from the socket's send buffer. */
|
struct sk_buff* sock_wmalloc(struct sock *sk, unsigned long size, int force, gfp_t priority)
|
/* Allocate a skb from the socket's send buffer. */
struct sk_buff* sock_wmalloc(struct sock *sk, unsigned long size, int force, gfp_t priority)
|
{
if (force || atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) {
struct sk_buff *skb = alloc_skb(size, priority);
if (skb) {
skb_set_owner_w(skb, sk);
return skb;
}
}
return NULL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* c Configuration change acknowledge d Configuration change reject */
|
static void dtap_rr_conf_change_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
|
/* c Configuration change acknowledge d Configuration change reject */
static void dtap_rr_conf_change_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len)
|
{
guint32 curr_offset;
guint32 consumed;
guint curr_len;
curr_offset = offset;
curr_len = len;
ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_CAUSE, NULL);
EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_rr_extraneous_data);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* param config Pointer to configuration structure. See to "dcdc_low_power_config_t" */
|
void DCDC_GetDefaultLowPowerConfig(dcdc_low_power_config_t *config)
|
/* param config Pointer to configuration structure. See to "dcdc_low_power_config_t" */
void DCDC_GetDefaultLowPowerConfig(dcdc_low_power_config_t *config)
|
{
assert(NULL != config);
(void)memset(config, 0, sizeof(*config));
config->enableAdjustHystereticValue = false;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Calls a write-characteristic-value proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */
|
static int ble_gattc_write_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
|
/* Calls a write-characteristic-value proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */
static int ble_gattc_write_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
|
{
struct ble_gatt_attr attr;
int rc;
BLE_HS_DBG_ASSERT(!ble_hs_locked_by_cur_task());
ble_gattc_dbg_assert_proc_not_inserted(proc);
if (status != 0 && status != BLE_HS_EDONE) {
STATS_INC(ble_gattc_stats, write_fail);
}
if (proc->write.cb == NULL) {
rc = 0;
} else {
memset(&attr, 0, sizeof attr);
attr.handle = proc->write.att_handle;
rc = proc->write.cb(proc->conn_handle,
ble_gattc_error(status, att_handle),
&attr, proc->write.cb_arg);
}
return rc;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* param base PXP peripheral base address. param config Pointer to the configuration structure. */
|
void PXP_SetAlphaSurfaceBlendConfig(PXP_Type *base, const pxp_as_blend_config_t *config)
|
/* param base PXP peripheral base address. param config Pointer to the configuration structure. */
void PXP_SetAlphaSurfaceBlendConfig(PXP_Type *base, const pxp_as_blend_config_t *config)
|
{
assert(NULL != config);
uint32_t reg;
reg = base->AS_CTRL;
reg &=
~(PXP_AS_CTRL_ALPHA0_INVERT_MASK | PXP_AS_CTRL_ROP_MASK | PXP_AS_CTRL_ALPHA_MASK | PXP_AS_CTRL_ALPHA_CTRL_MASK);
reg |= (PXP_AS_CTRL_ROP(config->ropMode) | PXP_AS_CTRL_ALPHA(config->alpha) |
PXP_AS_CTRL_ALPHA_CTRL(config->alphaMode));
if (config->invertAlpha)
{
reg |= PXP_AS_CTRL_ALPHA0_INVERT_MASK;
}
base->AS_CTRL = reg;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* The request function is our main entry point */
|
static void ub_request_fn(struct request_queue *q)
|
/* The request function is our main entry point */
static void ub_request_fn(struct request_queue *q)
|
{
struct ub_lun *lun = q->queuedata;
struct request *rq;
while ((rq = blk_peek_request(q)) != NULL) {
if (ub_request_fn_1(lun, rq) != 0) {
blk_stop_queue(q);
break;
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If Sha1Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
|
BOOLEAN EFIAPI CryptoServiceSha1Update(IN OUT VOID *Sha1Context, IN CONST VOID *Data, IN UINTN DataSize)
|
/* If Sha1Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceSha1Update(IN OUT VOID *Sha1Context, IN CONST VOID *Data, IN UINTN DataSize)
|
{
return CALL_BASECRYPTLIB (Sha1.Services.Update, Sha1Update, (Sha1Context, Data, DataSize), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If ListHead is NULL, then ASSERT(). If Entry is NULL, then ASSERT(). If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or */
|
LIST_ENTRY* EFIAPI InsertHeadList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
|
/* If ListHead is NULL, then ASSERT(). If Entry is NULL, then ASSERT(). If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or */
LIST_ENTRY* EFIAPI InsertHeadList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
|
{
ASSERT_VERIFY_NODE_IN_VALID_LIST (ListHead, Entry, FALSE);
Entry->ForwardLink = ListHead->ForwardLink;
Entry->BackLink = ListHead;
Entry->ForwardLink->BackLink = Entry;
ListHead->ForwardLink = Entry;
return ListHead;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. param xfer FlexCAN Rx FIFO transfer structure. See the ref flexcan_fifo_transfer_t. retval kStatus_Success - Start Rx FIFO receiving process successfully. retval kStatus_FLEXCAN_RxFifoBusy - Rx FIFO is currently in use. */
|
status_t FLEXCAN_TransferReceiveFifoNonBlocking(CAN_Type *base, flexcan_handle_t *handle, flexcan_fifo_transfer_t *xfer)
|
/* param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. param xfer FlexCAN Rx FIFO transfer structure. See the ref flexcan_fifo_transfer_t. retval kStatus_Success - Start Rx FIFO receiving process successfully. retval kStatus_FLEXCAN_RxFifoBusy - Rx FIFO is currently in use. */
status_t FLEXCAN_TransferReceiveFifoNonBlocking(CAN_Type *base, flexcan_handle_t *handle, flexcan_fifo_transfer_t *xfer)
|
{
assert(handle);
assert(xfer);
if (kFLEXCAN_StateIdle == handle->rxFifoState)
{
handle->rxFifoState = kFLEXCAN_StateRxFifo;
handle->rxFifoFrameBuf = xfer->frame;
FLEXCAN_EnableMbInterrupts(
base, kFLEXCAN_RxFifoOverflowFlag | kFLEXCAN_RxFifoWarningFlag | kFLEXCAN_RxFifoFrameAvlFlag);
return kStatus_Success;
}
else
{
return kStatus_FLEXCAN_RxFifoBusy;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* NOTE that reparent_to_kthreadd() gives the caller full capabilities. */
|
static void reparent_to_kthreadd(void)
|
/* NOTE that reparent_to_kthreadd() gives the caller full capabilities. */
static void reparent_to_kthreadd(void)
|
{
write_lock_irq(&tasklist_lock);
ptrace_unlink(current);
current->real_parent = current->parent = kthreadd_task;
list_move_tail(¤t->sibling, ¤t->real_parent->children);
current->exit_signal = SIGCHLD;
if (task_nice(current) < 0)
set_user_nice(current, 0);
memcpy(current->signal->rlim, init_task.signal->rlim,
sizeof(current->signal->rlim));
atomic_inc(&init_cred.usage);
commit_creds(&init_cred);
write_unlock_irq(&tasklist_lock);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* register a server & start smbiod if necessary */
|
int smbiod_register_server(struct smb_sb_info *server)
|
/* register a server & start smbiod if necessary */
int smbiod_register_server(struct smb_sb_info *server)
|
{
int ret;
spin_lock(&servers_lock);
list_add(&server->entry, &smb_servers);
VERBOSE("%p\n", server);
ret = smbiod_start();
spin_unlock(&servers_lock);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Destroys the dataset, freeing all memory allocated, and calling any destroy functions set for data elements. */
|
void g_dataset_destroy(gconstpointer dataset_location)
|
/* Destroys the dataset, freeing all memory allocated, and calling any destroy functions set for data elements. */
void g_dataset_destroy(gconstpointer dataset_location)
|
{
g_return_if_fail (dataset_location != NULL);
G_LOCK (g_dataset_global);
if (g_dataset_location_ht)
{
GDataset *dataset;
dataset = g_dataset_lookup (dataset_location);
if (dataset)
g_dataset_destroy_internal (dataset);
}
G_UNLOCK (g_dataset_global);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* param handle codec handle. param mclk master clock frequency in HZ. param sampleRate sample rate in HZ. param bitWidth bit width. return kStatus_Success is success, else configure failed. */
|
status_t HAL_CODEC_CS42888_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth)
|
/* param handle codec handle. param mclk master clock frequency in HZ. param sampleRate sample rate in HZ. param bitWidth bit width. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_CS42888_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth)
|
{
assert(handle != NULL);
return CS42888_ConfigDataFormat((cs42888_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), mclk,
sampleRate, bitWidth);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Disables the uDMA requests in the SHA/MD5 module. */
|
void SHAMD5DMADisable(uint32_t ui32Base)
|
/* Disables the uDMA requests in the SHA/MD5 module. */
void SHAMD5DMADisable(uint32_t ui32Base)
|
{
ASSERT(ui32Base == SHAMD5_BASE);
HWREG(ui32Base + SHAMD5_O_SYSCONFIG) &=
~(SHAMD5_SYSCONFIG_SADVANCED | SHAMD5_SYSCONFIG_DMA_EN);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Function for handling the Connection Parameters Module.
This function will be called for all events in the Connection Parameters Module which are passed to the application. */
|
static void on_conn_params_evt(ble_conn_params_evt_t *p_evt)
|
/* Function for handling the Connection Parameters Module.
This function will be called for all events in the Connection Parameters Module which are passed to the application. */
static void on_conn_params_evt(ble_conn_params_evt_t *p_evt)
|
{
uint32_t err_code;
if (p_evt->evt_type == BLE_CONN_PARAMS_EVT_FAILED)
{
err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_CONN_INTERVAL_UNACCEPTABLE);
APP_ERROR_CHECK(err_code);
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Pick out the memory size. We look for mem=size@start, where start and size are "size" */
|
static void __init early_mem(char **p)
|
/* Pick out the memory size. We look for mem=size@start, where start and size are "size" */
static void __init early_mem(char **p)
|
{
static int usermem __initdata = 0;
unsigned long size, start;
if (usermem == 0) {
usermem = 1;
meminfo.nr_banks = 0;
}
start = PHYS_OFFSET;
size = memparse(*p, p);
if (**p == '@')
start = memparse(*p + 1, p);
arm_add_memory(start, size);
}
|
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.