| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
dfuutil_programming_dfu_ops.c File Reference
`#include "app_usbd_cfg.h"`
`#include "usbd_desc.h"`
`#include "usbd_mscuser.h"`
`#include "usbd.h"`
`#include "usbd_core.h"`
`#include "usbd_hw.h"`
`#include "usbd_rom_api.h"`
`#include "board.h"`
`#include "dfuutil_programming_api.h"`
`#include "string.h"`

Go to the source code of this file.

## Macros
#define | USBMSGBUFFSIZE 1024
#define | USBROMBUFFSIZE 0x2000

## Functions
static void | tickDelayMS (int ticks)
static void | usbDebugSetup (void)
static int | usbDebugFill (void *buff, int max)
static int | usbDFUAppend (char *ptr, void *data, uint32_t bytes)
static int | usbDFUBuildStatus (void *buffer)
static int | usbDFUReturnStatus (void *buffer)
static void | usbDFUSetVerbose (uint32_t addr)
static void | usbDFUEraseAll (void)
static void | usbDFUEraseRegion (uint32_t addr, uint32_t size)
static void | usbDFUProgRegion (uint32_t addr, uint32_t size)
static void | usbDFUReadRegion (uint32_t addr, uint32_t size)
static void | usbDFUReset (void)
static void | usbDFUExecute (uint32_t addr)
static void | dfu_detach (USBD_HANDLE_T hUsb)
static void | dfu_done (void)
void | USB0_IRQHandler (void)
void | USB1_IRQHandler (void)
static bool | checkMagicHeader (DFU_FROMHOST_PACKETHDR_T *pOutHdr)
static uint8_t | dfu_wr (uint32_t block_num, uint8_t **pBuff, uint32_t length, uint8_t *bwPollTimeout)
static uint32_t | dfu_rd (uint32_t block_num, uint8_t **pBuff, uint32_t length)
static ErrorCode_t | usb_dfu_init (USBD_HANDLE_T hUsb, USB_INTERFACE_DESCRIPTOR *pIntfDesc, uint32_t *mem_base, uint32_t *mem_size)
static uint32_t | algo_dfu_setup (void)
static void | lpc18xx43xx_sys_reset (void)
static void | usbPllSetup (void)
| Sets up the USB PLL.
static void | dfu_util_process (void)
void | SysTick_Handler (void)
| SysTick 1mS tick handler.
void | usbDebug (char *tmp)
| Queues a message for DFU status transfer.
int | main (void)
| Main program body.

## Variables
static USBD_HANDLE_T | hUsb
static DFUPROG_REGION_T * | dfuprog_regions
static volatile uint32_t | currStatus
static volatile uint32_t | hostCmd
static volatile uint32_t | currCmdAddr
static volatile uint32_t | currCmdSize
static volatile uint32_t | u32Milliseconds
static char | usbBuff [USBMSGBUFFSIZE]
static volatile int | usbStrIn
static volatile int | usbStrOut
static uint32_t | dfuIn [((sizeof(DFU_TOHOST_PACKETHDR_T)+64+4096)/sizeof(uint32_t))]
static uint32_t | dfuOut [((sizeof(DFU_FROMHOST_PACKETHDR_T)+4096+sizeof(uint32_t))/sizeof(uint32_t))]
static uint32_t | dfuProgBuff [(4096/sizeof(uint32_t))]
static volatile uint32_t | inPktSize
static volatile uint32_t | inPktSizeIdx
static volatile uint32_t | outPktSizeIdx
static volatile uint32_t | progSize
static char | tmpStr [64]
static bool | verifyDebug = true
uint8_t | USB_DeviceDescriptor []
uint8_t | USB_FsConfigDescriptor []
uint8_t | USB_HsConfigDescriptor []
uint8_t | USB_StringDescriptor []
uint8_t | USB_DeviceQualifier []
volatile uint32_t | dfu_done_algo = 0
volatile uint32_t | dfu_detach_algo = 0

## Macro Definition Documentation

#define USBMSGBUFFSIZE 1024

