OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 11029|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 u9 y# o' m1 f. `# g0 }
  1. [code]EDMA sample test application3 {- h8 p6 i# r8 O$ U0 N
  2. /*
    , X+ [4 w% l7 L, r
  3. * edma_test.c- E2 U' h3 {4 I) h) t
  4. *7 c4 o8 Z# `- ^4 A
  5. * brief  EDMA3 Test Application
    - I1 C, o1 B5 i2 s
  6. *
    / K2 z4 m; O' q
  7. *   This file contains EDMA3 Test code.
    : U4 i, P4 u. j# {
  8. *
    8 F! f' y! _$ T( Y+ P+ T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + f) W' f: V& f7 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& l, Q3 B  A( h9 U4 v" h% }
  11. *         TO CHANGE.
    , r, x$ L2 Q; M  v) a' s% H# U4 R
  12. *
    4 s1 ?5 |4 g3 E& g" i( m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! O8 l3 b+ i3 J
  14. *5 u+ Z9 @* U) Y
  15. * This program is free software; you can redistribute it and/or. H5 U3 Z: k0 \- c  p
  16. * modify it under the terms of the GNU General Public License as
    8 C1 i$ A' ?5 f+ Z
  17. * published by the Free Software Foundation version 2.5 k; M; ]  j; [/ V
  18. *
    $ ^2 p$ _# {8 k, X: V  S- Z- W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % Q# ]1 v: S4 Q$ N/ y6 e+ i+ O  \
  20. * kind, whether express or implied; without even the implied warranty
    , b- e9 |( p5 o$ J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- T2 t4 X, h+ b& S' @
  22. * GNU General Public License for more details.
    - J- D1 _) p, J. @, K) k
  23. */
    : V# a/ k( j  e( k5 j3 O% B2 S
  24. ; L3 O8 J, H# C- ?# r
  25. #include <linux/module.h>
    ' Z2 L: W$ x6 Y: o
  26. #include <linux/init.h>; j' z) q8 j3 s/ u; N
  27. #include <linux/errno.h>% O7 h: Z% {6 _4 Y
  28. #include <linux/types.h>
    % t1 ], L6 `3 J! d8 i" l2 z6 \
  29. #include <linux/interrupt.h>
    6 ], R3 b6 A( w) X8 O2 ]1 F' {
  30. #include <asm/io.h>* I4 O  d( o+ W; L7 _  \5 N
  31. #include <linux/moduleparam.h>  y6 [, n2 I5 z2 v+ k
  32. #include <linux/sysctl.h>
    4 Y( O7 g) \* i$ g
  33. #include <linux/mm.h>: ~" b! }% o/ f" L8 d# m: \7 K
  34. #include <linux/dma-mapping.h>+ G2 |# }, _2 ]+ W! `+ k
  35. 8 L7 F+ ^6 V5 P
  36. #include <mach/memory.h>+ l8 E; z5 p2 n( t
  37. #include <mach/hardware.h>+ W) R* m! ]! H# ^
  38. #include <mach/irqs.h>
    " o5 l+ g$ I) E- w
  39. #include <asm/hardware/edma.h>
    * Y) T2 L( q- v8 l% x2 z

  40. 1 G7 j5 u) U! V8 u
  41. #undef EDMA3_DEBUG
    9 a' {" V% t7 p" V
  42. /*#define EDMA3_DEBUG*/7 ]: Q( K, T: J' L" Q. U
  43. # Z  A# u4 c& F6 t' a! @" R
  44. #ifdef EDMA3_DEBUG4 M, P! E3 O* l# b5 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 V# t) \% ]# g4 K/ f* a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 v% R3 I( V. e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , Y% c# i' s! n; z" ], K; C$ O
  48. #else
    + e% W3 f6 y# L8 h( O: h$ h
  49. #define DMA_PRINTK( x... )& |5 @! q! j) E  R( N
  50. #define DMA_FN_IN) T+ z- m! L* C6 ]- @5 Z& H
  51. #define DMA_FN_OUT
    8 Q  b( m+ r9 d  J, u
  52. #endif
    ; q% v7 g, K6 b, T

  53. ; `0 |4 o5 x+ |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ |$ r8 s' G- v# Z* |7 ]
  55. #define STATIC_SHIFT                3
    $ F( B5 `- E9 w$ Z
  56. #define TCINTEN_SHIFT               20# \1 K$ e: _' i" ^4 P& k- y" ~0 {
  57. #define ITCINTEN_SHIFT              210 f4 j, H: O3 h8 F3 D4 w; f
  58. #define TCCHEN_SHIFT                22$ g3 J: C' L$ n
  59. #define ITCCHEN_SHIFT               23
    ( }9 d  k1 Z% n0 e0 R
  60. 9 C2 M8 x; K8 u+ f
  61. static volatile int irqraised1 = 0;
    ) V- F, u9 E4 _; v8 `) _' g7 m# k
  62. static volatile int irqraised2 = 0;
    6 a* E+ R9 f6 D5 C5 \

  63. 7 P$ r( M$ ~9 }4 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 z' T  B% b" z8 O# m! k  [9 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 P% {  ?$ U; z$ X& b- Z: f0 D6 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . e$ W; c$ \$ a" K: X

  67. ( ~0 e  z0 Q+ i! }  ?! ?- c
  68. dma_addr_t dmaphyssrc1 = 0;* [( {; `% D* I9 N0 S$ `2 q
  69. dma_addr_t dmaphyssrc2 = 0;
    : ~( Q; f% b$ A
  70. dma_addr_t dmaphysdest1 = 0;/ z& {! }8 [& _/ L1 ?
  71. dma_addr_t dmaphysdest2 = 0;
    $ \4 {) J! Z- }8 |

  72. & {5 {' `; o+ A/ {6 W& E
  73. char *dmabufsrc1 = NULL;
    5 \& Y% M- c7 v" b9 |
  74. char *dmabufsrc2 = NULL;: q! {$ v) E5 ^, I- y" \
  75. char *dmabufdest1 = NULL;
    ! _  i- W8 v- \2 W( x
  76. char *dmabufdest2 = NULL;9 a  J8 x: S' b" x4 ^# @. u

  77. 4 x  U4 W3 Q; N5 `( [* ?
  78. static int acnt = 512;2 G7 D: L# G" i* K+ E7 y5 l
  79. static int bcnt = 8;( ~6 `. h5 ^% M1 j$ g' n2 Z
  80. static int ccnt = 8;
    ) u% P) ?6 z3 p9 l+ H7 Q3 Z
  81. ' T0 L* Q! P- s% _
  82. module_param(acnt, int, S_IRUGO);! R: D& d: S8 B( P
  83. module_param(bcnt, int, S_IRUGO);# U+ I; W' `% l/ W/ b) D/ ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ^: p) x, |. A* g. P
, C4 g  f/ l8 f- T' P8 R3 k9 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' k# T8 d5 N9 }! O4 Carm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 D" p! K' b9 t( d- f# \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; r( ?2 }% k: k7 W, O

2 _2 Z+ A5 F/ @0 ]/ h, D7 T! a9 q( @% F% {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-2-6 01:21 , Processed in 0.044353 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表