board_commons.h File Reference

Board common features definitions. More...

#include <stdio.h>
#include "common_defs.h"
#include "com_phy_layer.h"

Go to the source code of this file.

Data Structures

struct  cmd_table
 Board commands table entry. More...
struct  board_data
 Data common to every board. More...

Functions

UINT8 ror_bits (UINT8 data, int num_bits)
 Perfoms a num_bits bitwise right rotation of data byte.
UINT8 swap_bits (UINT8 data)
 Swaps the bits of the source byte.
void delay (int msec)
 Waits for specified time.
UINT32 get_time ()
 Gets the time in milliseconds since first procedure call.
DLL_API BOOL board_open (board_data *p_data, const CPLConfig *p_com_config, const cmd_table *p_cmd_table)
 Basic board open.
DLL_API BOOL board_close (board_data *p_data)
 Basic board close.
DLL_API BOOL send_buffer (board_data *p_data, const UINT8 *buff, UINT16 buff_size)
 Sends a data buffer to board.
DLL_API BOOL receive_buffer (board_data *p_data, UINT8 *buff, UINT16 *buff_size, int timeout_msec)
 Read up to *buff_size BYTEs from board.
DLL_API BOOL send_cmd (board_data *p_data, int cmd_index, int cmd_value)
 Sends a command to the board.


Detailed Description

Board common features definitions.

Author:
NDA
Version:
1.0
Date:
07/2008
Boards common APIs: typically level 0 APIs These APIs provide features common to every board.

Definition in file board_commons.h.


Function Documentation

DLL_API BOOL board_close ( board_data p_data  ) 

Basic board close.

Provides basic handling for board closing, common to all the boards. It tries to close the communication channel, too.

Parameters:
p_data Pointer to board data
Returns:
TRUE: board successfully closed
Note:
This API if typically called by derived boards during close procedure.

Definition at line 217 of file board_commons.c.

References FALSE, board_data::m_p_cpl_object, board_data::m_p_last_sent_cmd, and TRUE.

Referenced by N1568_close().

DLL_API BOOL board_open ( board_data p_data,
const CPLConfig *  p_com_config,
const cmd_table p_cmd_table 
)

Basic board open.

Provides basic handling for board opening, common to all the boards. It tries to open the communication channel, too.

Parameters:
p_data Pointer to board data
p_com_config The communication physical layer device settings
p_cmd_table The board specific command table pointer
Returns:
TRUE: board successfully opened
Note:
This API if typically called by derived boards during open procedure.

Definition at line 190 of file board_commons.c.

References FALSE, board_data::m_p_cmd_table, board_data::m_p_cpl_object, board_data::m_p_last_sent_cmd, and TRUE.

Referenced by N1568_open().

void delay ( int  msec  ) 

Waits for specified time.

Parameters:
msec The time delay to wait (msec)

Definition at line 74 of file board_commons.c.

UINT32 get_time (  ) 

Gets the time in milliseconds since first procedure call.

Returns:
The time in milliseconds since first procedure call

Definition at line 88 of file board_commons.c.

DLL_API BOOL receive_buffer ( board_data p_data,
UINT8 *  buff,
UINT16 *  buff_size,
int  timeout_msec 
)

Read up to *buff_size BYTEs from board.

Parameters:
p_data Pointer to board data
buff The user allocated buffer
buff_size The user allocated buffer size (on enter) and the number of BYTEs read (on exit)
timeout_msec The timeout between bytes receive (msec)
Returns:
TRUE read procedure ok

Definition at line 263 of file board_commons.c.

References FALSE, board_data::m_p_cpl_object, and TRUE.

Referenced by N1568_export(), N1568_send_cmd(), and N1568_set_module().

UINT8 ror_bits ( UINT8  data,
int  num_bits 
)

Perfoms a num_bits bitwise right rotation of data byte.

Parameters:
data The source byte to rotate
num_bits The number of bits to rotate
Returns:
Converted data

Definition at line 48 of file board_commons.c.

DLL_API BOOL send_buffer ( board_data p_data,
const UINT8 *  buff,
UINT16  buff_size 
)

Sends a data buffer to board.

Parameters:
p_data Pointer to board data
buff The data buffer to send
buff_size The data buffer size (BYTEs)
Returns:
TRUE send procedure ok

Definition at line 243 of file board_commons.c.

References FALSE, board_data::m_p_cpl_object, and TRUE.

Referenced by send_cmd().

DLL_API BOOL send_cmd ( board_data p_data,
int  cmd_index,
int  cmd_value 
)

Sends a command to the board.

Parameters:
p_data Pointer to board data
cmd_index The index of the command (as from the board specific COMMANDS enumerator)
cmd_value The value of the command
Returns:
TRUE send procedure ok

Definition at line 305 of file board_commons.c.

References FALSE, cmd_table::m_cmd_string, cmd_table::m_max_value, board_data::m_p_cmd_table, board_data::m_p_last_sent_cmd, and send_buffer().

Referenced by N1568_export(), N1568_send_cmd(), and N1568_set_module().

UINT8 swap_bits ( UINT8  data  ) 

Swaps the bits of the source byte.

Parameters:
data The source byte to swap
Returns:
Converted data

Definition at line 60 of file board_commons.c.


Generated on Mon Oct 6 09:30:09 2008 for CAEN N1568 SDK by  doxygen 1.5.6