Definition at line 67 of file dfuutil_programming_dfu_ops.c.

#define USBROMBUFFSIZE 0x2000

Definition at line 89 of file dfuutil_programming_dfu_ops.c.

## Function Documentation

static uint32_t algo_dfu_setup | ( | void |  | ) |
| static

Definition at line 535 of file dfuutil_programming_dfu_ops.c.

static bool checkMagicHeader | ( | DFU_FROMHOST_PACKETHDR_T * | pOutHdr | ) |
| static

Definition at line 303 of file dfuutil_programming_dfu_ops.c.

static void dfu_detach | ( | USBD_HANDLE_T | hUsb | ) |
| static

Definition at line 281 of file dfuutil_programming_dfu_ops.c.

static void dfu_done | ( | void |  | ) |
| static

Definition at line 287 of file dfuutil_programming_dfu_ops.c.

static uint32_t dfu_rd | ( | uint32_t | block_num,
|  | uint8_t ** | pBuff,
|  | uint32_t | length
| ) |  |
| static

Definition at line 404 of file dfuutil_programming_dfu_ops.c.

static void dfu_util_process | ( | void |  | ) |
| static

Definition at line 603 of file dfuutil_programming_dfu_ops.c.

static uint8_t dfu_wr | ( | uint32_t | block_num,
|  | uint8_t ** | pBuff,
|  | uint32_t | length,
|  | uint8_t * | bwPollTimeout
| ) |  |
| static

Definition at line 317 of file dfuutil_programming_dfu_ops.c.

static void lpc18xx43xx_sys_reset | ( | void |  | ) |
| static

Definition at line 584 of file dfuutil_programming_dfu_ops.c.

int main | ( | void |  | ) |

Main program body.

main routine for example_lwip_tcpecho_sa_18xx43xx

Returns
  Always returns 0 (device reset prior to return)
  Function should not exit.

Definition at line 774 of file dfuutil_programming_dfu_ops.c.

void SysTick_Handler | ( | void |  | ) |

SysTick 1mS tick handler.

Returns
  None

Definition at line 747 of file dfuutil_programming_dfu_ops.c.

static void tickDelayMS | ( | int | ticks | ) |
| static

Definition at line 115 of file dfuutil_programming_dfu_ops.c.

void USB0_IRQHandler | ( | void |  | ) |

Definition at line 292 of file dfuutil_programming_dfu_ops.c.

void USB1_IRQHandler | ( | void |  | ) |

Definition at line 297 of file dfuutil_programming_dfu_ops.c.

static ErrorCode_t usb_dfu_init | ( | USBD_HANDLE_T | hUsb,
|  | USB_INTERFACE_DESCRIPTOR * | pIntfDesc,
|  | uint32_t * | mem_base,
|  | uint32_t * | mem_size
| ) |  |
| static

Definition at line 499 of file dfuutil_programming_dfu_ops.c.

static int usbDebugFill | ( | void * | buff,
|  | int | max
| ) |  |
| static

Definition at line 129 of file dfuutil_programming_dfu_ops.c.

static void usbDebugSetup | ( | void |  | ) |
| static

Definition at line 122 of file dfuutil_programming_dfu_ops.c.

static int usbDFUAppend | ( | char * | ptr,
|  | void * | data,
|  | uint32_t | bytes
| ) |  |
| static

Definition at line 164 of file dfuutil_programming_dfu_ops.c.

static int usbDFUBuildStatus | ( | void * | buffer | ) |
| static

Definition at line 172 of file dfuutil_programming_dfu_ops.c.

static void usbDFUEraseAll | ( | void |  | ) |
| static

Definition at line 219 of file dfuutil_programming_dfu_ops.c.

static void usbDFUEraseRegion | ( | uint32_t | addr,
|  | uint32_t | size
| ) |  |
| static

Definition at line 227 of file dfuutil_programming_dfu_ops.c.

static void usbDFUExecute | ( | uint32_t | addr | ) |
| static

Definition at line 271 of file dfuutil_programming_dfu_ops.c.

