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
/* unmute (and set max vol) the input amplifier */
static int unmute_input(struct hda_codec *codec, struct hda_gnode *node, unsigned int index)
/* unmute (and set max vol) the input amplifier */ static int unmute_input(struct hda_codec *codec, struct hda_gnode *node, unsigned int index)
{ unsigned int val, ofs; snd_printdd("UNMUTE IN: NID=0x%x IDX=0x%x\n", node->nid, index); val = (node->amp_in_caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT; ofs = (node->amp_in_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT; if (val >= ofs) val -= ofs; snd_hda_codec_amp_stereo(codec, node->nid, HDA_INPUT, index, 0xff, val); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Do a system call from kernel instead of calling sys_execve so we end up with proper pt_regs. */
int kernel_execve(const char *filename, char *const argv[], char *const envp[])
/* Do a system call from kernel instead of calling sys_execve so we end up with proper pt_regs. */ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
{ register long __sc0 __asm__ ("r3") = __NR_execve; register long __sc4 __asm__ ("r4") = (long) filename; register long __sc5 __asm__ ("r5") = (long) argv; register long __sc6 __asm__ ("r6") = (long) envp; __asm__ __volatile__ (SYSCALL_ARG3 : "=z" (__sc0) : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6) : "memory"); return __sc0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Worker function to execute a caller provided function on all enabled APs. */
VOID StartupAllAPsWorker(IN EFI_AP_PROCEDURE Procedure, IN EFI_EVENT MpEvent)
/* Worker function to execute a caller provided function on all enabled APs. */ VOID StartupAllAPsWorker(IN EFI_AP_PROCEDURE Procedure, IN EFI_EVENT MpEvent)
{ EFI_STATUS Status; EFI_MP_SERVICES_PROTOCOL *MpServices; CPU_FEATURES_DATA *CpuFeaturesData; CpuFeaturesData = GetCpuFeaturesData (); MpServices = CpuFeaturesData->MpService.Protocol; Status = MpServices->StartupAllAPs ( MpServices, Procedure, FALSE, MpEvent, 0, CpuFeaturesData, NULL ); ASSERT_EFI_ERROR (Status); }
tianocore/edk2
C++
Other
4,240
/* Enables the timer/counter for a PWM generator block. */
void PWMGenEnable(unsigned long ulBase, unsigned long ulGen)
/* Enables the timer/counter for a PWM generator block. */ void PWMGenEnable(unsigned long ulBase, unsigned long ulGen)
{ ASSERT(ulBase == PWM_BASE); ASSERT(PWMGenValid(ulGen)); HWREG(PWM_GEN_BADDR(ulBase, ulGen) + PWM_O_X_CTL) |= PWM_X_CTL_ENABLE; }
watterott/WebRadio
C++
null
71
/* brief DMA instance 1, channel 2 IRQ handler. */
void EDMA_1_CH2_DriverIRQHandler(void)
/* brief DMA instance 1, channel 2 IRQ handler. */ void EDMA_1_CH2_DriverIRQHandler(void)
{ EDMA_DriverIRQHandler(1U, 2U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" documentation) by the application code so that the address and size of a requested descriptor can be given to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the USB host. */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint16_t wIndex, const void **const DescriptorAddress)
/* This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" documentation) by the application code so that the address and size of a requested descriptor can be given to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the USB host. */ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint16_t wIndex, const void **const DescriptorAddress)
{ if (CurrentFirmwareMode == MODE_USART_BRIDGE) return USART_GetDescriptor(wValue, wIndex, DescriptorAddress); else return AVRISP_GetDescriptor(wValue, wIndex, DescriptorAddress); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Encode the given size and next info into a free slob block s. */
static void set_slob(slob_t *s, slobidx_t size, slob_t *next)
/* Encode the given size and next info into a free slob block s. */ static void set_slob(slob_t *s, slobidx_t size, slob_t *next)
{ slob_t *base = (slob_t *)((unsigned long)s & PAGE_MASK); slobidx_t offset = next - base; if (size > 1) { s[0].units = size; s[1].units = offset; } else s[0].units = -offset; }
robutest/uclinux
C++
GPL-2.0
60
/* Return the SDL_Joystick associated with an instance id. */
SDL_Joystick* SDL_JoystickFromInstanceID(SDL_JoystickID instance_id)
/* Return the SDL_Joystick associated with an instance id. */ SDL_Joystick* SDL_JoystickFromInstanceID(SDL_JoystickID instance_id)
{ SDL_Joystick *joystick; SDL_LockJoysticks(); for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { if (joystick->instance_id == instance_id) { break; } } SDL_UnlockJoysticks(); return joystick; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Migrates the Global Descriptor Table (GDT) to permanent memory. */
EFI_STATUS MigrateGdt(VOID)
/* Migrates the Global Descriptor Table (GDT) to permanent memory. */ EFI_STATUS MigrateGdt(VOID)
{ EFI_STATUS Status; UINTN GdtBufferSize; IA32_DESCRIPTOR Gdtr; VOID *GdtBuffer; AsmReadGdtr ((IA32_DESCRIPTOR *)&Gdtr); GdtBufferSize = sizeof (IA32_SEGMENT_DESCRIPTOR) -1 + Gdtr.Limit + 1; Status = PeiServicesAllocatePool ( GdtBufferSize, &GdtBuffer ); ASSERT (GdtBuffer != NULL); if (EFI_ERROR (Status)) { return EFI_OUT_OF_RESOURCES; } GdtBuffer = ALIGN_POINTER (GdtBuffer, sizeof (IA32_SEGMENT_DESCRIPTOR)); CopyMem (GdtBuffer, (VOID *)Gdtr.Base, Gdtr.Limit + 1); Gdtr.Base = (UINTN)GdtBuffer; AsmWriteGdtr (&Gdtr); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Removal of cgroup itself succeeds regardless of refs from swap. */
static void __mem_cgroup_free(struct mem_cgroup *mem)
/* Removal of cgroup itself succeeds regardless of refs from swap. */ static void __mem_cgroup_free(struct mem_cgroup *mem)
{ int node; mem_cgroup_remove_from_trees(mem); free_css_id(&mem_cgroup_subsys, &mem->css); for_each_node_state(node, N_POSSIBLE) free_mem_cgroup_per_zone_info(mem, node); if (mem_cgroup_size() < PAGE_SIZE) kfree(mem); else vfree(mem); }
robutest/uclinux
C++
GPL-2.0
60
/* Note, this function does not add the @node object to LNC directly, but allocates a copy of the object and adds the copy to LNC. The reason for this is that @node has been allocated outside of the TNC subsystem and will be used with */
static int lnc_add(struct ubifs_info *c, struct ubifs_zbranch *zbr, const void *node)
/* Note, this function does not add the @node object to LNC directly, but allocates a copy of the object and adds the copy to LNC. The reason for this is that @node has been allocated outside of the TNC subsystem and will be used with */ static int lnc_add(struct ubifs_info *c, struct ubifs_zbranch *zbr, const void *node)
{ int err; void *lnc_node; const struct ubifs_dent_node *dent = node; ubifs_assert(!zbr->leaf); ubifs_assert(zbr->len != 0); ubifs_assert(is_hash_key(c, &zbr->key)); err = ubifs_validate_entry(c, dent); if (err) { dump_stack(); ubifs_dump_node(c, dent); return err; } lnc_node = kmemdup(node, zbr->len, GFP_NOFS); if (!lnc_node) return 0; zbr->leaf = lnc_node; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* PCD MSP Initialization This function configures the hardware resources used in this example. */
void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
/* PCD MSP Initialization This function configures the hardware resources used in this example. */ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hpcd->Instance==USB_OTG_FS) { __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Alternate = GPIO_AF10_OTG1_FS; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); __HAL_RCC_USB_OTG_FS_CLK_ENABLE(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* @key: RSA key @pos: The bit position to check */
static int is_public_exponent_bit_set(const struct rsa_public_key *key, int pos)
/* @key: RSA key @pos: The bit position to check */ static int is_public_exponent_bit_set(const struct rsa_public_key *key, int pos)
{ return key->exponent & (1ULL << pos); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Enables or disables the USART's one bit sampling method. */
void USART_OneBitMethodCmd(USART_TypeDef *USARTx, FunctionalState NewState)
/* Enables or disables the USART's one bit sampling method. */ void USART_OneBitMethodCmd(USART_TypeDef *USARTx, FunctionalState NewState)
{ assert_param(IS_USART_ALL_PERIPH(USARTx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { USARTx->CR3 |= USART_CR3_ONEBIT; } else { USARTx->CR3 &= (uint32_t)~((uint32_t)USART_CR3_ONEBIT); } }
ajhc/demo-cortex-m3
C++
null
38
/* The four transmit queues allow for performing quality of service (qos) transmissions as per the 802.11 protocol. Currently Linux does not provide a mechanism to the user for utilizing prioritized queues, so we only utilize the first data transmit queue (queue1). Driver allocates buffers of this size for Rx ipw_rx_queue_space - Return number of free slots available in queue. */
static int ipw_rx_queue_space(const struct ipw_rx_queue *q)
/* The four transmit queues allow for performing quality of service (qos) transmissions as per the 802.11 protocol. Currently Linux does not provide a mechanism to the user for utilizing prioritized queues, so we only utilize the first data transmit queue (queue1). Driver allocates buffers of this size for Rx ipw_rx_queue_space - Return number of free slots available in queue. */ static int ipw_rx_queue_space(const struct ipw_rx_queue *q)
{ int s = q->read - q->write; if (s <= 0) s += RX_QUEUE_SIZE; s -= 2; if (s < 0) s = 0; return s; }
robutest/uclinux
C++
GPL-2.0
60
/* Ping Request Timer callback. Function that gets executed when a Ping request to MQTT broker timeout event occurs. */
void adi_wifi_PingTimerCallback(void *pCBParam, uint32_t Event, void *pArg)
/* Ping Request Timer callback. Function that gets executed when a Ping request to MQTT broker timeout event occurs. */ void adi_wifi_PingTimerCallback(void *pCBParam, uint32_t Event, void *pArg)
{ gbPingTimeoutHappened = 1u; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Switch the requested AP to be the BSP from that point onward. */
EFI_STATUS MpServicesUnitTestSwitchBSP(IN MP_SERVICES MpServices, IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
/* Switch the requested AP to be the BSP from that point onward. */ EFI_STATUS MpServicesUnitTestSwitchBSP(IN MP_SERVICES MpServices, IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
{ return MpServices.Protocol->SwitchBSP (MpServices.Protocol, ProcessorNumber, EnableOldBSP); }
tianocore/edk2
C++
Other
4,240
/* configure the HXTAL divider used as input of PLL */
void rcu_hxtal_prediv_config(uint32_t hxtal_prediv)
/* configure the HXTAL divider used as input of PLL */ void rcu_hxtal_prediv_config(uint32_t hxtal_prediv)
{ uint32_t prediv = 0; prediv = RCU_CFG1; prediv &= ~RCU_CFG1_HXTALPREDV; RCU_CFG1 = (prediv | hxtal_prediv); }
liuxuming/trochili
C++
Apache License 2.0
132
/* Computes the 32-bit CRC of a given buffer of data word(32-bit). */
uint32_t CRC32_CalcBufCrc(uint32_t pBuffer[], uint32_t BufferLength)
/* Computes the 32-bit CRC of a given buffer of data word(32-bit). */ uint32_t CRC32_CalcBufCrc(uint32_t pBuffer[], uint32_t BufferLength)
{ uint32_t index = 0; for (index = 0; index < BufferLength; index++) { CRC->CRC32DAT = pBuffer[index]; } return (CRC->CRC32DAT); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Wait for MSTATUS bit to be set, and clear it afterwards with time out. */
static int mcux_i3c_state_wait_timeout(I3C_Type *base, uint32_t state, uint32_t init_delay_us, uint32_t step_delay_us, uint32_t total_delay_us)
/* Wait for MSTATUS bit to be set, and clear it afterwards with time out. */ static int mcux_i3c_state_wait_timeout(I3C_Type *base, uint32_t state, uint32_t init_delay_us, uint32_t step_delay_us, uint32_t total_delay_us)
{ uint32_t delayed = init_delay_us; int ret = -ETIMEDOUT; while (delayed <= total_delay_us) { if (mcux_i3c_state_get(base) == state) { ret = 0; break; } k_busy_wait(step_delay_us); delayed += step_delay_us; } return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* The clock_cpu_settimeout() fucntion set timeout time and timeout callback function The timeout callback function will be called when the timeout time is reached */
int clock_cpu_settimeout(uint64_t tick, void(*timeout)(void *param), void *param)
/* The clock_cpu_settimeout() fucntion set timeout time and timeout callback function The timeout callback function will be called when the timeout time is reached */ int clock_cpu_settimeout(uint64_t tick, void(*timeout)(void *param), void *param)
{ if (_cputime_ops) return _cputime_ops->cputime_settimeout(tick, timeout, param); rt_set_errno(ENOSYS); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called while unloading a successfully installed watchdog module. */
static void __exit watchdog_exit(void)
/* Called while unloading a successfully installed watchdog module. */ static void __exit watchdog_exit(void)
{ ali_stop(); misc_deregister(&ali_miscdev); unregister_reboot_notifier(&ali_notifier); pci_dev_put(ali_pci); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the string corresponding to the given guint (1-14, for channel only) */
gchar* airpcap_get_channel_name(guint n)
/* Returns the string corresponding to the given guint (1-14, for channel only) */ gchar* airpcap_get_channel_name(guint n)
{ return g_strdup_printf("%d",n); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* IDL typedef union { IDL TYPE_3 *element_3; IDL TYPE_4 *element_4; IDL } TYPE_2; */
static int dissect_browser_TYPE_2(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
/* IDL typedef union { IDL TYPE_3 *element_3; IDL TYPE_4 *element_4; IDL } TYPE_2; */ static int dissect_browser_TYPE_2(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
{ guint32 level; offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_browser_unknown_long, &level); ALIGN_TO_4_BYTES; switch(level){ case 100: offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, di, drep, dissect_browser_TYPE_3, NDR_POINTER_UNIQUE, "unknown TYPE_3", -1); break; case 101: offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, di, drep, dissect_browser_TYPE_4, NDR_POINTER_UNIQUE, "unknown TYPE_4", -1); break; } return offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Called whenever a link setup request timer associated with a bearer expires. */
static void disc_timeout(struct link_req *req)
/* Called whenever a link setup request timer associated with a bearer expires. */ static void disc_timeout(struct link_req *req)
{ spin_lock_bh(&req->bearer->publ.lock); req->bearer->media->send_msg(req->buf, &req->bearer->publ, &req->dest); if ((req->timer_intv == TIPC_LINK_REQ_SLOW) || (req->timer_intv == TIPC_LINK_REQ_FAST)) { } else { req->timer_intv *= 2; if (req->timer_intv > TIPC_LINK_REQ_FAST) req->timer_intv = TIPC_LINK_REQ_FAST; if ((req->timer_intv == TIPC_LINK_REQ_FAST) && (req->bearer->nodes.count)) req->timer_intv = TIPC_LINK_REQ_SLOW; } k_start_timer(&req->timer, req->timer_intv); spin_unlock_bh(&req->bearer->publ.lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Determines if the USART is in mute mode or not. */
void USART_ReceiverWakeUpCmd(USART_TypeDef *USARTx, FunctionalState NewState)
/* Determines if the USART is in mute mode or not. */ void USART_ReceiverWakeUpCmd(USART_TypeDef *USARTx, FunctionalState NewState)
{ assert_param(IS_USART_ALL_PERIPH(USARTx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { USARTx->CR1 |= CR1_RWU_Set; } else { USARTx->CR1 &= CR1_RWU_Reset; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Enables or disables any unicast packet filtered by the MAC address recognition to be a wake-up frame. */
void ETH_EnableGlobalUnicastWakeUp(FunctionalState Cmd)
/* Enables or disables any unicast packet filtered by the MAC address recognition to be a wake-up frame. */ void ETH_EnableGlobalUnicastWakeUp(FunctionalState Cmd)
{ assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { ETH->MACPMTCTRLSTS |= ETH_MACPMTCTRLSTS_GLBLUCAST; } else { ETH->MACPMTCTRLSTS &= ~ETH_MACPMTCTRLSTS_GLBLUCAST; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Adds one Midiman packet to the output buffer. */
static void snd_usbmidi_output_midiman_packet(struct urb *urb, uint8_t p0, uint8_t p1, uint8_t p2, uint8_t p3)
/* Adds one Midiman packet to the output buffer. */ static void snd_usbmidi_output_midiman_packet(struct urb *urb, uint8_t p0, uint8_t p1, uint8_t p2, uint8_t p3)
{ uint8_t* buf = (uint8_t*)urb->transfer_buffer + urb->transfer_buffer_length; buf[0] = p1; buf[1] = p2; buf[2] = p3; buf[3] = (p0 & 0xf0) | snd_usbmidi_cin_length[p0 & 0x0f]; urb->transfer_buffer_length += 4; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear WDT interrupt status. Clear WDT interrupt status. */
void wdt_clear_status(struct wdt_module *const module)
/* Clear WDT interrupt status. Clear WDT interrupt status. */ void wdt_clear_status(struct wdt_module *const module)
{ module->hw->WDOGINTCLR.reg = 0x01; }
memfault/zero-to-main
C++
null
200
/* Gets a data element from the SPI interface with Noblock. This function gets received data from the interface of the specified SPI module with Noblock. */
void xSPIDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData)
/* Gets a data element from the SPI interface with Noblock. This function gets received data from the interface of the specified SPI module with Noblock. */ void xSPIDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData)
{ xASSERT(ulBase == SPI0_BASE); xASSERT(pulData != 0); *pulData = xHWREG(ulBase + S0SPDR) & S0SPDR_DATA_M; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Refer to SD Host Controller Simplified spec 3.0 Section 3.1 for details. */
EFI_STATUS SdPeimHcCardDetect(IN UINTN Bar)
/* Refer to SD Host Controller Simplified spec 3.0 Section 3.1 for details. */ EFI_STATUS SdPeimHcCardDetect(IN UINTN Bar)
{ EFI_STATUS Status; UINT16 Data; UINT32 PresentState; Status = SdPeimHcRwMmio (Bar + SD_HC_NOR_INT_STS, TRUE, sizeof (Data), &Data); if (EFI_ERROR (Status)) { return Status; } if ((Data & (BIT6 | BIT7)) != 0) { Data &= BIT6 | BIT7; Status = SdPeimHcRwMmio (Bar + SD_HC_NOR_INT_STS, FALSE, sizeof (Data), &Data); if (EFI_ERROR (Status)) { return Status; } } Status = SdPeimHcRwMmio (Bar + SD_HC_PRESENT_STATE, TRUE, sizeof (PresentState), &PresentState); if (EFI_ERROR (Status)) { return Status; } if ((PresentState & BIT16) != 0) { return EFI_SUCCESS; } else { return EFI_NO_MEDIA; } }
tianocore/edk2
C++
Other
4,240
/* I don't like the way this function's name looks next to ocfs2_journal_access_path(), but I don't have a better one. */
int ocfs2_path_bh_journal_access(handle_t *handle, struct ocfs2_caching_info *ci, struct ocfs2_path *path, int idx)
/* I don't like the way this function's name looks next to ocfs2_journal_access_path(), but I don't have a better one. */ int ocfs2_path_bh_journal_access(handle_t *handle, struct ocfs2_caching_info *ci, struct ocfs2_path *path, int idx)
{ ocfs2_journal_access_func access = path_root_access(path); if (!access) access = ocfs2_journal_access; if (idx) access = ocfs2_journal_access_eb; return access(handle, ci, path->p_node[idx].bh, OCFS2_JOURNAL_ACCESS_WRITE); }
robutest/uclinux
C++
GPL-2.0
60
/* Search the pool of buffers to find one that is free. If a buffer is found mark it as in use before returning its address. */
static unsigned char * prvGetNextBuffer(void)
/* Search the pool of buffers to find one that is free. If a buffer is found mark it as in use before returning its address. */ static unsigned char * prvGetNextBuffer(void)
{ long x; unsigned char *pucReturn = NULL; unsigned long ulAttempts = 0; while( pucReturn == NULL ) { for( x = 0; x < ETH_NUM_BUFFERS; x++ ) { if( ucBufferInUse[ x ] == pdFALSE ) { ucBufferInUse[ x ] = pdTRUE; pucReturn = ( unsigned char * ) ETH_BUF( x ); break; } } if( pucReturn == NULL ) { ulAttempts++; if( ulAttempts >= emacBUFFER_WAIT_ATTEMPTS ) { break; } vTaskDelay( emacBUFFER_WAIT_DELAY ); } } return pucReturn; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Returns the enabled interrupts. This function return the enabled interrupts. */
uint32_t am_hal_uart_int_enable_get(uint32_t ui32Module)
/* Returns the enabled interrupts. This function return the enabled interrupts. */ uint32_t am_hal_uart_int_enable_get(uint32_t ui32Module)
{ return AM_REGn(UART, ui32Module, IER); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable ISI. Explanation on the usage of the code made available through the header file. */
void ISI_Enable(void)
/* Enable ISI. Explanation on the usage of the code made available through the header file. */ void ISI_Enable(void)
{ AT91C_BASE_ISI->ISI_CR1 &= ~AT91C_ISI_DIS; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Sets the @attribute to contain the given @attr_value, if possible. */
void g_file_info_set_attribute_int64(GFileInfo *info, const char *attribute, gint64 attr_value)
/* Sets the @attribute to contain the given @attr_value, if possible. */ void g_file_info_set_attribute_int64(GFileInfo *info, const char *attribute, gint64 attr_value)
{ g_return_if_fail (G_IS_FILE_INFO (info)); g_return_if_fail (attribute != NULL && *attribute != '\0'); _g_file_info_set_attribute_int64_by_id (info, lookup_attribute (attribute), attr_value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Clear the Standby Flag. This is set when the processor returns from a standby mode. */
void pwr_clear_standby_flag(void)
/* Clear the Standby Flag. This is set when the processor returns from a standby mode. */ void pwr_clear_standby_flag(void)
{ PWR_CR |= PWR_CR_CSBF; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Message: StartSessionTransmissionMessage Opcode: 0x0095 Type: IntraCCM Direction: pbx2pbx VarLength: no */
static void handle_StartSessionTransmissionMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: StartSessionTransmissionMessage Opcode: 0x0095 Type: IntraCCM Direction: pbx2pbx VarLength: no */ static void handle_StartSessionTransmissionMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ dissect_skinny_ipv4or6(cursor, hf_skinny_remoteIpAddr_ipv4, hf_skinny_remoteIpAddr_ipv6, pinfo); ptvcursor_add(cursor, hf_skinny_sessionType, 4, ENC_LITTLE_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If both batteries are good, no LED If either battery has been warned, solid LED If both batteries are bad, flash the LED quickly If either battery is bad, flash the LED semi quickly */
static void set_fault_to_battery_status(struct cardinfo *card)
/* If both batteries are good, no LED If either battery has been warned, solid LED If both batteries are bad, flash the LED quickly If either battery is bad, flash the LED semi quickly */ static void set_fault_to_battery_status(struct cardinfo *card)
{ if (card->battery[0].good && card->battery[1].good) set_led(card, LED_FAULT, LED_OFF); else if (card->battery[0].warned || card->battery[1].warned) set_led(card, LED_FAULT, LED_ON); else if (!card->battery[0].good && !card->battery[1].good) set_led(card, LED_FAULT, LED_FLASH_7_0); else set_led(card, LED_FAULT, LED_FLASH_3_5); }
robutest/uclinux
C++
GPL-2.0
60
/* Gets a whole set of compass data including data, accuracy and timestamp. */
void inv_get_compass_set(long *data, int8_t *accuracy, inv_time_t *timestamp)
/* Gets a whole set of compass data including data, accuracy and timestamp. */ void inv_get_compass_set(long *data, int8_t *accuracy, inv_time_t *timestamp)
{ memcpy(data, sensors.compass.calibrated, sizeof(sensors.compass.calibrated)); if (timestamp != NULL) { *timestamp = sensors.compass.timestamp; } if (accuracy != NULL) { if (inv_data_builder.compass_disturbance) *accuracy = 0; else *accuracy = sensors.compass.accuracy; } }
Luos-io/luos_engine
C++
MIT License
496
/* Write USB Device Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */
U32 USBD_WriteEP(U32 EPNum, U8 *pData, U32 cnt)
/* Write USB Device Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */ U32 USBD_WriteEP(U32 EPNum, U8 *pData, U32 cnt)
{ U32 i; volatile U32 *ptr; U32 *dataptr; ptr = GetEpCmdStatPtr(EPNum); EPNum &= ~0x80; while (*ptr & BUF_ACTIVE); *ptr &= ~(0x3FFFFFF); *ptr |= BUF_ADDR(EPBufInfo[EP_IN_IDX(EPNum)].buf_ptr) | N_BYTES(cnt); dataptr = (U32 *)EPBufInfo[EP_IN_IDX(EPNum)].buf_ptr; for (i = 0; i < (cnt + 3) / 4; i++) { dataptr[i] = __UNALIGNED_UINT32_READ(pData); pData += 4; } if (EPNum && (*ptr & EP_STALL)) { return (0); } *ptr |= BUF_ACTIVE; return (cnt); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* We set the inode flag atomically with the radix tree tag. Once we get tag lookups on the radix tree, this inode flag can go away. */
void xfs_inode_set_reclaim_tag(xfs_inode_t *ip)
/* We set the inode flag atomically with the radix tree tag. Once we get tag lookups on the radix tree, this inode flag can go away. */ void xfs_inode_set_reclaim_tag(xfs_inode_t *ip)
{ xfs_mount_t *mp = ip->i_mount; xfs_perag_t *pag = xfs_get_perag(mp, ip->i_ino); read_lock(&pag->pag_ici_lock); spin_lock(&ip->i_flags_lock); __xfs_inode_set_reclaim_tag(pag, ip); __xfs_iflags_set(ip, XFS_IRECLAIMABLE); spin_unlock(&ip->i_flags_lock); read_unlock(&pag->pag_ici_lock); xfs_put_perag(mp, pag); }
robutest/uclinux
C++
GPL-2.0
60
/* The functions for inserting/removing us as a module. */
static int __init tr_init(void)
/* The functions for inserting/removing us as a module. */ static int __init tr_init(void)
{ return serio_register_driver(&tr_drv); }
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 Vector31_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 Vector31_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (31 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Enable the 3-wire SPI start interrupt of the specified SPI port. */
void SPI3WireStartIntEnable(unsigned long ulBase)
/* Enable the 3-wire SPI start interrupt of the specified SPI port. */ void SPI3WireStartIntEnable(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_SSTA_INTEN; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Invalidate any cursor that is pointing to this item. This is called when an item is removed from the AIL. Any cursor pointing to this object is now invalid and the traversal needs to be terminated so it doesn't reference a freed object. We set the cursor item to a value of 1 so we can distinguish between an invalidation and the end of the list when getting the next item from the cursor. */
STATIC void xfs_trans_ail_cursor_clear(struct xfs_ail *ailp, struct xfs_log_item *lip)
/* Invalidate any cursor that is pointing to this item. This is called when an item is removed from the AIL. Any cursor pointing to this object is now invalid and the traversal needs to be terminated so it doesn't reference a freed object. We set the cursor item to a value of 1 so we can distinguish between an invalidation and the end of the list when getting the next item from the cursor. */ STATIC void xfs_trans_ail_cursor_clear(struct xfs_ail *ailp, struct xfs_log_item *lip)
{ struct xfs_ail_cursor *cur; for (cur = &ailp->xa_cursors; cur; cur = cur->next) { if (cur->item == lip) cur->item = (struct xfs_log_item *) ((__psint_t)cur->item | 1); } }
robutest/uclinux
C++
GPL-2.0
60
/* set the status bytes in a response buffer */
static void vcard_response_set_status_bytes(VCardResponse *response, unsigned char sw1, unsigned char sw2)
/* set the status bytes in a response buffer */ static void vcard_response_set_status_bytes(VCardResponse *response, unsigned char sw1, unsigned char sw2)
{ response->b_status = sw1 << 8 | sw2; response->b_sw1 = sw1; response->b_sw2 = sw2; response->b_data[response->b_len] = sw1; response->b_data[response->b_len+1] = sw2; }
ve3wwg/teensy3_qemu
C++
Other
15
/* Enables or disables the USART's 8x oversampling mode. */
void USART_OverSampling8Cmd(USART_TypeDef *USARTx, FunctionalState NewState)
/* Enables or disables the USART's 8x oversampling mode. */ void USART_OverSampling8Cmd(USART_TypeDef *USARTx, FunctionalState NewState)
{ assert_param(IS_USART_ALL_PERIPH(USARTx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { USARTx->CR1 |= USART_CR1_OVER8; } else { USARTx->CR1 &= (uint32_t)~((uint32_t)USART_CR1_OVER8); } }
ajhc/demo-cortex-m3
C++
null
38
/* Returns a pointer to the allocated fcport, or NULL, if none available. */
static fc_port_t* qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)
/* Returns a pointer to the allocated fcport, or NULL, if none available. */ static fc_port_t* qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)
{ fc_port_t *fcport; fcport = kzalloc(sizeof(fc_port_t), flags); if (!fcport) return NULL; fcport->vha = vha; fcport->vp_idx = vha->vp_idx; fcport->port_type = FCT_UNKNOWN; fcport->loop_id = FC_NO_LOOP_ID; atomic_set(&fcport->state, FCS_UNCONFIGURED); fcport->supported_classes = FC_COS_UNSPECIFIED; return fcport; }
robutest/uclinux
C++
GPL-2.0
60
/* All this function ensures is that it will return after usec_to_wait or later. */
void arch_busy_wait(uint32_t usec_to_wait)
/* All this function ensures is that it will return after usec_to_wait or later. */ void arch_busy_wait(uint32_t usec_to_wait)
{ bs_time_t time_end = nsi_hws_get_time() + usec_to_wait; while (nsi_hws_get_time() < time_end) { nhw_fake_timer_wake_in_time(CONFIG_NATIVE_SIMULATOR_MCU_N, time_end); posix_halt_cpu(); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Emit at least 1 message per second, even if audit_rate_check is throttling. Always increment the lost messages counter. */
void audit_log_lost(const char *message)
/* Emit at least 1 message per second, even if audit_rate_check is throttling. Always increment the lost messages counter. */ void audit_log_lost(const char *message)
{ static unsigned long last_msg = 0; static DEFINE_SPINLOCK(lock); unsigned long flags; unsigned long now; int print; atomic_inc(&audit_lost); print = (audit_failure == AUDIT_FAIL_PANIC || !audit_rate_limit); if (!print) { spin_lock_irqsave(&lock, flags); now = jiffies; if (now - last_msg > HZ) { print = 1; last_msg = now; } spin_unlock_irqrestore(&lock, flags); } if (print) { if (printk_ratelimit()) printk(KERN_WARNING "audit: audit_lost=%d audit_rate_limit=%d " "audit_backlog_limit=%d\n", atomic_read(&audit_lost), audit_rate_limit, audit_backlog_limit); audit_panic(message); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enable the PWM interrupt of the PWM module. //! The */
void PWMIntEnable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
/* Enable the PWM interrupt of the PWM module. //! The */ void PWMIntEnable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); xASSERT((ulIntType == PWM_INT_CAP_BOTH) || (ulIntType == PWM_INT_CAP_FALL) || (ulIntType == PWM_INT_CAP_RISE) || (ulIntType == PWM_INT_PWM)); if (ulIntType == PWM_INT_PWM) { xHWREG(ulBase + PWM_PIER) |= (PWM_PIER_PWMIE0 << ulChannelTemp); } else { xHWREG(ulBase + PWM_CCR0 + (ulChannelTemp >> 1)*4) |= (ulIntType << ((ulChannel % 2) ? 16 : 0)); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Enable or disable the reset of all MMC counter after reading. */
void ETH_MMC_ResetAfterReadCmd(en_functional_state_t enNewState)
/* Enable or disable the reset of all MMC counter after reading. */ void ETH_MMC_ResetAfterReadCmd(en_functional_state_t enNewState)
{ DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); WRITE_REG32(bCM_ETH->MMC_MMCCTLR_b.ROR, enNewState); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* We don't care whether we support the comments in this file or not; if we can't, we'll offer the user the option of discarding the comments. */
gboolean cf_can_save(capture_file *cf)
/* We don't care whether we support the comments in this file or not; if we can't, we'll offer the user the option of discarding the comments. */ gboolean cf_can_save(capture_file *cf)
{ if (cf->unsaved_changes && wtap_dump_can_write(cf->linktypes, 0)) { return TRUE; } if (cf->is_tempfile && !cf->unsaved_changes) { return TRUE; } return FALSE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* 8-bit packed CIE L*a*b 1976 samples => RGB */
DECLAREContigPutFunc(putcontig8bitCIELab)
/* 8-bit packed CIE L*a*b 1976 samples => RGB */ DECLAREContigPutFunc(putcontig8bitCIELab)
{ float X, Y, Z; uint32 r, g, b; (void) y; fromskew *= 3; for( ; h > 0; --h) { for (x = w; x > 0; --x) { TIFFCIELabToXYZ(img->cielab, (unsigned char)pp[0], (signed char)pp[1], (signed char)pp[2], &X, &Y, &Z); TIFFXYZToRGB(img->cielab, X, Y, Z, &r, &g, &b); *cp++ = PACK(r, g, b); pp += 3; } cp += toskew; pp += fromskew; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* set_reg() - Write a register of a LogiCore DP TX device @dev: The LogiCore DP TX device in question @reg: The offset of the register to write @value: The value to write to the register */
static void set_reg(struct udevice *dev, u32 reg, u32 value)
/* set_reg() - Write a register of a LogiCore DP TX device @dev: The LogiCore DP TX device in question @reg: The offset of the register to write @value: The value to write to the register */ static void set_reg(struct udevice *dev, u32 reg, u32 value)
{ struct dp_tx *dp_tx = dev_get_priv(dev); axi_write(dev->parent, dp_tx->base + reg, &value, AXI_SIZE_32); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This routine find the offset of the last period '.' of string. if No period exists function FileNameExtension is set to L'\0' */
STATIC VOID SplitFileNameExtension(IN CHAR16 *FileName, OUT CHAR16 *FileNameFirst, OUT CHAR16 *FileNameExtension)
/* This routine find the offset of the last period '.' of string. if No period exists function FileNameExtension is set to L'\0' */ STATIC VOID SplitFileNameExtension(IN CHAR16 *FileName, OUT CHAR16 *FileNameFirst, OUT CHAR16 *FileNameExtension)
{ UINTN Index; UINTN StringLen; StringLen = StrLen (FileName); for (Index = StringLen; Index > 0 && FileName[Index] != L'.'; Index--) { } if ((Index == 0) && (FileName[Index] != L'.')) { FileNameExtension[0] = L'\0'; Index = StringLen; } else { StrCpyS (FileNameExtension, MAX_FILE_NAME_LEN, &FileName[Index+1]); } StrnCpyS (FileNameFirst, MAX_FILE_NAME_LEN, FileName, Index); FileNameFirst[Index] = L'\0'; }
tianocore/edk2
C++
Other
4,240
/* BFA FCS itnim timeout callback. Context: Interrupt. bfad_lock is held */
void bfa_fcb_itnim_tov(struct bfad_itnim_s *itnim)
/* BFA FCS itnim timeout callback. Context: Interrupt. bfad_lock is held */ void bfa_fcb_itnim_tov(struct bfad_itnim_s *itnim)
{ itnim->state = ITNIM_STATE_TIMEOUT; }
robutest/uclinux
C++
GPL-2.0
60
/* Load one empty frame buffer in queue to CSI module. Load one empty frame in queue to CSI module, this function could only be called when there is empty frame buffer in queue. */
static void CSI_TransferLoadBufferToDevice(CSI_Type *base, csi_handle_t *handle)
/* Load one empty frame buffer in queue to CSI module. Load one empty frame in queue to CSI module, this function could only be called when there is empty frame buffer in queue. */ static void CSI_TransferLoadBufferToDevice(CSI_Type *base, csi_handle_t *handle)
{ CSI_SetRxBufferAddr(base, handle->nextBufferIdx, handle->frameBufferQueue[handle->queueDrvReadIdx]); handle->queueDrvReadIdx = CSI_TransferIncreaseQueueIdx(handle->queueDrvReadIdx); handle->activeBufferNum++; handle->nextBufferIdx ^= 1U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* assume the authority to instantiate the specified key */
long keyctl_assume_authority(key_serial_t id)
/* assume the authority to instantiate the specified key */ long keyctl_assume_authority(key_serial_t id)
{ struct key *authkey; long ret; ret = -EINVAL; if (id < 0) goto error; if (id == 0) { ret = keyctl_change_reqkey_auth(NULL); goto error; } authkey = key_get_instantiation_authkey(id); if (IS_ERR(authkey)) { ret = PTR_ERR(authkey); goto error; } ret = keyctl_change_reqkey_auth(authkey); if (ret < 0) goto error; key_put(authkey); ret = authkey->serial; error: return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* fc_vport_sched_delete - workq-based delete request for a vport @work: vport to be deleted. */
static void fc_vport_sched_delete(struct work_struct *work)
/* fc_vport_sched_delete - workq-based delete request for a vport @work: vport to be deleted. */ static void fc_vport_sched_delete(struct work_struct *work)
{ struct fc_vport *vport = container_of(work, struct fc_vport, vport_delete_work); int stat; stat = fc_vport_terminate(vport); if (stat) dev_printk(KERN_ERR, vport->dev.parent, "%s: %s could not be deleted created via " "shost%d channel %d - error %d\n", __func__, dev_name(&vport->dev), vport->shost->host_no, vport->channel, stat); }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns true if payload checksum error is set in the extended status. Valid only when enhaced status available is set in RDES0 bit 0. This is valid only for Enhanced Descriptor. */
bool synopGMAC_ES_is_IP_payload_error(synopGMACdevice *gmacdev, u32 ext_status)
/* This function returns true if payload checksum error is set in the extended status. Valid only when enhaced status available is set in RDES0 bit 0. This is valid only for Enhanced Descriptor. */ bool synopGMAC_ES_is_IP_payload_error(synopGMACdevice *gmacdev, u32 ext_status)
{ return ((ext_status & DescRxIpPayloadError) != 0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Write to the head of the buffer and check that the same value can be read. */
ZTEST(display_read_write, test_write_to_buffer_head)
/* Write to the head of the buffer and check that the same value can be read. */ ZTEST(display_read_write, test_write_to_buffer_head)
{ uint8_t data[4] = {0xFA, 0xAF, 0x9F, 0xFA}; uint8_t height = (is_tiled ? 8 : 1); uint16_t width = sizeof(data) / bpp; uint16_t buf_size = width * bpp; struct display_buffer_descriptor desc = { .height = height, .pitch = width, .width = width, .buf_size = buf_size, }; display_write(dev, 0, 0, &desc, data); verify_bytes_of_area(data, 0, 0, width, height); verify_background_color(0, height, display_width, display_height - height, 0); verify_background_color(width, 0, display_width - width, display_height, 0); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint64Add(IN UINT64 Augend, IN UINT64 Addend, OUT UINT64 *Result)
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUint64Add(IN UINT64 Augend, IN UINT64 Addend, OUT UINT64 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if ((Augend + Addend) >= Augend) { *Result = (Augend + Addend); Status = RETURN_SUCCESS; } else { *Result = UINT64_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Check the busy status of the specified SPI port. */
xtBoolean SPIIsBusy(unsigned long ulBase)
/* Check the busy status of the specified SPI port. */ xtBoolean SPIIsBusy(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY) ? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Callback that gets called everytime there is new data. It is registered by */
inv_error_t inv_generate_results(struct inv_sensor_cal_t *sensor_cal)
/* Callback that gets called everytime there is new data. It is registered by */ inv_error_t inv_generate_results(struct inv_sensor_cal_t *sensor_cal)
{ rh.sensor = sensor_cal; return INV_SUCCESS; }
Luos-io/luos_engine
C++
MIT License
496
/* Put a Message into a Queue or timeout if Queue is full. */
osStatus_t osMessageQueuePut(osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout)
/* Put a Message into a Queue or timeout if Queue is full. */ osStatus_t osMessageQueuePut(osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout)
{ status = isrRtxMessageQueuePut(mq_id, msg_ptr, msg_prio, timeout); } else { status = __svcMessageQueuePut(mq_id, msg_ptr, msg_prio, timeout); } return status; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeGPIOOutput(unsigned long ulPort, unsigned char ucPins)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypeGPIOOutput(unsigned long ulPort, unsigned char ucPins)
{ ASSERT(GPIOBaseValid(ulPort)); GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_OUT); GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); }
watterott/WebRadio
C++
null
71
/* Enumerate the child dev array parsed from VBT to check whether the LVDS is present. If it is present, return 1. If it is not present, return false. If no child dev is parsed from VBT, it assumes that the LVDS is present. Note: The addin_offset should also be checked for LVDS panel. Only when it is non-zero, it is assumed that it is present. */
static int lvds_is_present_in_vbt(struct drm_device *dev)
/* Enumerate the child dev array parsed from VBT to check whether the LVDS is present. If it is present, return 1. If it is not present, return false. If no child dev is parsed from VBT, it assumes that the LVDS is present. Note: The addin_offset should also be checked for LVDS panel. Only when it is non-zero, it is assumed that it is present. */ static int lvds_is_present_in_vbt(struct drm_device *dev)
{ struct drm_i915_private *dev_priv = dev->dev_private; struct child_device_config *p_child; int i, ret; if (!dev_priv->child_dev_num) return 1; ret = 0; for (i = 0; i < dev_priv->child_dev_num; i++) { p_child = dev_priv->child_dev + i; if (p_child->device_type != DEVICE_TYPE_INT_LFP && p_child->device_type != DEVICE_TYPE_LFP) continue; if (p_child->addin_offset) { ret = 1; break; } } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Install the ACPI table as a configuration table. */
efi_status_t efi_acpi_register(void)
/* Install the ACPI table as a configuration table. */ efi_status_t efi_acpi_register(void)
{ u64 acpi = U32_MAX; efi_status_t ret; ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, EFI_RUNTIME_SERVICES_DATA, 16, &acpi); if (ret != EFI_SUCCESS) return ret; assert(!(acpi & 0xf)); write_acpi_tables(acpi); return efi_install_configuration_table(&acpi_guid, (void *)(uintptr_t)acpi); }
4ms/stm32mp1-baremetal
C++
Other
137
/* function to generate fake receive request for ISO OUT EP. ISO OUT endpoint does not generate irq by itself and reading from ISO OUT ep is synchronized with SOF frame. For more details refer to Nordic usbd specification. */
static void usbd_sof_trigger_iso_read(void)
/* function to generate fake receive request for ISO OUT EP. ISO OUT endpoint does not generate irq by itself and reading from ISO OUT ep is synchronized with SOF frame. For more details refer to Nordic usbd specification. */ static void usbd_sof_trigger_iso_read(void)
{ struct usbd_event *ev; struct nrf_usbd_ep_ctx *ep_ctx; ep_ctx = endpoint_ctx(NRF_USBD_COMMON_EPOUT8); if (!ep_ctx) { LOG_ERR("There is no ISO ep"); return; } if (ep_ctx->cfg.en) { ep_ctx->read_pending = true; ep_ctx->read_complete = true; ev = usbd_evt_alloc(); if (!ev) { LOG_ERR("Failed to alloc evt"); return; } ev->evt_type = USBD_EVT_EP; ev->evt.ep_evt.evt_type = EP_EVT_RECV_REQ; ev->evt.ep_evt.ep = ep_ctx; usbd_evt_put(ev); usbd_work_schedule(); } else { LOG_DBG("Endpoint is not enabled"); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Generates Ramdom hex number reading some time varient system registers and using md5 algorithm */
unsigned char get_random_hex(void)
/* Generates Ramdom hex number reading some time varient system registers and using md5 algorithm */ unsigned char get_random_hex(void)
{ int i; u32 inbuf[BUFLEN]; u8 outbuf[BUFLEN]; writel(readl(KW_REG_UNDOC_0x1478) & ~(1 << 7), KW_REG_UNDOC_0x1478); for (i = 0; i < BUFLEN; i++) { inbuf[i] = readl(KW_REG_UNDOC_0x1470); } md5((u8 *) inbuf, (BUFLEN * sizeof(u32)), outbuf); return outbuf[outbuf[7] % 0x0f]; }
EmcraftSystems/u-boot
C++
Other
181
/* XXX - add explanatory secondary text for at least some of the errors; various HIGs suggest that you should, for example, suggest that the user remove files if the file system is full. Perhaps that's because they're providing guidelines for people less sophisticated than the typical Wireshark user is, but.... */
void open_failure_alert_box(const char *filename, int err, gboolean for_writing)
/* XXX - add explanatory secondary text for at least some of the errors; various HIGs suggest that you should, for example, suggest that the user remove files if the file system is full. Perhaps that's because they're providing guidelines for people less sophisticated than the typical Wireshark user is, but.... */ void open_failure_alert_box(const char *filename, int err, gboolean for_writing)
{ gchar *display_basename; display_basename = g_filename_display_basename(filename); simple_message_box(ESD_TYPE_ERROR, NULL, NULL, file_open_error_message(err, for_writing), display_basename); g_free(display_basename); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Output a single byte to the usb client port. */
void usbtty_putc(const char c)
/* Output a single byte to the usb client port. */ void usbtty_putc(const char c)
{ if (!usbtty_configured ()) return; buf_push (&usbtty_output, &c, 1); if (c == '\n') buf_push (&usbtty_output, "\r", 1); if ((usbtty_output.size + 2) >= usbtty_output.totalsize) { usbtty_poll (); } }
EmcraftSystems/u-boot
C++
Other
181
/* Check if request is within bounds and page aligned. */
static int valid_swap_request(struct ramzswap *rzs, struct bio *bio)
/* Check if request is within bounds and page aligned. */ static int valid_swap_request(struct ramzswap *rzs, struct bio *bio)
{ if (unlikely( (bio->bi_sector >= (rzs->disksize >> SECTOR_SHIFT)) || (bio->bi_sector & (SECTORS_PER_PAGE - 1)) || (bio->bi_vcnt != 1) || (bio->bi_size != PAGE_SIZE) || (bio->bi_io_vec[0].bv_offset != 0))) { return 0; } return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* This function allocates an aligned buffer for the SCSI device to perform SCSI pass through operations. The alignment requirement is from SCSI pass through interface. */
VOID* AllocateAlignedBuffer(IN SCSI_IO_DEV *ScsiIoDevice, IN UINTN BufferSize)
/* This function allocates an aligned buffer for the SCSI device to perform SCSI pass through operations. The alignment requirement is from SCSI pass through interface. */ VOID* AllocateAlignedBuffer(IN SCSI_IO_DEV *ScsiIoDevice, IN UINTN BufferSize)
{ return AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), ScsiIoDevice->ScsiIo.IoAlign); }
tianocore/edk2
C++
Other
4,240
/* Write data to TCP socket This function is used to transmit a message to another socket. sendto */
INT16 CC3000_EXPORT() sendto(INT32 sd, const void *buf, INT32 len, INT32 flags, const sockaddr *to, socklen_t tolen)
/* Write data to TCP socket This function is used to transmit a message to another socket. sendto */ INT16 CC3000_EXPORT() sendto(INT32 sd, const void *buf, INT32 len, INT32 flags, const sockaddr *to, socklen_t tolen)
{ return(simple_link_send(sd, buf, len, flags, to, tolen, HCI_CMND_SENDTO)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This is called locally and also from flush_fpu_ipi_handler(). */
void arch_flush_local_fpu(void)
/* This is called locally and also from flush_fpu_ipi_handler(). */ void arch_flush_local_fpu(void)
{ __ASSERT((csr_read(mstatus) & MSTATUS_IEN) == 0, "must be called with IRQs disabled"); __ASSERT((csr_read(mstatus) & MSTATUS_FS) == 0, "must be called with FPU access disabled"); struct k_thread *owner = atomic_ptr_get(&_current_cpu->arch.fpu_owner); if (owner != NULL) { bool dirty = (_current_cpu->arch.fpu_state == MSTATUS_FS_DIRTY); if (dirty) { csr_set(mstatus, MSTATUS_FS_CLEAN); z_riscv_fpu_save(&owner->arch.saved_fp_context); } owner->arch.fpu_recently_used = dirty; csr_clear(mstatus, MSTATUS_FS); atomic_ptr_clear(&_current_cpu->arch.fpu_owner); DBG("disable", owner); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* SPI3 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */
void SPI3_IRQHandler(void)
/* SPI3 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */ void SPI3_IRQHandler(void)
{ unsigned long ulEventFlags; unsigned long ulBase = SPI3_BASE; ulEventFlags = xHWREG(ulBase + SPI_STATUS); xHWREG(ulBase + SPI_STATUS) |= ulEventFlags; if(g_pfnSPIHandlerCallbacks[3]) { g_pfnSPIHandlerCallbacks[3](0, 0, ulEventFlags, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* RETURNS: 0 on success, -EEXIST if entry with the given name already exists. */
int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
/* RETURNS: 0 on success, -EEXIST if entry with the given name already exists. */ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
{ int ret; ret = __sysfs_add_one(acxt, sd); if (ret == -EEXIST) { char *path = kzalloc(PATH_MAX, GFP_KERNEL); WARN(1, KERN_WARNING "sysfs: cannot create duplicate filename '%s'\n", (path == NULL) ? sd->s_name : strcat(strcat(sysfs_pathname(acxt->parent_sd, path), "/"), sd->s_name)); kfree(path); } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieve IRQ number for the given hardware instance. */
static IRQn_Type _afec_get_irq_num(const struct _adc_async_device *const device)
/* Retrieve IRQ number for the given hardware instance. */ static IRQn_Type _afec_get_irq_num(const struct _adc_async_device *const device)
{ if (device->hw == AFEC0) { return AFEC0_IRQn; } else if (device->hw == AFEC1) { return AFEC1_IRQn; } return (IRQn_Type)-1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the 8-bit PCI configuration register specified by Address, performs a bitwise AND between the read result and the value specified by AndData, and writes the result to the 8-bit PCI configuration register specified by Address. The value written to the PCI configuration register is returned. This function must guarantee that all PCI read and write operations are serialized. If any reserved bits in Address are set, then ASSERT(). */
UINT8 EFIAPI PciSegmentAnd8(IN UINT64 Address, IN UINT8 AndData)
/* Reads the 8-bit PCI configuration register specified by Address, performs a bitwise AND between the read result and the value specified by AndData, and writes the result to the 8-bit PCI configuration register specified by Address. The value written to the PCI configuration register is returned. This function must guarantee that all PCI read and write operations are serialized. If any reserved bits in Address are set, then ASSERT(). */ UINT8 EFIAPI PciSegmentAnd8(IN UINT64 Address, IN UINT8 AndData)
{ return PciSegmentWrite8 (Address, (UINT8)(PciSegmentRead8 (Address) & AndData)); }
tianocore/edk2
C++
Other
4,240
/* Informs application whether the APB bus write operation to the LPTIMx_ARR register has been successfully completed. If so, a new one can be initiated. @rmtoll ISR ARROK LPTIM_IsActiveFlag_ARROK. */
uint32_t LPTIM_IsActiveFlag_ARROK(LPTIM_Module *LPTIMx)
/* Informs application whether the APB bus write operation to the LPTIMx_ARR register has been successfully completed. If so, a new one can be initiated. @rmtoll ISR ARROK LPTIM_IsActiveFlag_ARROK. */ uint32_t LPTIM_IsActiveFlag_ARROK(LPTIM_Module *LPTIMx)
{ return (((READ_BIT(LPTIMx->INTSTS,LPTIM_INTSTS_ARRUPD) ==LPTIM_INTSTS_ARRUPD)? 1UL : 0UL)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Writes one pixel to the LCD controller. DMDIF_prepareDataAccess() needs to be called before writing data using this function. */
EMSTATUS DMDIF_writeDataRepeated(uint32_t data, int len)
/* Writes one pixel to the LCD controller. DMDIF_prepareDataAccess() needs to be called before writing data using this function. */ EMSTATUS DMDIF_writeDataRepeated(uint32_t data, int len)
{ *data_register = pixelData; } return DMD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Synchronous I/O uses a stack-allocated iocb. Thus we can't trust the iocb is still valid here if this is a synchronous request. */
static void nfs_direct_complete(struct nfs_direct_req *dreq)
/* Synchronous I/O uses a stack-allocated iocb. Thus we can't trust the iocb is still valid here if this is a synchronous request. */ static void nfs_direct_complete(struct nfs_direct_req *dreq)
{ if (dreq->iocb) { long res = (long) dreq->error; if (!res) res = (long) dreq->count; aio_complete(dreq->iocb, res, 0); } complete_all(&dreq->completion); nfs_direct_req_release(dreq); }
robutest/uclinux
C++
GPL-2.0
60
/* Return the number of cores on this SOC. */
int cpu_numcores(void)
/* Return the number of cores on this SOC. */ int cpu_numcores(void)
{ int numcores; u32 mask; mask = cpu_mask(); numcores = hweight32(cpu_mask()); if (mask & 0x1) numcores--; return numcores; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Utility function to clear an IRQn bit in a NVIC enable/disable mask. */
void CORE_NvicMaskClearIRQ(IRQn_Type irqN, CORE_nvicMask_t *mask)
/* Utility function to clear an IRQn bit in a NVIC enable/disable mask. */ void CORE_NvicMaskClearIRQ(IRQn_Type irqN, CORE_nvicMask_t *mask)
{ EFM_ASSERT((irqN >= 0) && (irqN < EXT_IRQ_COUNT)); mask->a[irqN >> 5] &= ~(1 << (irqN & 0x1F)); }
remotemcu/remcu-chip-sdks
C++
null
436
/* ADC Enable Analog Watchdog for All Regular and/or Injected Channels. The analog watchdog allows the monitoring of an analog signal between two threshold levels. The thresholds must be preset. Comparison is done before data alignment takes place, so the thresholds are left-aligned. */
void adc_enable_analog_watchdog_on_all_channels(uint32_t adc)
/* ADC Enable Analog Watchdog for All Regular and/or Injected Channels. The analog watchdog allows the monitoring of an analog signal between two threshold levels. The thresholds must be preset. Comparison is done before data alignment takes place, so the thresholds are left-aligned. */ void adc_enable_analog_watchdog_on_all_channels(uint32_t adc)
{ ADC_CFGR1(adc) &= ~ADC_CFGR1_AWD1SGL; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Error_Handler(void)
{ BSP_LED_Off(LED2); BSP_LED_On(LED3); while(1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Bottom-up (legacy) layout on X86_32 did not support randomization, X86_64 does, but not when emulating X86_32 */
static unsigned long mmap_legacy_base(void)
/* Bottom-up (legacy) layout on X86_32 did not support randomization, X86_64 does, but not when emulating X86_32 */ static unsigned long mmap_legacy_base(void)
{ if (mmap_is_ia32()) return TASK_UNMAPPED_BASE; else return TASK_UNMAPPED_BASE + mmap_rnd(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* serial core request to do any port required autoconfiguration */
static void bcm_uart_config_port(struct uart_port *port, int flags)
/* serial core request to do any port required autoconfiguration */ static void bcm_uart_config_port(struct uart_port *port, int flags)
{ if (flags & UART_CONFIG_TYPE) { if (bcm_uart_request_port(port)) return; port->type = PORT_BCM63XX; } }
robutest/uclinux
C++
GPL-2.0
60
/* Function: s390_vary_chpid Varies the specified chpid online or offline */
static int s390_vary_chpid(struct chp_id chpid, int on)
/* Function: s390_vary_chpid Varies the specified chpid online or offline */ static int s390_vary_chpid(struct chp_id chpid, int on)
{ char dbf_text[15]; int status; sprintf(dbf_text, on?"varyon%x.%02x":"varyoff%x.%02x", chpid.cssid, chpid.id); CIO_TRACE_EVENT(2, dbf_text); status = chp_get_status(chpid); if (!on && !status) return 0; set_chp_logically_online(chpid, on); chsc_chp_vary(chpid, on); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the current setting of the ADC reference. */
uint32_t ADCReferenceGet(uint32_t ui32Base)
/* Returns the current setting of the ADC reference. */ uint32_t ADCReferenceGet(uint32_t ui32Base)
{ ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE)); return(HWREG(ui32Base + ADC_O_CTL) & ADC_CTL_VREF_M); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This function sets memory encryption bit for the memory region specified by BaseAddress and NumPages from the current page table context. */
RETURN_STATUS EFIAPI MemEncryptSevSetPageEncMask(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
/* This function sets memory encryption bit for the memory region specified by BaseAddress and NumPages from the current page table context. */ RETURN_STATUS EFIAPI MemEncryptSevSetPageEncMask(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
{ return InternalMemEncryptSevSetMemoryEncrypted ( Cr3BaseAddress, BaseAddress, EFI_PAGES_TO_SIZE (NumPages) ); }
tianocore/edk2
C++
Other
4,240
/* Disbles or disables the EMMC NAND ECC feature. */
void EMMC_DisableNANDECC(EMMC_BANK_NAND_T bank)
/* Disbles or disables the EMMC NAND ECC feature. */ void EMMC_DisableNANDECC(EMMC_BANK_NAND_T bank)
{ if(bank == EMMC_BANK2_NAND) { EMMC_Bank2->CTRL2 &= 0x000FFFBF; } else { EMMC_Bank3->CTRL3 &= 0x000FFFBF; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Note, other stuff like background garbage collection may be added here in future. */
int ubifs_bg_thread(void *info)
/* Note, other stuff like background garbage collection may be added here in future. */ int ubifs_bg_thread(void *info)
{ int err; struct ubifs_info *c = info; dbg_msg("background thread \"%s\" started, PID %d", c->bgt_name, current->pid); set_freezable(); while (1) { if (kthread_should_stop()) break; if (try_to_freeze()) continue; set_current_state(TASK_INTERRUPTIBLE); if (!c->need_bgt) { if (kthread_should_stop()) break; schedule(); continue; } else __set_current_state(TASK_RUNNING); c->need_bgt = 0; err = ubifs_bg_wbufs_sync(c); if (err) ubifs_ro_mode(c, err); run_bg_commit(c); cond_resched(); } dbg_msg("background thread \"%s\" stops", c->bgt_name); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the PRINCE Sub-Region Enable register. This function gets PRINCE SR_ENABLE register. */
status_t PRINCE_GetRegionSREnable(PRINCE_Type *base, prince_region_t region, uint32_t *sr_enable)
/* Gets the PRINCE Sub-Region Enable register. This function gets PRINCE SR_ENABLE register. */ status_t PRINCE_GetRegionSREnable(PRINCE_Type *base, prince_region_t region, uint32_t *sr_enable)
{ status_t status = kStatus_Success; switch (region) { case kPRINCE_Region0: *sr_enable = base->SR_ENABLE0; break; case kPRINCE_Region1: *sr_enable = base->SR_ENABLE1; break; case kPRINCE_Region2: *sr_enable = base->SR_ENABLE2; break; default: status = kStatus_InvalidArgument; break; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* : Added code to handle cpu migration and do safe irq migration without losing interrupts for iosapic architecture. 'what should we do if we get a hw irq event on an illegal vector'. each architecture has to answer this themselves. */
void ack_bad_irq(unsigned int irq)
/* : Added code to handle cpu migration and do safe irq migration without losing interrupts for iosapic architecture. 'what should we do if we get a hw irq event on an illegal vector'. each architecture has to answer this themselves. */ void ack_bad_irq(unsigned int irq)
{ printk(KERN_ERR "Unexpected irq vector 0x%x on CPU %u!\n", irq, smp_processor_id()); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sets pointers to @tfm & @tfm_mutex matching @cipher_name. Searches for cached item first, and creates new if not found. Returns 0 on success, non-zero if adding new cipher failed */
int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm, struct mutex **tfm_mutex, char *cipher_name)
/* Sets pointers to @tfm & @tfm_mutex matching @cipher_name. Searches for cached item first, and creates new if not found. Returns 0 on success, non-zero if adding new cipher failed */ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm, struct mutex **tfm_mutex, char *cipher_name)
{ struct ecryptfs_key_tfm *key_tfm; int rc = 0; (*tfm) = NULL; (*tfm_mutex) = NULL; mutex_lock(&key_tfm_list_mutex); if (!ecryptfs_tfm_exists(cipher_name, &key_tfm)) { rc = ecryptfs_add_new_key_tfm(&key_tfm, cipher_name, 0); if (rc) { printk(KERN_ERR "Error adding new key_tfm to list; " "rc = [%d]\n", rc); goto out; } } (*tfm) = key_tfm->key_tfm; (*tfm_mutex) = &key_tfm->key_tfm_mutex; out: mutex_unlock(&key_tfm_list_mutex); return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* return kStatus_Success: Success in setting the time and starting the SNVS RTC kStatus_InvalidArgument: Error because the datetime format is incorrect */
status_t SNVS_HP_RTC_SetDatetime(SNVS_Type *base, const snvs_hp_rtc_datetime_t *datetime)
/* return kStatus_Success: Success in setting the time and starting the SNVS RTC kStatus_InvalidArgument: Error because the datetime format is incorrect */ status_t SNVS_HP_RTC_SetDatetime(SNVS_Type *base, const snvs_hp_rtc_datetime_t *datetime)
{ assert(datetime); uint32_t seconds = 0U; uint32_t tmp = base->HPCR; SNVS_HP_RTC_StopTimer(base); if (!(SNVS_HP_CheckDatetimeFormat(datetime))) { return kStatus_InvalidArgument; } seconds = SNVS_HP_ConvertDatetimeToSeconds(datetime); base->HPRTCMR = (uint32_t)(seconds >> 17U); base->HPRTCLR = (uint32_t)(seconds << 15U); if (tmp & SNVS_HPCR_RTC_EN_MASK) { SNVS_HP_RTC_StartTimer(base); } return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535