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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : |, E- ]/ M& n: y) U& r" j6 l
  1. [code]EDMA sample test application
    9 S7 e# j# V" {. D- g
  2. /*
    ( t  b( S% U- v+ r( r
  3. * edma_test.c
    & `, L. S; c% P; S; K. l) Z9 G
  4. *. h8 W4 L$ u" [% R8 T# k- `  V/ _
  5. * brief  EDMA3 Test Application% V6 \: O4 u+ p
  6. *1 A1 k  E  T" j
  7. *   This file contains EDMA3 Test code.5 q; E6 \3 O/ G# T  P1 A
  8. *) x1 `2 R' S' b& g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * A3 S. U2 p5 h# \5 |5 R! f% e3 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 n- `3 C. G6 k4 p
  11. *         TO CHANGE.
    " a" G3 p$ E0 S. E+ U" w
  12. *! L2 f# ?- d+ d  s- V* ^$ n6 y' ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 e, e  ?& ^1 x# s+ w
  14. *
    ' ^' {" q2 e+ l; N, v
  15. * This program is free software; you can redistribute it and/or
    & T5 f, D4 f1 ^( A* d4 w8 E; X+ |
  16. * modify it under the terms of the GNU General Public License as
    1 d4 k+ w" I7 A
  17. * published by the Free Software Foundation version 2.
    * q, ^$ u: q8 k* \
  18. *
    $ A' f0 m1 m; z8 C6 ]" i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - B; ?( Y. ]5 F5 W* k
  20. * kind, whether express or implied; without even the implied warranty
    0 R* }! ]3 {: z, w& p; V) w4 ~. c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' k- W1 X8 G* \# }+ t% }) \
  22. * GNU General Public License for more details.6 F- h9 L+ f0 @/ ~& m: {8 p% c
  23. */; [) Y& P) k  \7 N1 m
  24. ! d. ^/ j; K$ f9 T" {- s4 K
  25. #include <linux/module.h>
    2 `0 b; ^$ }  T1 m, ]4 ^+ x* g
  26. #include <linux/init.h>; w6 n+ l' s8 c0 R6 [
  27. #include <linux/errno.h>+ M7 F6 f' ]9 H0 ^# x( Y
  28. #include <linux/types.h>% H4 g0 F% j8 n% s  P( B4 e# ~
  29. #include <linux/interrupt.h>
    : y' k* H' E+ ~+ ?; F, e, W+ y2 {
  30. #include <asm/io.h>
    1 Z9 p! |0 F5 A+ a3 F4 S7 H
  31. #include <linux/moduleparam.h>
    / b5 _* i+ f% I; K" o
  32. #include <linux/sysctl.h>( X. {( H* y3 {/ V' O
  33. #include <linux/mm.h>
    # j4 R- H1 u7 I& G# |0 Z  \
  34. #include <linux/dma-mapping.h>
    8 T# [' @+ j- W

  35. 2 Z3 L6 m. V7 ~# Q8 S
  36. #include <mach/memory.h># h, @$ K, A5 d# h5 C: h1 v
  37. #include <mach/hardware.h>* U5 j- M8 i1 e2 ]) a( L
  38. #include <mach/irqs.h>! F9 a# f( I% |7 Z& |
  39. #include <asm/hardware/edma.h>
    + |+ d& I! [& A3 a# x0 ]+ f& t

  40. , [. a' g* m5 ]4 q# X3 V
  41. #undef EDMA3_DEBUG
    4 ^# S6 U8 d% {* I0 H, L
  42. /*#define EDMA3_DEBUG*/
    : t, t! H* h5 M3 V2 I: ~
  43. 6 s4 p# Y3 D) q) c, I1 O8 z
  44. #ifdef EDMA3_DEBUG
    4 `2 g3 m' q( Y! }& ~& L+ ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 y; V0 r" t: B* t  H2 \, N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 b: S. j- u1 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + z  i( \8 t7 m9 o: U' ~
  48. #else
    6 z+ j; m6 m" s2 a, v
  49. #define DMA_PRINTK( x... )
    8 D4 P# z. u1 n+ E+ J% Z& v
  50. #define DMA_FN_IN
    4 N- v5 I" ?5 A  Y% J" k8 ~
  51. #define DMA_FN_OUT
    ! ^3 w0 ~2 P, H/ l: Y
  52. #endif3 Q3 t, M$ P: Z# j! N8 z1 e6 t
  53. # B0 C" {) i/ P' _% `! ?# V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* [+ ?4 `4 W. a$ F. o
  55. #define STATIC_SHIFT                3  Y- s( }7 z4 _5 _6 `) F+ _! b" t
  56. #define TCINTEN_SHIFT               20
      P5 I4 `! ]6 E! m* d- s
  57. #define ITCINTEN_SHIFT              21
    4 q6 r$ M: r. ^
  58. #define TCCHEN_SHIFT                22
    - X( X* V" v5 }; `3 J
  59. #define ITCCHEN_SHIFT               23% `% N" H1 O: u& X8 |5 o7 k/ k

  60. " S- i; H  y1 p/ ]) n6 E1 {
  61. static volatile int irqraised1 = 0;
    / g- x; X8 V% T- M
  62. static volatile int irqraised2 = 0;
    5 X$ P, R: }/ o/ t# E* g

  63. $ Y) C# C* F2 t/ P# N( Z3 K0 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& X' p; D" r. E' o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' `2 k, s4 l( G8 N. S0 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' V6 }% y' n* \' q% L+ r

  67. $ m1 w& r& c, J/ [: o8 A* W9 b
  68. dma_addr_t dmaphyssrc1 = 0;" S# ~0 ]! h5 m/ V+ `6 ^
  69. dma_addr_t dmaphyssrc2 = 0;
    ) f# ]8 q& C" y$ M: E
  70. dma_addr_t dmaphysdest1 = 0;
    " N& c( G3 q, p9 t* F
  71. dma_addr_t dmaphysdest2 = 0;
    / v& r3 N0 d( w5 I
  72. 1 q" H3 W! z0 p
  73. char *dmabufsrc1 = NULL;
    . f) `7 I" k( o$ n/ k6 ]
  74. char *dmabufsrc2 = NULL;
    8 \" _0 d/ }& V+ u
  75. char *dmabufdest1 = NULL;
    1 {& l; h* P2 |7 y, e" N
  76. char *dmabufdest2 = NULL;/ P! s0 M7 S/ E" P
  77. 7 _* A0 F6 P0 V0 F
  78. static int acnt = 512;
    ) Q/ c" k2 L/ W+ {7 c
  79. static int bcnt = 8;
    5 R1 ?4 \: h" r; M; k- ^1 R
  80. static int ccnt = 8;" v8 X( [% h4 h8 V* u
  81. * Y, q& x  f+ Q5 Q8 U/ W+ y0 i
  82. module_param(acnt, int, S_IRUGO);
    ! A, e- y/ a7 y/ s1 w
  83. module_param(bcnt, int, S_IRUGO);
    . v$ }" W( u3 [8 s7 O9 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 c. P0 `* P# w. ^4 g) o  a
6 X8 N# D/ p9 d1 v6 h$ P* b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: y% k  @- z5 b% E# j3 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& o! `: }* v+ q2 y0 U0 x! f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) a4 S' c: c8 p8 a
( t4 d% S8 W! `) w! c1 T
- V! E& q' H5 n; `1 T! `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 11:59 , Processed in 0.038931 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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