#include <stdio.h>
#include <string.h>
 
#define TEST_ASSERT(Expr)                       if (!(Expr)) { printf("%s:%u: assertion failure\n", __FUNCTION__, __LINE__); while (1) ;}
#define TEST_ASSERT_EQUAL(expected, actual)     if ((expected) != (actual)) {printf("%s:%u: assertion failure\n", __FUNCTION__, __LINE__); while (1) ;}
#define TEST_ASSERT_NOT_EQUAL(expected, actual) if ((expected) == (actual)) {printf("%s:%u: assertion failure\n", __FUNCTION__, __LINE__); while (1) ;}
 
void progressStateMachine(void);
 
static enum {
    NEEDS_INITIALIZATION,
    NEEDS_ERASE,
    NEEDS_PROGRAMMING,
    NEEDS_READ,
    NEEDS_VERIFICATION_FOLLOWING_READ,
    FINISHED
} state;
 
 
static const unsigned BUFFER_SIZE = 16384;
static uint8_t buffer[BUFFER_SIZE];
 
void main(int argc __unused, char** argv __unused)
{
    state = NEEDS_INITIALIZATION;
 
    progressStateMachine();
    while (true) {
        
    }
}
 
void progressStateMachine(void)
{
    int32_t rc;
 
        
    }
    TEST_ASSERT(firstBlock.
size > 0);
 
    switch (state) {
        case NEEDS_INITIALIZATION:
                state = NEEDS_ERASE;
                return; 
            }
            TEST_ASSERT_EQUAL(1, rc); 
 
            
 
        case NEEDS_ERASE:
                state = NEEDS_PROGRAMMING;
                return; 
            }
 
            
 
        case NEEDS_PROGRAMMING:
            #define PATTERN 0xAA
                state = NEEDS_READ;
                return;  
            }
 
            
 
        case NEEDS_READ:
                state = NEEDS_VERIFICATION_FOLLOWING_READ;
                return;  
            }
 
            
 
        case NEEDS_VERIFICATION_FOLLOWING_READ:
            printf("verifying data\r\n");
                TEST_ASSERT_EQUAL(PATTERN, buffer[i]);
            }
            state = FINISHED;
            printf("done\r\n");
            break;
 
        case FINISHED:
            break;
    } 
}
 
{
    (void)status;
    (void)operation;
    switch (operation) {
            progressStateMachine();
            break;
 
        default:
            printf("callbackHandler: unexpected callback for opcode %u with status %ld\r\n", operation, status);
            break;
    }
}