OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 `+ W" H% ^1 d7 w) ?3 F
  1. [code]EDMA sample test application
    ; C7 `' ]! F8 C. _
  2. /*1 N+ L& o# h$ p! w3 `
  3. * edma_test.c. W1 F# `' w% B& I
  4. *
    4 @' p, v: K; O8 c: A
  5. * brief  EDMA3 Test Application5 z. U0 `# L' J& }: C- J+ ^/ \5 b
  6. *0 F8 |- c  W% s8 h
  7. *   This file contains EDMA3 Test code.
    $ A7 _" z1 B& ]) ^
  8. *
    5 ^% ?, B7 i& s2 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 d1 a8 Z* ?! I" s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  v0 x0 R1 s2 b- `% }. E
  11. *         TO CHANGE./ m( ^! |/ c% {: n8 ^
  12. *) Z: R' z) D  z! ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" z! ?( P0 \; \  U; Y
  14. *
    ' V* l$ ?- Y! s
  15. * This program is free software; you can redistribute it and/or: W7 b3 [- y( T! v
  16. * modify it under the terms of the GNU General Public License as
    6 D/ ~) Y8 N2 ~. G
  17. * published by the Free Software Foundation version 2.
    ; h9 r( d. [3 M  _- _( F5 W
  18. */ c6 o2 X/ m: W& G( H9 J/ ]1 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# V5 F$ w3 f3 u& `( o
  20. * kind, whether express or implied; without even the implied warranty
    1 d; {3 H, ], D: [6 H+ Y: o/ X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ y+ ?: b  |) ^" b8 }- x
  22. * GNU General Public License for more details.% ]1 n6 V2 {- L: m2 T5 V
  23. */4 N9 Q' Y. u% B+ [9 |4 Y- b
  24. 4 j2 e! H9 E. [& g$ d* N% ^
  25. #include <linux/module.h>1 ^0 N4 s# U5 J/ D4 d4 h  B7 L
  26. #include <linux/init.h>6 s2 N, C! A1 |
  27. #include <linux/errno.h>. U7 V9 \6 u1 G9 E( D
  28. #include <linux/types.h>
    $ R( G0 F; ?  l+ a3 [- V' `& c
  29. #include <linux/interrupt.h>. ?" a4 `! l9 g4 j( [
  30. #include <asm/io.h>. R8 o+ \% |; }( D) D. [) H
  31. #include <linux/moduleparam.h># h, J: g$ a; k
  32. #include <linux/sysctl.h>
    % j+ o' |3 N! L/ x
  33. #include <linux/mm.h>
    1 ~3 @. N3 z6 t2 j
  34. #include <linux/dma-mapping.h>1 s. ]  Q7 C% r! @8 |3 p8 D, ~, I  j1 m

  35. # K& D" Y1 H8 G5 S7 k0 R, i
  36. #include <mach/memory.h>4 z! I) C1 {" e& ^( I8 t1 F2 Q, D
  37. #include <mach/hardware.h>
    ; z& W# Y; n( A
  38. #include <mach/irqs.h>6 h; j4 ~+ u, j: |. \& M9 i
  39. #include <asm/hardware/edma.h>
    6 \3 J0 k4 ~. t! U7 q
  40. * r( \& m5 E, A& l* N! F6 M; o
  41. #undef EDMA3_DEBUG0 Z3 ?; W& q7 ~' e1 `9 G
  42. /*#define EDMA3_DEBUG*/
    ( S5 p) V1 o$ K3 L3 s# {8 B5 p2 m" I

  43. ! F( A! @; s0 W" U" S  e2 e) v
  44. #ifdef EDMA3_DEBUG+ v" ]: O6 b6 t* o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ K" {* N+ }' Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ O* s- F. m+ f- j' m  H5 I. A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , l# e; @. Y2 l& u  @7 }
  48. #else8 |$ Y& `7 i( |! T) \4 n
  49. #define DMA_PRINTK( x... )5 E+ V4 f$ k% }# I
  50. #define DMA_FN_IN
    7 P0 {  _( P# g% c, B
  51. #define DMA_FN_OUT. t* _: K3 b% y/ W, q9 h* h
  52. #endif9 G8 m: X  L0 U% @
  53. 9 Z5 M% |! [& r  ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); S/ Y0 C! i: ]+ ~( e
  55. #define STATIC_SHIFT                3
    ( @: Q5 z# e" b0 \( K
  56. #define TCINTEN_SHIFT               208 ?5 t+ W% i5 O" G# a' u+ S/ |
  57. #define ITCINTEN_SHIFT              21
    9 T+ ]6 X2 n2 W7 @, C* U- D
  58. #define TCCHEN_SHIFT                221 ~4 F1 g; L" ]+ m0 M0 e
  59. #define ITCCHEN_SHIFT               23/ d1 o( x4 X- a$ Y

  60. 3 x- J, X6 V. o0 J- r  K
  61. static volatile int irqraised1 = 0;( K) j/ @# K4 `5 O+ }7 }
  62. static volatile int irqraised2 = 0;
    - v/ D( S' R+ _+ I  [7 U' q
  63. / u) @. y* ~% f( R7 \! C7 H) v. W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ u; M# c! t; n' X" u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 f8 K' m2 ?' P- a; f9 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) @! a( ]$ y0 Z
  67. 9 z7 v* Q$ `$ H3 V5 |1 e
  68. dma_addr_t dmaphyssrc1 = 0;  T& @/ w" I. U) _; `
  69. dma_addr_t dmaphyssrc2 = 0;
    4 b5 ^% v2 p' k; j" K* P* O
  70. dma_addr_t dmaphysdest1 = 0;2 W+ v3 }( U& _" U/ r
  71. dma_addr_t dmaphysdest2 = 0;9 C8 }- b5 O, U$ L4 @$ N) x
  72. ( F% S; Z* H; `5 D
  73. char *dmabufsrc1 = NULL;
    ; q: N2 ~) U8 E- r" X( L# w
  74. char *dmabufsrc2 = NULL;& c0 T1 T) b, h& N( K
  75. char *dmabufdest1 = NULL;
    9 j1 X# f  a0 n8 Z  S' M
  76. char *dmabufdest2 = NULL;
    ' r  m, h% Y/ F& M* i8 q

  77. * v, i. N0 K1 @- A
  78. static int acnt = 512;8 T! [& s, \% ^* \* E) L9 T3 z( J
  79. static int bcnt = 8;
    ; U. B# ?( T  Z' P) l  ^
  80. static int ccnt = 8;
    4 W  f/ w- I$ i4 m1 J8 M
  81. 0 p3 P4 e" |) i) B7 z) t& l; T
  82. module_param(acnt, int, S_IRUGO);2 Z) B! j3 j  l8 s
  83. module_param(bcnt, int, S_IRUGO);: @7 {4 k" N4 Z( ~( ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 I' G1 G, X' L& `1 t

9 i- g" q; ^. R: P& z7 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 ~5 E( n- q  s1 H! n3 I1 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 j& I% Y9 k4 L2 N4 v3 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 l5 z6 _- h, z% N5 p9 }+ X
5 w4 }5 W* e1 B. E" k+ r! F( F
. K' g1 R: {; |  i1 V& I2 H! R2 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 10:03 , Processed in 0.036937 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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