Hans Verkuil | 55d58e9 | 2014-08-25 08:02:56 -0300 | [diff] [blame] | 1 | /* |
| 2 | * vivid-rds-gen.h - rds (radio data system) generator support functions. |
| 3 | * |
| 4 | * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
| 5 | * |
| 6 | * This program is free software; you may redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 11 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 12 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 13 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 14 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 15 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 16 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 17 | * SOFTWARE. |
| 18 | */ |
| 19 | |
| 20 | #ifndef _VIVID_RDS_GEN_H_ |
| 21 | #define _VIVID_RDS_GEN_H_ |
| 22 | |
| 23 | /* |
| 24 | * It takes almost exactly 5 seconds to transmit 57 RDS groups. |
| 25 | * Each group has 4 blocks and each block has a payload of 16 bits + a |
| 26 | * block identification. The driver will generate the contents of these |
| 27 | * 57 groups only when necessary and it will just be played continuously. |
| 28 | */ |
| 29 | #define VIVID_RDS_GEN_GROUPS 57 |
| 30 | #define VIVID_RDS_GEN_BLKS_PER_GRP 4 |
| 31 | #define VIVID_RDS_GEN_BLOCKS (VIVID_RDS_GEN_BLKS_PER_GRP * VIVID_RDS_GEN_GROUPS) |
| 32 | |
| 33 | struct vivid_rds_gen { |
| 34 | struct v4l2_rds_data data[VIVID_RDS_GEN_BLOCKS]; |
| 35 | bool use_rbds; |
| 36 | u16 picode; |
| 37 | u8 pty; |
| 38 | bool mono_stereo; |
| 39 | bool art_head; |
| 40 | bool compressed; |
| 41 | bool dyn_pty; |
| 42 | bool ta; |
| 43 | bool tp; |
| 44 | bool ms; |
| 45 | char psname[8 + 1]; |
| 46 | char radiotext[64 + 1]; |
| 47 | }; |
| 48 | |
| 49 | void vivid_rds_gen_fill(struct vivid_rds_gen *rds, unsigned freq, |
| 50 | bool use_alternate); |
| 51 | void vivid_rds_generate(struct vivid_rds_gen *rds); |
| 52 | |
| 53 | #endif |