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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; w  {6 f. S1 z9 l$ s* l: p
  1. [code]EDMA sample test application
    & D2 Y8 P, D( T! ?* o1 _! C
  2. /*
    / f% ~4 |1 K& h! c4 u& u8 U9 f9 h
  3. * edma_test.c
    ( j4 w, d. ^) _  Q( J
  4. *
    + Y0 u1 o8 [! F6 l8 @" A
  5. * brief  EDMA3 Test Application' k4 D. L. Q0 ~; `$ o. n+ b9 F
  6. *" |1 k& X+ }0 U4 s3 h: K9 `4 y) I9 N
  7. *   This file contains EDMA3 Test code.& z' P! E( u2 |, M+ E& D
  8. *
    - q! ]1 b# S% Z# E4 y; i* x9 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 `( t- c7 T, O7 d! D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 [2 Y( Q' t, A$ }( P8 W# s
  11. *         TO CHANGE." h9 o7 D; _' M9 I) R4 t5 R
  12. *$ O7 L3 w" ^* O1 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) ?1 ]$ p4 i. {: ?. W
  14. *- b1 H$ ~) t! C! C
  15. * This program is free software; you can redistribute it and/or. _. a1 @5 @6 m
  16. * modify it under the terms of the GNU General Public License as" C- |/ S5 B0 y8 |
  17. * published by the Free Software Foundation version 2.
    % a. \, B& W0 h4 e. t- W6 g* K/ r" U
  18. *
    6 }4 \. J/ L( T4 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! ?. f. L2 h/ K$ B1 v7 ]
  20. * kind, whether express or implied; without even the implied warranty) C0 a8 h, p  a7 z& h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 b  s: b" |$ ~' z
  22. * GNU General Public License for more details.
    ; M" M. r7 p+ x% j0 U
  23. */
    7 @  u: g8 d* o( p9 S0 w
  24. 9 ~; O9 s0 A0 x4 ?( {
  25. #include <linux/module.h>
    % w( C- ~  ]6 o# _+ P
  26. #include <linux/init.h>
    0 C$ t+ P: c% s: L0 J. }
  27. #include <linux/errno.h>9 |5 `! }$ O8 u) R! D
  28. #include <linux/types.h>
    - Z3 ]5 o5 d; Q5 l
  29. #include <linux/interrupt.h># C& a7 ?' l/ U" Z9 ?6 W
  30. #include <asm/io.h>
    9 W6 j2 H) [% g$ b) `, K
  31. #include <linux/moduleparam.h>
    % G2 O6 l% X7 p$ z
  32. #include <linux/sysctl.h>
    * ?8 W: N3 @% ?7 v+ d
  33. #include <linux/mm.h>2 I9 E$ Y( u- ]3 x
  34. #include <linux/dma-mapping.h>! H4 Q# u! ^$ s( {' T+ p& d3 z
  35. 2 c. k7 u3 N2 S. H; J
  36. #include <mach/memory.h>
    * I/ C& c7 J  R3 S! D! X8 ?
  37. #include <mach/hardware.h>
    ( Q8 x7 r9 g1 }$ P9 o$ k' N. G" n
  38. #include <mach/irqs.h>5 @2 s% |  ?  T  ]' |+ C0 ?5 ?
  39. #include <asm/hardware/edma.h>
    % D: j; V# m0 t7 ^! Z! k# V/ ?

  40. " ]) m' i/ F; x+ Y1 E
  41. #undef EDMA3_DEBUG
    # \: a# P. F6 e1 J) [% @, `
  42. /*#define EDMA3_DEBUG*/
    6 w$ p2 L1 \' O7 s! @1 Q" e

  43. + S: O% n0 b2 U1 _- {
  44. #ifdef EDMA3_DEBUG
      D  x+ q2 d4 M2 z$ z5 v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " V& S3 I8 P6 ~$ E4 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 @# Q5 i0 s- L/ ?: n5 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) b/ B4 e% @% z
  48. #else
    4 Z+ R; P" ]% E+ O. ?
  49. #define DMA_PRINTK( x... )* m4 p( T; E* F0 d
  50. #define DMA_FN_IN
    ) {' k- k6 `; R! d. T
  51. #define DMA_FN_OUT
    1 e& B: r: X0 T* H2 H
  52. #endif
    / d$ U- l3 f+ X! h" Y) x
  53. 3 A! r* K$ E9 b# Q" K1 T7 ~+ K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 {6 X$ _8 t) U) ^* |
  55. #define STATIC_SHIFT                33 n# H6 u4 C$ i/ Z- y
  56. #define TCINTEN_SHIFT               20! n, w2 O% ~2 c# i
  57. #define ITCINTEN_SHIFT              21
    2 S- Y( B. {( H, S$ h8 H' x
  58. #define TCCHEN_SHIFT                22
    - h3 _2 s% u! H$ S4 L
  59. #define ITCCHEN_SHIFT               23
    ) x$ \8 Z# z- `0 r, Q
  60. 4 l* i! G& |7 y6 i$ r" o; \
  61. static volatile int irqraised1 = 0;+ }  T$ o+ a+ m( `  K
  62. static volatile int irqraised2 = 0;5 \4 d* `! I& N: o" J: _

  63. 2 Y! |# G' }3 E" G* J1 l( N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Y5 G7 @- C  f4 W3 k4 g! D8 o7 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O9 |2 K9 }6 R9 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, J1 z6 T/ Q8 X; X
  67. ) y1 G0 v8 K/ g4 e, [4 M  L) ?% p
  68. dma_addr_t dmaphyssrc1 = 0;
    2 y6 F; d* f) C: j# R* l
  69. dma_addr_t dmaphyssrc2 = 0;; C# u  s2 _4 s7 ?& D/ l  g
  70. dma_addr_t dmaphysdest1 = 0;& Y% H; C- v" @  I+ ^
  71. dma_addr_t dmaphysdest2 = 0;1 `# Q+ E( u: C/ {8 P5 n

  72. " N- u  h5 D% \5 t5 \
  73. char *dmabufsrc1 = NULL;
      H5 R5 t- n) Y& r; f* ~
  74. char *dmabufsrc2 = NULL;
    1 M/ p% F7 E3 m/ M/ N: }% B5 L
  75. char *dmabufdest1 = NULL;7 n) o5 e7 Q- g8 _
  76. char *dmabufdest2 = NULL;
    % H! h- f9 _& l, k+ w* G/ m

  77. ( y2 K* s( {  H  W+ x, `( _0 X7 n/ h
  78. static int acnt = 512;
    2 L9 y0 Q/ _# y2 U6 L- |3 K
  79. static int bcnt = 8;
    & n- Z9 U4 s/ s
  80. static int ccnt = 8;* k9 z7 S7 p1 Y9 {/ s+ @% f

  81. ( I* w$ y8 o. m! D
  82. module_param(acnt, int, S_IRUGO);
    4 @2 S8 r# e7 V, p9 t* t# j7 ~
  83. module_param(bcnt, int, S_IRUGO);+ w5 z; s0 ~! a1 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% o3 b" {) X0 i- A& `: \/ S  H5 x, `7 [5 q) p$ X$ F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" E, d7 e. V& \! H1 ^% ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: k% ?% {6 z" S! A! h1 E& S! ]9 _; X+ g1 b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; l1 x! R3 d' R) ~

( I' c# O. I5 i! D* s/ v" D5 U& ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 01:40 , Processed in 0.044879 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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