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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) A, d( A$ G5 q
  1. [code]EDMA sample test application
    * E! h7 F5 C& A
  2. /*
    - [+ q0 g2 c* f0 U+ B. i# v, Z
  3. * edma_test.c, R5 X& n3 }) E  G5 }. j5 x7 P
  4. *
      t- p- y) D1 z' p0 ~
  5. * brief  EDMA3 Test Application
    % h: T7 }' L8 o+ E: c+ k
  6. *
    ! D/ S; [; y8 t0 Y  u: C  D
  7. *   This file contains EDMA3 Test code./ v0 e# b$ K8 y' R' _8 Q% l
  8. *
    7 A, I/ Q8 ~$ S% U* g4 x1 m& k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) d/ ~: r& i# D" @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) }0 Q6 Z8 O- K! \+ [" ]
  11. *         TO CHANGE.
    ! |1 K% B4 `2 }2 y, {
  12. *9 g- B, r' L( I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 O. s8 g& `3 {
  14. *. R1 ^7 c' R! j& D. }
  15. * This program is free software; you can redistribute it and/or) `6 G; X9 X( t: i" o
  16. * modify it under the terms of the GNU General Public License as
    5 A- |$ v2 I  L: s
  17. * published by the Free Software Foundation version 2.
    ! s: V5 C* g8 I& G7 t* F7 [1 \) }
  18. *
    0 u6 u7 B  i: O6 m% _2 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) u6 N& W, S& q( z+ w  w
  20. * kind, whether express or implied; without even the implied warranty% q+ H* i8 h7 }3 m1 f% ^# {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; a' G6 o) F9 _3 i9 W
  22. * GNU General Public License for more details.$ F* r, l! a0 D8 o8 s2 j
  23. */
    ; |4 O+ v3 I+ a9 g4 p
  24. . i  L) e' z! Z. E4 ]3 G4 _
  25. #include <linux/module.h>
    - L4 m7 S! A0 X2 g2 r, C
  26. #include <linux/init.h>$ p0 v/ C+ @% M8 [0 U9 s
  27. #include <linux/errno.h>
    " \' F5 g! h% j3 K
  28. #include <linux/types.h>: g4 m1 u* W: ?1 D- K
  29. #include <linux/interrupt.h>9 Z# G8 k( N2 @! B. t% d3 f
  30. #include <asm/io.h>
    ) \" R* }# o! p5 Z6 ?9 {
  31. #include <linux/moduleparam.h>$ K& A8 C; m8 C! h5 k# l
  32. #include <linux/sysctl.h>
    ' w5 B( ]* A0 a+ W4 m2 D
  33. #include <linux/mm.h>
    , `* N. T5 ~5 `
  34. #include <linux/dma-mapping.h>9 M- r9 z( ~) E, x
  35. % \# g. m; [& H. L2 h7 C
  36. #include <mach/memory.h>' m# z, p5 S4 t, H' n  f# {
  37. #include <mach/hardware.h>
    ! M) H6 ]7 c; _7 N: M: m7 a9 U
  38. #include <mach/irqs.h>
    2 |- r* E0 ^" o: F' Z
  39. #include <asm/hardware/edma.h>
    : ]1 l3 v7 [! X: a9 \

  40. ) B' y% H5 E2 g. _6 e: N
  41. #undef EDMA3_DEBUG
    * J! B* i( L7 P, c& d* Z
  42. /*#define EDMA3_DEBUG*/+ v+ f& [! Y4 G0 J, L1 k

  43. & [; Q. `2 M( e7 V4 D) c3 I4 I
  44. #ifdef EDMA3_DEBUG! w+ f4 }5 C, e, ]1 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 Z' ]( l6 ?* K$ f& s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 S6 g, S; z9 g4 v2 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 n+ Q3 o8 z4 n. U8 o" p
  48. #else
    " L2 D! _4 O  Y" Q
  49. #define DMA_PRINTK( x... )
    3 }( z2 ^& |6 O  S* f$ K
  50. #define DMA_FN_IN
    5 i2 }! ?! m( L; c- e% r
  51. #define DMA_FN_OUT: P6 O# y, j7 o9 N
  52. #endif
    6 v$ J( N* F% Z; e! V/ m8 |8 Z. f
  53. " K+ V% s9 b( H- N8 y+ w7 }, y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! V+ t2 S/ I! `5 A* C
  55. #define STATIC_SHIFT                31 V; x& Z8 I+ ?+ f
  56. #define TCINTEN_SHIFT               201 h+ s: W3 u: H; f* N. v% K
  57. #define ITCINTEN_SHIFT              21
    ; f2 R8 {2 \8 t9 ]1 t2 p
  58. #define TCCHEN_SHIFT                22
    ( g" T2 k. L* F/ m! @. i
  59. #define ITCCHEN_SHIFT               23
    6 _) H, ~1 s1 k0 k* r
  60. 9 W: t! ]7 ]" u- O$ F9 W
  61. static volatile int irqraised1 = 0;. b" ]) F. U; O( U- p0 G: ~
  62. static volatile int irqraised2 = 0;& C4 ^9 l! }2 I
  63. 5 ^. l3 U$ T, y9 L* Z- P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  h% e7 {& H( x" W% X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 o/ m2 _2 A# Q# k! h: r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # j1 a! T* s' {4 ]/ N

  67. % {0 d* K. p( |% m. o  j$ j( l
  68. dma_addr_t dmaphyssrc1 = 0;2 O: z1 a2 G5 U
  69. dma_addr_t dmaphyssrc2 = 0;
    - c+ E$ o; j& o: T
  70. dma_addr_t dmaphysdest1 = 0;
    & _& H+ q* h  B$ P8 ]  A+ T' w. E
  71. dma_addr_t dmaphysdest2 = 0;
    , v" o' P/ @# v* F! l# N

  72. 9 D- b, u# s7 R- p
  73. char *dmabufsrc1 = NULL;6 g$ m. x2 ]. w- A9 Y3 }/ H
  74. char *dmabufsrc2 = NULL;4 D: u* Z8 |$ h0 X
  75. char *dmabufdest1 = NULL;
    8 |: }( [9 Q/ m; T. L" A# E
  76. char *dmabufdest2 = NULL;
    ; C' f' g& s2 x& A1 G7 I1 o0 F
  77. 4 X" [; f- Y4 k: [( v# N
  78. static int acnt = 512;
    ; }5 D3 P. }& [
  79. static int bcnt = 8;0 A1 }5 y( i9 f8 ?2 r" Q
  80. static int ccnt = 8;2 l7 d* ]3 s% c+ O3 J
  81. ' m5 ~) u0 p& L  q5 n
  82. module_param(acnt, int, S_IRUGO);
    " d* ^6 b  Q( R, M& ^& c
  83. module_param(bcnt, int, S_IRUGO);
    , m+ S1 J5 l, |4 V; t1 U$ C6 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- w- u% U% j  y6 K4 E" j
  f+ p& S( L% D5 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* _5 D6 _3 I1 g6 |6 _1 ^* @& [! |5 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 d% \% V3 S' r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# w8 x. ]$ z7 Z1 L' h' F3 @& A0 o- ]/ N1 U1 S

1 y/ I5 C# C/ _/ v' F( X# g9 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 21:49 , Processed in 0.043970 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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