static void usbDFUProgRegion | ( | uint32_t | addr,
|  | uint32_t | size
| ) |  |
| static

Definition at line 239 of file dfuutil_programming_dfu_ops.c.

static void usbDFUReadRegion | ( | uint32_t | addr,
|  | uint32_t | size
| ) |  |
| static

Definition at line 251 of file dfuutil_programming_dfu_ops.c.

static void usbDFUReset | ( | void |  | ) |
| static

Definition at line 263 of file dfuutil_programming_dfu_ops.c.

static int usbDFUReturnStatus | ( | void * | buffer | ) |
| static

Definition at line 199 of file dfuutil_programming_dfu_ops.c.

static void usbDFUSetVerbose | ( | uint32_t | addr | ) |
| static

Definition at line 205 of file dfuutil_programming_dfu_ops.c.

static void usbPllSetup | ( | void |  | ) |
| static

Sets up the USB PLL.

Returns
  None

Definition at line 596 of file dfuutil_programming_dfu_ops.c.

## Variable Documentation

volatile uint32_t currCmdAddr
| static

Definition at line 61 of file dfuutil_programming_dfu_ops.c.

volatile uint32_t currCmdSize
| static

Definition at line 61 of file dfuutil_programming_dfu_ops.c.

volatile uint32_t currStatus
| static

Definition at line 57 of file dfuutil_programming_dfu_ops.c.

volatile uint32_t dfu_detach_algo = 0

Definition at line 108 of file dfuutil_programming_dfu_ops.c.

volatile uint32_t dfu_done_algo = 0

Definition at line 108 of file dfuutil_programming_dfu_ops.c.

uint32_t dfuIn[((sizeof(DFU_TOHOST_PACKETHDR_T)+64+4096)/sizeof(uint32_t))]
| static

Definition at line 75 of file dfuutil_programming_dfu_ops.c.

uint32_t dfuOut[((sizeof(DFU_FROMHOST_PACKETHDR_T)+4096+sizeof(uint32_t))/sizeof(uint32_t))]
| static

Definition at line 79 of file dfuutil_programming_dfu_ops.c.

DFUPROG_REGION_T* dfuprog_regions
| static

Definition at line 54 of file dfuutil_programming_dfu_ops.c.

uint32_t dfuProgBuff[(4096/sizeof(uint32_t))]
| static

Definition at line 82 of file dfuutil_programming_dfu_ops.c.

volatile uint32_t hostCmd
| static

Definition at line 58 of file dfuutil_programming_dfu_ops.c.

USBD_HANDLE_T hUsb
| static

Definition at line 51 of file dfuutil_programming_dfu_ops.c.

volatile uint32_t inPktSize
| static

Definition at line 85 of file dfuutil_programming_dfu_ops.c.

volatile uint32_t inPktSizeIdx
| static

Definition at line 85 of file dfuutil_programming_dfu_ops.c.

volatile uint32_t outPktSizeIdx
| static

Definition at line 85 of file dfuutil_programming_dfu_ops.c.

volatile uint32_t progSize
| static

Definition at line 85 of file dfuutil_programming_dfu_ops.c.

char tmpStr[64]
| static

Definition at line 92 of file dfuutil_programming_dfu_ops.c.

volatile uint32_t u32Milliseconds
| static

Definition at line 64 of file dfuutil_programming_dfu_ops.c.

uint8_t USB_DeviceDescriptor[]

uint8_t USB_DeviceQualifier[]

uint8_t USB_FsConfigDescriptor[]

uint8_t USB_HsConfigDescriptor[]

uint8_t USB_StringDescriptor[]

char usbBuff[USBMSGBUFFSIZE]
| static

Definition at line 70 of file dfuutil_programming_dfu_ops.c.

volatile int usbStrIn
| static

Definition at line 71 of file dfuutil_programming_dfu_ops.c.

volatile int usbStrOut
| static

Definition at line 71 of file dfuutil_programming_dfu_ops.c.

bool verifyDebug = true
| static

Definition at line 96 of file dfuutil_programming_dfu_ops.c.