/* Obtains the segment as the specified index from the linked list with firmware data.  */
tFirmwareSegment* FirmwareGetSegment(uint32_t segmentIdx)
/* Obtains the segment as the specified index from the linked list with firmware data.  */
tFirmwareSegment* FirmwareGetSegment(uint32_t segmentIdx)
{
  tFirmwareSegment * currentSegment = NULL;
  uint32_t currentIdx;
  assert(segmentIdx < FirmwareGetSegmentCount());
  if (segmentIdx < FirmwareGetSegmentCount())
  {
    if (segmentList != NULL)
    {
      currentSegment = segmentList;
      for (currentIdx = 0; currentIdx < segmentIdx; currentIdx++)
      {
        currentSegment = currentSegment->next;
        assert(currentSegment != NULL);
        if (currentSegment == NULL)
        {
          break;
        }
      }
    }
  }
  return currentSegment;
}