Low-Level I/O Functions | |
Output | size_t __write(int handle,const unsigned char ∗buf,size_t bufSize) { size_t i; for (i=0; i<bufSize; i++) { send_data(buf[i]); } return i; } |
Input | size_t __read(int handle,unsigned char ∗buf,size_t bufSize) { size_t i; for (i=0; i <bufSize; i++) { // Wait for character available while(data_ready() ==0); buf[i] = get_data(); // Get data } return i; } |
char txt_buf[10];
…
scanf ("%s", txt_buf);
scanf ("%9s", txt_buf); // Maximum 9 characters
scanf ("%9[0-9a-zA-Z ]s", txt_buf); // Maximum 9 characters
fgets(txt_buf, 9, stdin);
Table 18.1
CMSIS-CORE interrupt control functions
Function | Descriptions |
void NVIC_EnableIRQ(IRQn_Type IRQn); | Enable an interrupt. This function does not apply to system exceptions. |
void NVIC_DisableIRQ(IRQn_Type IRQn); | Disable an interrupt. This function does not apply to system exceptions. |
void NVIC_SetPendingIRQ(IRQn_Type IRQn); | Set the pending status of an interrupt. This function does not apply to system exceptions. |
void NVIC_ClearPendingIRQ(IRQn_Type IRQn); | Clear the pending status of an interrupt. This function does not apply to system exceptions. |
uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn); | Obtain the interrupt pending status of an interrupt. This function does not apply to system exceptions. |
void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority); | Set up the priority level of an interrupt or system exception. The priority level value is automatically shifted to the implemented bits in the priority level register. |
uint32_t NVIC_GetPriority(IRQn_Type IRQn); | Obtain the priority level of an interrupt or system exception. The priority level is automatically shifted to remove unimplemented bits in the priority level values. |
void __enable_irq(void); | Clear PRIMASK—enable interrupts and system exceptions. |
void __disable_irq(void); | Set PRIMASK—disable all interrupt including system exceptions (apart from HardFault and NMI). |
NVIC_EnableIRQ(UART0_IRQn); // Enable UART0 Interrupt
__disable_irq(); // Set PRIMASK - disable interrupts
… ; // time critical tasks
__enable_irq(); // clear PRIMASK - enable interrupts
Version | Description |
V4.00 | Added: Cortex-M7 support. Added: intrinsic functions for __RRX, __LDRBT, __LDRHT, __LDRT, __STRBT, __STRHT, and __STRT |
V3.40 | Corrected: C++ include guard settings. |
V3.30 | Added: COSMIC tool chain support. Corrected: GCC __SMLALDX instruction intrinsic for Cortex-M4. Corrected: GCC __SMLALD instruction intrinsic for Cortex-M4. Corrected: GCC/CLang warnings. |
V3.20 | Added: __BKPT instruction intrinsic. Added: __SMMLA instruction intrinsic for Cortex-M4. Corrected: ITM_SendChar (for ARM®v7-M architecture). Corrected: __enable_irq, __disable_irq and inline assembly for GCC Compiler. Corrected: NVIC_GetPriority and VTOR_TBLOFF for Cortex-M0/M0+, SC000. Corrected: rework of inline assembly functions to remove potential compiler warnings. |
V3.01 | Added support for Cortex-M0+ processor. |
V3.00 | Added support for GNU GCC ARM Embedded Compiler. Added function __ROR. Added Register Mapping for TPIU, DWT (for ARMv7-M architecture). Added support for SC000 and SC300 processors. Corrected ITM_SendChar function (for ARMv7-M architecture). Corrected the functions __STREXB, __STREXH, __STREXW for the GNU GCC compiler section. Documentation restructured. |
V2.10 | Updated documentation. Updated CMSIS core include files. Changed CMSIS/Device folder structure. Added support for Cortex-M0, Cortex-M4 w/o FPU to CMSIS DSP library. Reworked CMSIS DSP library examples. |
V2.00 | Added support for Cortex-M4 processor. |
V1.30 | Reworked Startup Concept. Added additional Debug Functionality. Changed folder structure. Added doxygen comments. Added definitions for bit. |
Table Continued |
Version | Description |
V1.01 | Added support for Cortex-M0 processor. |
V1.01 | Added intrinsic functions for __LDREXB, __LDREXH, __LDREXW, __STREXB, __STREXH, __STREXW, and __CLREX (for ARMv7-M architecture) |
V1.00 | Initial Release for Cortex-M3 processor. |
3.15.147.215