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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 [  X. x6 U, p
  1. [code]EDMA sample test application& j- G# p, L  I! V
  2. /*
    ; }6 \% [7 U! w' {# H  k+ n& y
  3. * edma_test.c8 H( R- L0 _, ?* d0 |8 j
  4. *
    + K1 {( b. v% e* e
  5. * brief  EDMA3 Test Application7 f/ N0 K! S( m4 f  K6 Z" [7 o
  6. *
    1 @) l3 H3 V" T5 M; E0 e6 @1 ]
  7. *   This file contains EDMA3 Test code.7 w$ B% X5 N4 j  o* ?; G2 [! B# H
  8. *
    8 z8 x: y" J& U& B# Z* g9 V9 v* a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ W8 @( |$ Z/ r+ c* e# Z3 A$ k( n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 ]' l: O# V/ T! o& _' v; |/ B
  11. *         TO CHANGE., X6 F# M3 z  P
  12. *5 U: e% P2 C( m: O3 n- n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  K4 f" |( {! I' o
  14. *
    4 |4 w2 N- t# K
  15. * This program is free software; you can redistribute it and/or
    ) q5 H) S0 v8 s
  16. * modify it under the terms of the GNU General Public License as3 N5 Z7 O* P( s" G
  17. * published by the Free Software Foundation version 2.+ `! B6 Y: j2 G6 |
  18. *
    . ~0 E. \8 I) a" }' E) ^8 C0 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - ?6 N( A% w3 F0 D: @' ]
  20. * kind, whether express or implied; without even the implied warranty4 ?& h4 _% t( G6 V# o( Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) R  H1 L$ K/ M7 F
  22. * GNU General Public License for more details.
    ; {* j# M; A- |( B% w
  23. */
    7 k0 y! S' S# z7 O$ g
  24. & U' v! r8 K$ [  ~
  25. #include <linux/module.h># L' ?" W% B- o
  26. #include <linux/init.h>. L' _! q; p; O  q
  27. #include <linux/errno.h>
    3 T$ A2 a; U5 ?) T# P. g/ L* S
  28. #include <linux/types.h>6 Z& D0 o; Z0 x$ D! _/ g
  29. #include <linux/interrupt.h>' t5 [+ s5 K6 E% _5 O: I; C% K
  30. #include <asm/io.h>1 O% p, t6 F5 v2 y, V$ S) W  Y
  31. #include <linux/moduleparam.h>: W* e; J/ x2 K$ }0 R0 \
  32. #include <linux/sysctl.h>6 n& x" y4 [3 K; M% j5 G0 J
  33. #include <linux/mm.h>
    / j- b/ q9 v' P4 b
  34. #include <linux/dma-mapping.h>4 z1 c# M4 P% E. S* q. Y2 ~6 I
  35. , U; ]4 V+ ~2 [6 q7 Z
  36. #include <mach/memory.h>' K  B2 ^' t$ u# f- [
  37. #include <mach/hardware.h>1 t" Q* W  ?) k" v
  38. #include <mach/irqs.h>
    * @3 ]6 E6 O: z3 T, `; h
  39. #include <asm/hardware/edma.h>% y6 K  K1 D' M
  40. $ @. d+ z! A4 u) D
  41. #undef EDMA3_DEBUG
    6 Q9 P/ N& h2 B" y! R  H  \) R. S
  42. /*#define EDMA3_DEBUG*/
    - I' F8 f1 x  C/ T

  43. . P7 E( j! ~- K2 C
  44. #ifdef EDMA3_DEBUG7 o: I& }- l0 k9 W* x+ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 c9 \* b9 e9 _7 x2 l* \& u) O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , O3 D5 |' L! v0 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % Y4 W/ h9 P# ?% j
  48. #else+ V% Q3 Q7 n* K' M
  49. #define DMA_PRINTK( x... )
    4 T6 s6 v0 _3 y+ x" j/ s
  50. #define DMA_FN_IN
    7 ?, V  |" j' s5 Z
  51. #define DMA_FN_OUT. w/ h5 X- w3 z7 I% z
  52. #endif
    6 J9 g- {7 u( `, V; o) D# I
  53. 0 d, F" _5 V9 O2 C% t& ]: f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * V8 e7 P3 O  A; y2 I
  55. #define STATIC_SHIFT                3
    5 ^- b( k: W1 F2 h! N
  56. #define TCINTEN_SHIFT               20
    , ~0 E! M) y; s3 b
  57. #define ITCINTEN_SHIFT              21( V; s$ ~* q- Z& c! V
  58. #define TCCHEN_SHIFT                22
    " a0 ?/ x6 {5 R8 @0 M5 ^
  59. #define ITCCHEN_SHIFT               234 G, ^0 Y6 `/ Q+ v3 P" @$ q
  60. 5 r+ R& f2 p. Y; j# F! T# \% \
  61. static volatile int irqraised1 = 0;4 `8 R/ Z+ m% C4 n
  62. static volatile int irqraised2 = 0;
    8 [/ G) d: Q' t, A* y( H
  63. & y( b# R1 ?2 R6 e$ M0 I4 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) k" L$ f1 O4 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" L9 G% c' m$ ]  q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! M  A0 f$ ~4 x/ g8 ^* m% W* S/ h

  67. 3 G2 e5 B$ d/ T3 g3 z0 m) l
  68. dma_addr_t dmaphyssrc1 = 0;
      ]4 C5 x: h& v: o7 A
  69. dma_addr_t dmaphyssrc2 = 0;# Y; U1 r3 z3 R* I7 h: q! A
  70. dma_addr_t dmaphysdest1 = 0;
    1 i4 I8 G5 C6 z8 E
  71. dma_addr_t dmaphysdest2 = 0;
    # H+ p2 `* r: G4 p! ~

  72. + C6 |# ^1 `# E: u* q" g1 r" L) k
  73. char *dmabufsrc1 = NULL;
    8 A6 T0 ~, J9 u% @7 b5 T; a
  74. char *dmabufsrc2 = NULL;% v3 i) y4 a3 ^$ u- ]6 Z3 Z1 P
  75. char *dmabufdest1 = NULL;6 n% x, e; h9 V4 y- R" C. I% _: T* Z
  76. char *dmabufdest2 = NULL;' ^% N. ]4 C* L7 }; F& j: z
  77. 0 E. o2 N. A; w0 H3 w! q
  78. static int acnt = 512;6 V" U1 M  m' j) U! C
  79. static int bcnt = 8;
    7 B/ ]3 H3 o3 ]
  80. static int ccnt = 8;
    . e1 n( \( n* K4 Q2 L# r' T8 B
  81. $ }, u, r7 ~/ Y+ A0 O- ?
  82. module_param(acnt, int, S_IRUGO);
    ; J. g9 I6 f" _- o% k
  83. module_param(bcnt, int, S_IRUGO);
    7 ?: ]6 U- Z4 F: A1 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( G! u9 `4 U7 z' B+ I7 C3 [! a7 @- b, ~$ V# Z. T7 W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 r7 o& N9 n. \' Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) f4 q! l! A" R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Q0 j3 j8 [9 P; u7 r
7 H, D! W$ `2 n5 x4 I
' W9 e% g: C" l  H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-17 06:04 , Processed in 0.041996 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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