Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving platform independence #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Src/BoundaryScan.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "BoundaryScan.h"
#include "TAP.h"
#include "global.h"
#include "BSReg_Table.h"
#include "myString.h"
#include "jtagLowLevel.h"
Expand All @@ -20,7 +19,7 @@ extern TapState currentTapState;
void bSCInIt(volatile BSCell *bSC){
int i = 0;

while(i < BOUNDARY_SCAN_CELL_DIV_8){
while(i < BOUNDARY_SCAN_CELL_DIV_8 + 1){
bSC->bSCellPreloadData[i] = 0x00000000;
bSC->bSCellSampleData[i] = 0x00000000;
i++;
Expand All @@ -37,7 +36,10 @@ void jtagWriteAndReadBSCells(volatile BSCell *bSC, int length){
int count = 0;

// get rid of bypass bit for CORTEX M3 TAP
tdoData = jtagClkIoTms(oneBitData, 0);
for(int x=1; x < NUMBER_OF_TAPS; x++) {
tdoData = jtagClkIoTms(oneBitData, 0);
}

// noted that last bit of data must be set at next tap state
for (n = length ; n > 1; n--) {
oneBitData = dataMask & bSC->bSCellPreloadData[count/8];
Expand Down
7 changes: 4 additions & 3 deletions Src/BoundaryScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

#include <stdint.h>

#include "global.h"

// Boundary Scan MACROs
#define CORTEX_M3_BOUNDARY_SCAN_CELL_LENGTH 232
#define BOUNDARY_SCAN_CELL_DIV_8 CORTEX_M3_BOUNDARY_SCAN_CELL_LENGTH/8

typedef struct BSReg BSReg;
Expand All @@ -23,8 +24,8 @@ typedef enum{


typedef enum{
OUTPUT_PIN = 0,
INPUT_PIN = 1,
OUTPUT_PIN = !DISVAL,
INPUT_PIN = DISVAL,
}BSCPinMode;


Expand Down
3 changes: 3 additions & 0 deletions Src/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ typedef enum{
#define DUMMY_DATA 0x1234abcd
#define CORTEX_M3_BOUNDARY_SCAN_CELL_LENGTH 232

#define DISVAL 1
#define NUMBER_OF_TAPS 2

#define BUFFER_SIZE 1024
#define BSCELL_STR_LENGTH 16

Expand Down