C API for BALTECH SDK
dhwctrl.h File Reference

Low level hardware commands. More...

#include "../typedefs.h"

Go to the source code of this file.

Macros

#define BRP_DHWCtrl_ErrUnknownPort   BRP_ERR_STATUS(0xE000, 0x01)
 This port is not available on this hardware platform. More...
 
#define BRP_DHWCtrl_ErrMarshall   BRP_ERR_STATUS(0xE000, 0x02)
 The structure of a StartupRun-block is wrong or the command brp_DHWCtrl_GetStartupRun() has not properly been called. More...
 
#define BRP_DHWCtrl_ErrNoStartupRun   BRP_ERR_STATUS(0xE000, 0x03)
 There was no StartupRun-block, or the brp_DHWCtrl_GetStartupRun() command was not executed. More...
 
#define BRP_DHWCtrl_ErrNoPowermgr   BRP_ERR_STATUS(0xE000, 0x04)
 The Power Manager was unable to take the module into suspend mode. More...
 
#define BRP_DHWCtrl_ErrNoProdloader   BRP_ERR_STATUS(0xE000, 0x05)
 No production loader is present in the reader's flash memory. More...
 
#define BRP_DHWCtrl_ErrPfid2NotAvailable   BRP_ERR_STATUS(0xE000, 0x06)
 No PlatformID2 available. More...
 
#define BRP_DHWCtrl_ErrEepIndex   BRP_ERR_STATUS(0xE000, 0x11)
 Specified EEPROM address and amount of Bytes to write are not compatible. More...
 
#define BRP_DHWCtrl_ErrEepVerify   BRP_ERR_STATUS(0xE000, 0x12)
 Data written to EEPROM could not be verified. More...
 
#define BRP_DHWCtrl_ErrEepTimeout   BRP_ERR_STATUS(0xE000, 0x13)
 Data could not be written within timeout. More...
 
#define BRP_DHWCtrl_ErrDataflash   BRP_ERR_STATUS(0xE000, 0x20)
 Dataflash could not be found. More...
 
#define BRP_DHWCtrl_ErrDataflashTimeout   BRP_ERR_STATUS(0xE000, 0x21)
 Timeout occurred. More...
 
#define BRP_DHWCtrl_ErrDataflashVerify   BRP_ERR_STATUS(0xE000, 0x22)
 Verification failed after writing data. More...
 
#define BRP_DHWCtrl_ErrDataflashParam   BRP_ERR_STATUS(0xE000, 0x23)
 Parameter(s)/address(es) are not valid. More...
 
#define BRP_DHWCtrl_ErrDataflashSpi   BRP_ERR_STATUS(0xE000, 0x24)
 Communication via SPI interface failed. More...
 
#define BRP_DHWCtrl_ErrDataflashFlash   BRP_ERR_STATUS(0xE000, 0x25)
 Flash device behaves in an unspecified manner. More...
 
#define BRP_DHWCtrl_ErrAvrProgSpi   BRP_ERR_STATUS(0xE000, 0x30)
 SPI programming instruction couldn't be executed successfully. More...
 
#define BRP_DHWCtrl_ErrAvrProgPdi   BRP_ERR_STATUS(0xE000, 0x31)
 PDI operation couldn't be executed successfully. More...
 
#define BRP_DHWCtrl_ErrNicNoData   BRP_ERR_STATUS(0xE000, 0x50)
 No data was received by NIC. More...
 
#define BRP_DHWCtrl_ErrNicBufferFlow   BRP_ERR_STATUS(0xE000, 0x51)
 Received data was to big for buffer. More...
 

Functions

brp_errcode brp_DHWCtrl_PortConfig (brp_protocol protocol, unsigned Port, unsigned Mode)
 Configures a port. More...
 
brp_errcode brp_DHWCtrl_PortGet (brp_protocol protocol, unsigned Port, bool *Level)
 Reads the current input of a port. More...
 
brp_errcode brp_DHWCtrl_PortSet (brp_protocol protocol, unsigned Port, bool Level)
 Sets the state of a port. More...
 
brp_errcode brp_DHWCtrl_PortWait (brp_protocol protocol, unsigned Port, bool Level, unsigned Timeout, unsigned *ReactionTime)
 Waits until a port has reached the specified level, or until timeout. More...
 
brp_errcode brp_DHWCtrl_GetResetCause (brp_protocol protocol, unsigned *ResetCause)
 Returns the cause of the microcontroller's last reset. More...
 
