rename ICACHE_RAM_ATTR to CALLED_FROM_INTERRUPT

This commit is contained in:
Thorsten von Eicken 2015-12-04 21:12:40 -08:00
parent 144bf2e020
commit dcea5d3a9e
6 changed files with 23 additions and 22 deletions

View File

@ -22,16 +22,6 @@
#include "trigger.h"
#endif
#ifdef ESP8266
// For the esp8266 we need to add ICACHE_RAM_ATTR to all functions that may execute at
// interrupt time so they get loaded into static RAM instead of flash. We define
// it as a no-op for everyone else. Not pretty, but perhaps the least obscure?
#define ICACHE_RAM_ATTR __attribute__((section(".iram1.text")))
#else
#define ICACHE_RAM_ATTR
#endif
// ----------------------------------------------------------------------------
// WATCH CALLBACKS
JshEventCallbackCallback jshEventCallbacks[EV_EXTI_MAX+1-EV_EXTI0];
@ -239,7 +229,7 @@ bool jshHasTransmitData() {
/**
* flag that the buffer has overflowed.
*/
void ICACHE_RAM_ATTR jshIOEventOverflowed() {
void CALLED_FROM_INTERRUPT jshIOEventOverflowed() {
// Error here - just set flag so we don't dump a load of data out
jsErrorFlags |= JSERR_RX_FIFO_FULL;
}
@ -303,7 +293,7 @@ void jshPushIOCharEvent(
* Signal an IO watch event as having happened.
*/
// on the esp8266 we need this to be loaded into static RAM because it can run at interrupt time
void ICACHE_RAM_ATTR jshPushIOWatchEvent(
void CALLED_FROM_INTERRUPT jshPushIOWatchEvent(
IOEventFlags channel //!< The channel on which the IO watch event has happened.
) {
assert(channel >= EV_EXTI0 && channel <= EV_EXTI_MAX);
@ -331,7 +321,7 @@ void ICACHE_RAM_ATTR jshPushIOWatchEvent(
/**
* Add this IO event to the IO event queue.
*/
void ICACHE_RAM_ATTR jshPushIOEvent(
void CALLED_FROM_INTERRUPT jshPushIOEvent(
IOEventFlags channel, //!< The event to add to the queue.
JsSysTime time //!< The time that the event is thought to have happened.
) {

View File

@ -69,6 +69,17 @@ char *flash_strncpy(char *dest, const char *source, size_t cap);
#endif
#if defined(ESP8266)
// For the esp8266 we need to add CALLED_FROM_INTERRUPT to all functions that may execute at
// interrupt time so they get loaded into static RAM instead of flash. We define
// it as a no-op for everyone else. This is identical the ICACHE_RAM_ATTR used elsewhere.
#define CALLED_FROM_INTERRUPT __attribute__((section(".iram1.text")))
#else
#define CALLED_FROM_INTERRUPT
#endif
#if !defined(__USB_TYPE_H) && !defined(CPLUSPLUS) && !defined(__cplusplus) // it is defined in this file too!
#undef FALSE
#undef TRUE

View File

@ -21,7 +21,7 @@
// The linking is arranged to put all functions into IROM, so we need a special define to put
// a function into IRAM
#define ICACHE_RAM_ATTR __attribute__((section(".iram1.text")))
#define CALLED_FROM_INTERRUPT __attribute__((section(".iram1.text")))
//Missing function prototypes in include folders. Gcc will warn on these if we don't define 'em anywhere.
//MOST OF THESE ARE GUESSED! but they seem to work and shut up the compiler.

View File

@ -61,7 +61,7 @@ LOCAL uint8 pinSDA, pinSCL; // actual gpio pins used
* uint8 SCL
* Returns : NONE
*******************************************************************************/
LOCAL void ICACHE_RAM_ATTR
LOCAL void CALLED_FROM_INTERRUPT
i2c_master_setDC(uint8 SDA, uint8 SCL)
{
SDA &= 0x01;
@ -85,7 +85,7 @@ i2c_master_setDC(uint8 SDA, uint8 SCL)
* Returns : uint8 - SDA bit value
*******************************************************************************/
#if 0
LOCAL uint8 ICACHE_RAM_ATTR
LOCAL uint8 CALLED_FROM_INTERRUPT
i2c_master_getDC(void)
{
return (GPIO_REG_READ(GPIO_IN_ADDRESS) >> pinSDA) & 1;

View File

@ -147,7 +147,7 @@ void jshInit() {
* We have arrived in this callback function because the state of a GPIO pin has changed
* and it is time to record that change.
*/
static void ICACHE_RAM_ATTR intrHandlerCB(
static void CALLED_FROM_INTERRUPT intrHandlerCB(
uint32 interruptMask, //!< A mask indicating which GPIOs have changed.
void *arg //!< Optional argument.
) {
@ -448,7 +448,7 @@ void jshPinSetValue(
* Get the value of the corresponding pin.
* \return The current value of the pin.
*/
bool ICACHE_RAM_ATTR jshPinGetValue( // can be called at interrupt time
bool CALLED_FROM_INTERRUPT jshPinGetValue( // can be called at interrupt time
Pin pin //!< The pin to have its value read.
) {
//os_printf("> ESP8266: jshPinGetValue pin=%d, value=%d\n", pin, GPIO_INPUT_GET(pin));
@ -537,7 +537,7 @@ void jshEnableWatchDog(JsVarFloat timeout) {
/**
* Get the state of the pin associated with the event flag.
*/
bool ICACHE_RAM_ATTR jshGetWatchedPinState(IOEventFlags eventFlag) { // can be called at interrupt time
bool CALLED_FROM_INTERRUPT jshGetWatchedPinState(IOEventFlags eventFlag) { // can be called at interrupt time
//os_printf("> jshGetWatchedPinState eventFlag=%d\n", eventFlag);
if (eventFlag > EV_EXTI_MAX || eventFlag < EV_EXTI0) {
@ -919,7 +919,7 @@ static void saveTime() {
/**
* Return the current time in microseconds.
*/
JsSysTime ICACHE_RAM_ATTR jshGetSystemTime() { // in us -- can be called at interrupt time
JsSysTime CALLED_FROM_INTERRUPT jshGetSystemTime() { // in us -- can be called at interrupt time
return sysTimeStamp.timeStamp + (JsSysTime)(system_get_time() - sysTimeStamp.hwTimeStamp);
} // End of jshGetSystemTime

View File

@ -235,7 +235,7 @@ void at_port_print(const char *str) __attribute__((alias("uart0_sendStr")));
* Parameters : void *para - point to ETS_UART_INTR_ATTACH's arg
* Returns : NONE
*******************************************************************************/
LOCAL ICACHE_RAM_ATTR void
LOCAL CALLED_FROM_INTERRUPT void
uart0_rx_intr_handler(void *para)
{
/* uart0 and uart1 intr combine togther, when interrupt occur, see reg 0x3ff20020, bit2, bit0 represents
@ -643,7 +643,7 @@ void tx_start_uart_buffer(uint8 uart_no)
#endif
static ICACHE_RAM_ATTR void uart_rx_intr_disable(uint8 uart_no)
static CALLED_FROM_INTERRUPT void uart_rx_intr_disable(uint8 uart_no)
{
#if 1
CLEAR_PERI_REG_MASK(UART_INT_ENA(uart_no), UART_RXFIFO_FULL_INT_ENA|UART_RXFIFO_TOUT_INT_ENA);