Sonochan II 0.1

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

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
HW.h File Reference

HW controller for generic driver. More...

`#include "brd_driver_hw_03.h"`
`#include "tlv320aic33.h"`
`#include "cs2200.h"`
`#include <inttypes.h>`
`#include "generic_driver.h"`

Go to the source code of this file.

## Macros
#define | HW_MAX_DEVICE_ID 2
#define | HW_POINTER_ARRAY_TO_METADATA
Device list for generic driver
Here user define how is named variable with metadata of selected device. Maximum supported devices (for now): 10. Example of usage: // Link to .h file #include "some_driver.h" // Name of structure with metadata #define DEVICE0 some_driver_metadata #include "driver2.h" #define DEVICE1 driver2_metadata #include "extra_driver.h" #define DEVICE2 there_are_metadata_for_extra_driver
#define | DEVICE0 BRD_DRV_metadata
| Board driver. More...
#define | DEVICE1 TLV320AIC33_metadata
| TLV320AIC33 codec. More...
#define | DEVICE2 CS2200_metadata
| Fractional PLL CS2200. More...

## Functions
GD_RES_CODE | hw_get_setting (uint8_t i_device_ID, uint16_t i_cmd_ID, gd_config_struct *p_config_table)
| Get settings from defined device. More...
GD_RES_CODE | hw_set_setting (uint8_t i_device_ID, uint16_t i_cmd_ID, GD_DATA_VALUE i_data)
| Set settings at defined device. More...
GD_RES_CODE | hw_get_device_metadata (uint8_t i_device_ID, gd_metadata **p_device_metadata)
| Get pointer to device metadata. More...
uint8_t | hw_get_max_device_index (void)
| Return last device index. Index start at 0. More...

## Detailed Description

HW controller for generic driver.

Important note for AVR8 architecture: functions, that read from
flash memory presume that constants are stored in low 64 kB of flash
memory. If not, please take a look at
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=93874

Created 28.08.2013
Modified 23.04.2014

Version
  1.2.2

Author
  Martin Stejskal

## Macro Definition Documentation

#define DEVICE0 BRD_DRV_metadata

Board driver.

#define DEVICE1 TLV320AIC33_metadata

TLV320AIC33 codec.

#define DEVICE2 CS2200_metadata

Fractional PLL CS2200.

#define HW_MAX_DEVICE_ID 2

#define HW_POINTER_ARRAY_TO_METADATA

Value:
(gd_metadata*)&DEVICE0,\
(gd_metadata*)&DEVICE1,\
(gd_metadata*)&DEVICE2

## Function Documentation

GD_RES_CODE hw_get_device_metadata | ( | uint8_t | i_device_ID,
|  | gd_metadata ** | p_device_metadata
| ) |  |
| inline

Get pointer to device metadata.

Example of usage:

GD_RES_CODE status;
gd_metadata** p_p_metadata; // Pointer to pointer to metadata
gd_metadata* p_metadata; // Pointer to metadata
p_p_metadata = &p_metadata; // Assign pointer to pointer pointer address
status = hw_get_device_metadata(3, p_p_metadata); // Get pointer to metadata
// Now we can use p_metadata as pointer to structure with metadata
char *p_txt; // Pointer to character
p_txt = &p_metadata->c_description[0]; // Set to metadata description
LCD_write_string(p_txt); // Write device description to LCD

Parameters

  i_device_ID | Device ID. Defined in .h file
  p_device_metadata | Pointer to user image of metadata. MUST BE POINTER

Returns
  GD_SUCCESS if all OK. Else please refer GD_RES_CODE

uint8_t hw_get_max_device_index | ( | void | ) |  |
| inline

Return last device index. Index start at 0.

Returns
  Last device index. Index start at 0

GD_RES_CODE hw_get_setting | ( | uint8_t | i_device_ID,
|  | uint16_t | i_cmd_ID,
|  | gd_config_struct * | p_config_table
| ) |  |

Get settings from defined device.

Parameters

  i_device_ID | Device ID. Defined in .h file
  i_cmd_ID | Command ID for device
  p_config_table | Pointer to image of configure table - 1 structure. Settings will be saved to this structure

Returns
  GD_SUCCESS if all OK. Else please refer GD_RES_CODE

GD_RES_CODE hw_set_setting | ( | uint8_t | i_device_ID,
|  | uint16_t | i_cmd_ID,
|  | GD_DATA_VALUE | i_data
| ) |  |

Set settings at defined device.

Parameters

  i_device_ID | Device ID. Defined in .h file
  i_cmd_ID | Command ID for device
  i_data | Data. Must be type GD_DATA_VALUE (4B)

Returns
  GD_SUCCESS if all OK. Else please refer GD_RES_CODE