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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* s2 o$ l: S4 `( ^- a. b
  1. [code]EDMA sample test application. E/ W5 K( T7 x9 Q+ |- m
  2. /*+ }# N; s9 v/ p8 W. i
  3. * edma_test.c. ]2 z; C9 N7 A! j- B% W% v6 Z' g- X
  4. *  N% P8 ~/ v) Y6 d; ^
  5. * brief  EDMA3 Test Application- j# \5 w  }$ y$ w9 ?4 z
  6. *$ |: o' O6 A8 M: v( i
  7. *   This file contains EDMA3 Test code.+ d9 k  B0 u# _) V$ `7 \. O, ]
  8. *
    ( w$ R  z& u; ]0 {/ B& t% ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 |! l) Y5 O" ]7 J9 Q" _6 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & \0 F9 ?" p' a$ @$ h7 t" e
  11. *         TO CHANGE.
    # d# D/ ]; S$ k0 |- D
  12. *4 t% f; P* K+ j5 `" K+ C" [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 C7 O% K9 a5 e- a7 ^$ B9 C
  14. *
      R4 q5 l/ c& t4 Z% n& V, C
  15. * This program is free software; you can redistribute it and/or
    ) i6 R' ^7 E- l+ y! H5 A( k5 `) k
  16. * modify it under the terms of the GNU General Public License as
    1 u6 f+ R1 l( h, M$ X1 L4 }7 j2 ?
  17. * published by the Free Software Foundation version 2.9 t: ^4 t& \2 ~. R
  18. *) q/ V- o# z+ b& ^8 H" @5 t  [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ a2 }- v. a8 D0 z+ |) u% T
  20. * kind, whether express or implied; without even the implied warranty
    ' k6 R8 c& l$ O3 C1 r  p9 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( ]; N+ j  }3 w* x% ~' E
  22. * GNU General Public License for more details.
    + p6 b/ J# [4 @* g9 ~+ k# Q4 E
  23. */
    4 p( o4 u/ A- o" P) U, p$ Y7 O

  24. 2 l& {5 }/ Z7 y  R
  25. #include <linux/module.h># ]: |$ I* ]. d2 [4 l/ ^- W1 F
  26. #include <linux/init.h>
    ' A( F8 `4 w! W9 L# p+ ]" d
  27. #include <linux/errno.h>& G0 k( ~  x& N' S
  28. #include <linux/types.h>
    ; |( {1 X- H$ B5 V0 q3 d( e
  29. #include <linux/interrupt.h>
    7 O! a" x. _4 J1 z  [$ K
  30. #include <asm/io.h>
    8 m# ^& n* e) o, ?0 f) {% n! ]
  31. #include <linux/moduleparam.h>8 c. o% R7 C! |5 [: l# f$ j* Y/ V
  32. #include <linux/sysctl.h>5 ~( G8 h/ q! Q( @% J+ c: r
  33. #include <linux/mm.h>
    ! r5 G# G3 D# o3 _+ V2 g' \
  34. #include <linux/dma-mapping.h>5 |8 `. `5 i. \$ \8 ]8 b# V8 j9 e
  35. - V( D5 j) ~" T, _$ E
  36. #include <mach/memory.h>7 a" I; j- p1 g  \  I+ C
  37. #include <mach/hardware.h>/ H) q$ T8 @% D. H" q
  38. #include <mach/irqs.h>
    , r# F" Y/ }: L! }/ r1 s- \& B
  39. #include <asm/hardware/edma.h>
    2 B/ B- d7 N0 X, e( a6 C

  40. 1 z6 ]3 |7 w& W
  41. #undef EDMA3_DEBUG
    % f4 a* y9 X/ |7 B$ |
  42. /*#define EDMA3_DEBUG*/6 n5 B4 G& x, I; y: b0 @

  43. 6 n( S" O0 I$ Z: g, h5 {$ Z
  44. #ifdef EDMA3_DEBUG! |4 j! j: ~/ `0 O& X" a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- B4 n4 a$ z% o# _& e: B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' M  B' d5 y3 _6 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) ]. d" w5 p+ Y2 W+ W) P6 C
  48. #else' p6 a4 E- K& z: A, L) ]2 P# J# h
  49. #define DMA_PRINTK( x... )7 _' _: M! L. o7 g& l3 n
  50. #define DMA_FN_IN
    * ]1 x. s  K+ [" p! b8 Z9 o
  51. #define DMA_FN_OUT" Q+ O# H  y+ k* p
  52. #endif
    , r0 a! a- ~) e- \8 _9 N

  53. , z+ X) L) q  ^  N# I8 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); z" [" b6 [" T% d3 j' c5 S
  55. #define STATIC_SHIFT                3
    " A% _: D5 p, ^
  56. #define TCINTEN_SHIFT               20, ]- c. O* i' w2 E
  57. #define ITCINTEN_SHIFT              21- b1 }. R7 x5 T' w
  58. #define TCCHEN_SHIFT                22
    , s6 O( i, I& t* a6 A, ]
  59. #define ITCCHEN_SHIFT               23
    : m3 u& ~/ w% P1 n
  60. 0 q8 I2 h' }6 y% t! z% |
  61. static volatile int irqraised1 = 0;
    ! K* `( S9 y! m- H
  62. static volatile int irqraised2 = 0;3 ^6 _4 r( k( ^+ B+ [9 n$ e
  63. 6 h( `! ^* u$ j- K7 L4 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& K- e/ m* L+ K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * N5 C7 J# e6 E: P9 l+ ?; V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / |9 h% k1 ?1 i2 S# M2 z
  67. % v" s9 q1 i. F
  68. dma_addr_t dmaphyssrc1 = 0;
    - O6 c3 S; {: C' j
  69. dma_addr_t dmaphyssrc2 = 0;
    - ^6 j5 P/ K+ X; N/ \
  70. dma_addr_t dmaphysdest1 = 0;* P$ r; M" N6 T1 @
  71. dma_addr_t dmaphysdest2 = 0;9 Q7 c% v1 p6 c1 ^, R6 o( U
  72. % a! Y/ W% p/ J) o+ Q- r& t
  73. char *dmabufsrc1 = NULL;
    9 Q0 D) j" M- }4 {+ x
  74. char *dmabufsrc2 = NULL;
    8 v& G- D6 N* C; m/ a0 C
  75. char *dmabufdest1 = NULL;. y4 K1 v  a: ^+ ?8 ~
  76. char *dmabufdest2 = NULL;
    * n/ r' W' x; U: V  @

  77. ' g3 Y/ \  N% p4 l
  78. static int acnt = 512;
    % d, Z$ Q2 ]: e7 X9 e8 U7 a$ r0 U
  79. static int bcnt = 8;
    9 `; m7 v3 I1 d3 s+ D) `* z
  80. static int ccnt = 8;1 N) I5 G  W' t. t; m

  81. , R9 d3 y9 ?/ c# R- [
  82. module_param(acnt, int, S_IRUGO);
    ; A3 u2 O& `# V, h
  83. module_param(bcnt, int, S_IRUGO);: ^3 ?+ {1 Q4 v+ r; q5 ?, W0 a# j# ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 a& r$ {4 _: P2 b1 s* V
2 z) D6 a9 @% S  o0 G& x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& A& F- S& t" ]6 d' j
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& A1 I" n# ?$ E; j% u+ @' C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ Q0 B0 M" l/ M/ m8 h0 h# |

( {1 [# t- j1 y1 j; s9 f* ^. C' b! g* j& N# Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 23:11 , Processed in 0.039648 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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