brp_errcode brp_DHWCtrl_APortMeasure (brp_protocol protocol, unsigned Port, unsigned Count, unsigned **Voltages, size_t *Voltages_len, brp_mempool *mempool)
 The selected ADC Clock is MCU Clock / 128 (i.e. More...
 
brp_errcode brp_DHWCtrl_SRAMTest (brp_protocol protocol, unsigned SramSize, bool *Success)
 Tests the external SRAM. More...
 
brp_errcode brp_DHWCtrl_SetBaudrate (brp_protocol protocol, brp_Baudrate NewBaudrate)
 Changes the baudrate. More...
 
brp_errcode brp_DHWCtrl_MirrorData (brp_protocol protocol, brp_buf Data, size_t Data_len, brp_buf *MirroredData, size_t *MirroredData_len, brp_mempool *mempool)
 Sends the exact same data back. More...
 
brp_errcode brp_DHWCtrl_DispEnable (brp_protocol protocol, bool Enable)
 Enables the Display. More...
 
brp_errcode brp_DHWCtrl_DispBacklight (brp_protocol protocol, bool Backlight)
 Enables the Baltech reader display's backlight. More...
 
brp_errcode brp_DHWCtrl_DispColor (brp_protocol protocol, unsigned Color)
 Set the drawing color. More...
 
brp_errcode brp_DHWCtrl_DispContrast (brp_protocol protocol, unsigned Contrast)
 Changes the display contrast. More...
 
brp_errcode brp_DHWCtrl_DispBox (brp_protocol protocol, unsigned X, unsigned Y, unsigned Width, unsigned Height)
 Draws a filled box. More...
 
brp_errcode brp_DHWCtrl_Ser2Ctrl (brp_protocol protocol, unsigned InterfaceID, bool Enable, brp_Baudrate NewBaudrate, brp_Parity NewParity, unsigned Stopbits)
 Enable/Disable and setup the reader's 2nd RS-232/UART interface. More...
 
brp_errcode brp_DHWCtrl_Ser2WriteRead (brp_protocol protocol, unsigned MaxReadCount, unsigned Timeout, brp_buf WriteData, size_t WriteData_len, brp_buf *ReadData, size_t *ReadData_len, brp_mempool *mempool)
 Write/Read data to/from the reader's 2nd RS-232/UART interface. More...
 
brp_errcode brp_DHWCtrl_Ser2Flush (brp_protocol protocol)
 Wait until output to 2nd RS-232/UART interface is sent out. More...
 
brp_errcode brp_DHWCtrl_Delay1ms (brp_protocol protocol, unsigned Delay)
 Sleeps for some milliseconds. More...
 
brp_errcode brp_DHWCtrl_Delay10us (brp_protocol protocol, unsigned Delay)
 Sleeps for some microseconds. More...
 
brp_errcode brp_DHWCtrl_PowermgrSuspend (brp_protocol protocol, unsigned Delay, bool KeyboardWakeup)
 Takes the board into suspend mode, i.e. More...
 
brp_errcode brp_DHWCtrl_ScanMatrix (brp_protocol protocol, unsigned Bitmask)
 Writes a bitmask to the 573, which is used for keyboard scanning. More...
 
brp_errcode brp_DHWCtrl_GetReaderChipType (brp_protocol protocol, brp_DHWCtrl_GetReaderChipType_ChipType *ChipType)
 Returns the RC reader chip type. More...
 
brp_errcode brp_DHWCtrl_SelectAntenna (brp_protocol protocol, unsigned Ant)
 Switch external antenna. More...
 
brp_errcode brp_DHWCtrl_GetSamType (brp_protocol protocol, brp_DHWCtrl_GetSamType_ChipType *ChipType)
 Returns the RC reader chip type. More...
 
brp_errcode brp_DHWCtrl_HfAcquire (brp_protocol protocol, brp_DHWCtrl_HfAcquire_ModuleId ModuleId)
 Acquire specific HF Subsystem. More...
 
brp_errcode brp_DHWCtrl_EepromWrite (brp_protocol protocol, unsigned Address, brp_buf Data, size_t Data_len)
 Writes data to an arbitrary address in the EEPROM. More...
 
brp_errcode brp_DHWCtrl_DataflashGetSize (brp_protocol protocol, unsigned Device, unsigned *PageCount, unsigned *PageSize)
 Retrieves the flash size. More...
 
brp_errcode brp_DHWCtrl_DataflashErasePages (brp_protocol protocol, unsigned Device, unsigned StartPage, unsigned Len)
 Erase a group of pages. More...
 
brp_errcode brp_DHWCtrl_DataflashRead (brp_protocol protocol, unsigned Device, unsigned Page, unsigned StartAdr, unsigned Len, brp_buf *Data, size_t *Data_len, brp_mempool *mempool)
 Read data within a certain page. More...
 
brp_errcode brp_DHWCtrl_DataflashWrite (brp_protocol protocol, unsigned Device, unsigned Mode, unsigned Page, unsigned StartAdr, brp_buf Data, size_t Data_len)
 Write data to a certain page. More...
 
brp_errcode brp_DHWCtrl_EepromRead (brp_protocol protocol, unsigned StartAdr, unsigned Len, brp_buf *Data, size_t *Data_len, brp_mempool *mempool)
 Reads data from the EEPROM. More...
 
brp_errcode brp_DHWCtrl_SecurityAndConfigReset (brp_protocol protocol)
 Reset configuration incl. More...
 
brp_errcode brp_DHWCtrl_PulseGenerate (brp_protocol protocol, unsigned Port, unsigned Frequency)
 Generates a pulse of specified frequency on a certain pin. More...
 
brp_errcode brp_DHWCtrl_InitSer2 (brp_protocol protocol)
 Initializes the serial2 module. More...
 
brp_errcode brp_DHWCtrl_InitRtc (brp_protocol protocol)
 Initializes the rtc module. More...
 
brp_errcode brp_DHWCtrl_InitLcdDrv (brp_protocol protocol)
 Initializes the display module. More...
 
brp_errcode brp_DHWCtrl_InitRc (brp_protocol protocol)
 Initializes the rc module. More...
 
brp_errcode brp_DHWCtrl_InitMf (brp_protocol protocol)
 Initializes the Mifare module. More...
 
brp_errcode brp_DHWCtrl_InitIso14A (brp_protocol protocol)
 Initializes the ISO14443A module. More...
 
brp_errcode brp_DHWCtrl_InitIso14B (brp_protocol protocol)
 Initializes the ISO14443B module. More...
 
brp_errcode brp_DHWCtrl_InitIso15 (brp_protocol protocol)
 Initializes the ISO15693 module. More...
 
brp_errcode brp_DHWCtrl_InitLg (brp_protocol protocol)
 Initializes the Legic module. More...
 
brp_errcode brp_DHWCtrl_InitLga (brp_protocol protocol)
 Initializes the Legic Advant module. More...
 
brp_errcode brp_DHWCtrl_InitDf (brp_protocol protocol)
 Initializes the dataflash module. More...
 
brp_errcode brp_DHWCtrl_InitRc125 (brp_protocol protocol)
 Initializes the RC125 module. More...
 
brp_errcode brp_DHWCtrl_InitCc (brp_protocol protocol)
 Initializes the TDA8007 or CCUART module. More...
 
brp_errcode brp_DHWCtrl_InitUsbHost (brp_protocol protocol)
 Initializes the USB-Host module. More...
 
brp_errcode brp_DHWCtrl_InitNic (brp_protocol protocol)
 Initializes the Network Interface (NIC) module. More...
 
brp_errcode brp_DHWCtrl_BohEnable (brp_protocol protocol, bool Enable, bool Bug6WorkaroundEnabled)
 Enables the BRP over HID interface. More...
 
brp_errcode brp_DHWCtrl_NicEnable (brp_protocol protocol, bool Enable)
 Enables the Network Interface. More...
 
brp_errcode brp_DHWCtrl_NicGetChipType (brp_protocol protocol, brp_buf *ChipType, size_t *ChipType_len, brp_mempool *mempool)
 Returns the chip type of the Network Interface. More...
 
brp_errcode brp_DHWCtrl_NicGetLinkStatus (brp_protocol protocol, unsigned *LinkStatus)
 Retrieve the Link status of the Network Interface. More...
 
brp_errcode brp_DHWCtrl_NicSend (brp_protocol protocol, brp_buf SendData, size_t SendData_len)
 Sends a frame via the Network Interface. More...
 
brp_errcode brp_DHWCtrl_NicReceive (brp_protocol protocol, unsigned Timeout, brp_buf *RecvData, size_t *RecvData_len, brp_mempool *mempool)
 Receives a frame from the Network Interface. More...
 
brp_errcode brp_DHWCtrl_NicSetMAC (brp_protocol protocol, brp_buf MAC)
 Set the MAC address of the Network Interface. More...
 
brp_errcode brp_DHWCtrl_ApspiSetSpeed (brp_protocol protocol, unsigned Speed)
 Set the speed of SPI programming mode. More...
 
brp_errcode brp_DHWCtrl_ApspiEnable (brp_protocol protocol, bool Enable)
 Enables/disables the SPI programming mode of a connected slave AVR. More...
 
brp_errcode brp_DHWCtrl_ApspiSingleSend (brp_protocol protocol, unsigned CmdCode, unsigned Address, unsigned CmdData, unsigned Delay)
 Send a single SPI programming instruction. More...
 
brp_errcode brp_DHWCtrl_ApspiSingleRecv (brp_protocol protocol, unsigned CmdCode, unsigned Address, unsigned *CmdData)
 Send a single SPI programming instruction and receive one data byte. More...
 
brp_errcode brp_DHWCtrl_ApspiAlternateSend (brp_protocol protocol, unsigned CmdCodeA, unsigned CmdCodeB, unsigned Address, brp_buf CmdData, size_t CmdData_len, unsigned Delay)
 Send alternately SPI programming instructions. More...
 
brp_errcode brp_DHWCtrl_ApspiAlternateRecv (brp_protocol protocol, unsigned CmdCodeA, unsigned CmdCodeB, unsigned Address, unsigned CmdDataLen, brp_buf *CmdData, size_t *CmdData_len, brp_mempool *mempool)
 Send alternately SPI programming instructions and receive data bytes. More...
 
brp_errcode brp_DHWCtrl_PdiEnable (brp_protocol protocol, bool Enable)
 Enables/disables the PDI programming mode of a connected target AVR. More...
 
brp_errcode brp_DHWCtrl_PdiEraseDevice (brp_protocol protocol)
 Erases the target chip device. More...
 
brp_errcode brp_DHWCtrl_PdiReadFlash (brp_protocol protocol, unsigned Adr, unsigned ReadLen, brp_buf *ReadData, size_t *ReadData_len, brp_mempool *mempool)
 Read flash memory from target device. More...
 
brp_errcode brp_DHWCtrl_PdiEraseFlashPage (brp_protocol protocol, unsigned Adr)
 Erase flash page. More...
 
brp_errcode brp_DHWCtrl_PdiWriteFlashPage (brp_protocol protocol, unsigned Adr, brp_buf WriteData, size_t WriteData_len)
 Write to internal flash page buffer. More...
 
brp_errcode brp_DHWCtrl_PdiProgramFlashPage (brp_protocol protocol, unsigned Adr)
 Program flash page. More...
 
brp_errcode brp_DHWCtrl_PdiReadEeprom (brp_protocol protocol, unsigned Adr, unsigned ReadLen, brp_buf *ReadData, size_t *ReadData_len, brp_mempool *mempool)
 Read eeprom memory from target device. More...
 
brp_errcode brp_DHWCtrl_PdiProgramEepromPage (brp_protocol protocol, unsigned Adr, brp_buf WriteData, size_t WriteData_len)
 Write an eeprom page to target device. More...
 
brp_errcode brp_DHWCtrl_PdiReadFuses (brp_protocol protocol, unsigned Adr, unsigned ReadLen, brp_buf *ReadData, size_t *ReadData_len, brp_mempool *mempool)
 Read fuse memory from target device. More...
 
brp_errcode brp_DHWCtrl_PdiWriteFuse (brp_protocol protocol, unsigned Adr, unsigned Fuse)
 Write a fuse byte to target device. More...
 
brp_errcode brp_DHWCtrl_FlashGetPageSize (brp_protocol protocol, unsigned *PageSize)
 Retrieves the page size of the program flash. More...
 
brp_errcode brp_DHWCtrl_FlashErasePage (brp_protocol protocol, unsigned StartAdr, unsigned Len)
 Erases one or several consecutive program flash pages. More...
 
brp_errcode brp_DHWCtrl_FlashRead (brp_protocol protocol, unsigned StartAdr, unsigned Len, brp_buf *Data, size_t *Data_len, brp_mempool *mempool)
 Read data from program flash. More...
 
brp_errcode brp_DHWCtrl_FlashWritePage (brp_protocol protocol, unsigned StartAdr, brp_buf Data, size_t Data_len)
 Write to a temporary page buffer. More...
 
brp_errcode brp_DHWCtrl_FlashProgramPage (brp_protocol protocol, unsigned StartAdr)
 Program a page to program flash. More...
 
brp_errcode brp_DHWCtrl_RegisterRead (brp_protocol protocol, unsigned RegAdr, unsigned *RegValue)
 Read processor register. More...
 
brp_errcode brp_DHWCtrl_RegisterWrite (brp_protocol protocol, unsigned RegAdr, unsigned RegValue)
 Write processor register. More...
 
brp_errcode brp_DHWCtrl_AesWrapKey (brp_protocol protocol, brp_DHWCtrl_AesWrapKey_WrappedKeyNr WrappedKeyNr, brp_buf Key, size_t Key_len, brp_buf *WrappedKey, size_t *WrappedKey_len, brp_mempool *mempool)
 Wraps an AES key for secure storage. More...
 
brp_errcode brp_DHWCtrl_AesEncrypt (brp_protocol protocol, brp_DHWCtrl_AesEncrypt_WrappedKeyNr WrappedKeyNr, brp_buf Block, size_t Block_len, brp_buf Key, size_t Key_len, brp_buf *EncBlock, size_t *EncBlock_len, brp_mempool *mempool)
 Encrypts a block. More...
 
brp_errcode brp_DHWCtrl_AesDecrypt (brp_protocol protocol, brp_DHWCtrl_AesDecrypt_WrappedKeyNr WrappedKeyNr, brp_buf EncBlock, size_t EncBlock_len, brp_buf Key, size_t Key_len, brp_buf *Block, size_t *Block_len, brp_mempool *mempool)
 Decrypts a block. More...
 
brp_errcode brp_DHWCtrl_GetPlatformId2 (brp_protocol protocol, unsigned **HWCIdLst, size_t *HWCIdLst_len, brp_mempool *mempool)
 This command retrieves the PlatformId2. More...
 
brp_errcode brp_DHWCtrl_GetProdLoader (brp_protocol protocol, unsigned *LoaderBaudrate)
 Returns the baudrate Byte of the production-loader. More...
 
brp_errcode brp_DHWCtrl_StartProdLoader (brp_protocol protocol)
 Starts the production-loader. More...
 
brp_errcode brp_DHWCtrl_Run (brp_protocol protocol, brp_buf CommandList, size_t CommandList_len, unsigned *Status, brp_buf *Response, size_t *Response_len, brp_mempool *mempool)
 Executes a list of commands. More...
 
brp_errcode brp_DHWCtrl_GetStartupRun (brp_protocol protocol, unsigned *Status, brp_buf *Response, size_t *Response_len, brp_mempool *mempool)
 Returns the result of the execution of DHWCtrl-commands at the startup. More...
 
brp_errcode brp_DHWCtrl_InitBgm (brp_protocol protocol)
 Initializes the Bluetooth BGM12X chip. More...
 
brp_errcode brp_DHWCtrl_BgmExec (brp_protocol protocol, brp_buf Cmd, size_t Cmd_len, unsigned Timeout, brp_buf *Rsp, size_t *Rsp_len, brp_mempool *mempool)
 Execute a Bgm12X API command. More...
 
brp_errcode brp_DHWCtrl_Sm4x00BootloaderStart (brp_protocol protocol, brp_buf *BootloaderString, size_t *BootloaderString_len, brp_mempool *mempool)
 Start SM4x00 Bootloader. More...
 
brp_errcode brp_DHWCtrl_Sm4x00EraseFlash (brp_protocol protocol)
 Erase SM4x00 Flash. More...
 
brp_errcode brp_DHWCtrl_Sm4x00WaitForFlashErase (brp_protocol protocol, unsigned Timeout, brp_buf *EraseResponse, size_t *EraseResponse_len, brp_mempool *mempool)
 Check if flash erasing has been finished. More...
 
brp_errcode brp_DHWCtrl_Sm4x00ProgramBlock (brp_protocol protocol, bool IsLast, brp_buf FwBlock, size_t FwBlock_len, brp_buf *ProgramResponse, size_t *ProgramResponse_len, brp_mempool *mempool)
 Program one 128 byte block of SM4x00 firmware. More...
 
brp_errcode brp_DHWCtrl_BgmRead (brp_protocol protocol, unsigned Timeout, brp_buf *Rsp, size_t *Rsp_len, brp_mempool *mempool)
 Read from Bgm12X. More...
 

Detailed Description

Low level hardware commands.

These are usually commands to test the hardware and have very low level access to the AVR peripherals.

Definition in file dhwctrl.h.