#ifndef BA_H_
#define BA_H_

#include <system.h>
#include <nand.h>
#include <req.h>
#include <scsi_layer.h>

typedef enum {
	BA_TYPE_TM,
	BA_TYPE_CHM
} caller_t;

typedef struct ba_specific_st {
  uint32_t  chip_idx;
  cdb_t     cdb;
  handler_t notifier;
  uint8_t cdb_buf[NAND_TOTAL_SIZE];

  caller_t caller_type;

  enum {
    BA_INITIAL,
    BA_TM_READY,
    BA_CHM_READY,
    BA_ALMOST_DONE,
    BA_DONE
  } state; // should be enum
} ba_specific_t;

void baInit();

req_t* baRequest(handler_t notifier, uint32_t chip_idx, uint8_t caller_type) ;

void baHandler(req_t* req, void* response);


#endif
