04 To be handled ...


To be handled ...

The previous example used the flxWriteToFile handler of flux. In the embedded area, you probably will use a dedicated channel for trace data. To do so, you just need to add a handler function like below:
 

	flxresult myHandler(flxbyte command, void* buffer, flxbint* len,
			flxbyte* bytes, void*user) {
	
		// just write the data to a file
		fwrite(bytes, *len, 1, (FILE*) user);
		return FLX_OK;
	}

The parameters you need are:

  • flxbint* len: The length of data in the buffer.
  • flxbyte* bytes: A pointer to the data.
  • void* user: The user data pointer (optional).
To apply the handler to any buffer, just apply the function pointer as parameter to the flxCreateXXXBuffer function. Optionally you can add a user pointer, in this example the FILE object pointer.
 
	// static memory
	unsigned char memoryBuffer[bufferSize];
	unsigned char memoryTrace[traceSize];

	// buffer
	flxBuffer buffer = flxCreateFixedBuffer(memoryBuffer, bufferSize,
			myHandler, out);

toem

technical software and tooling

Company

Contact Us

This email address is being protected from spambots. You need JavaScript enabled to view it.