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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Z. ]* N! b3 z( C: @) {" t
  1. [code]EDMA sample test application  B5 \/ p- z& g& D6 @' `, T
  2. /*
    : x/ h  x  f' |4 P8 O/ `
  3. * edma_test.c. }" a2 m- f! l
  4. *
    9 t5 @! a& Q4 u0 z+ c8 I6 P& o
  5. * brief  EDMA3 Test Application3 ^9 j0 m( V1 f; h
  6. *( a$ t- @! S  }, m: g9 V- V+ F' e
  7. *   This file contains EDMA3 Test code.3 {4 d4 _& |; [. m+ w: `1 t
  8. *
    : q$ c  ?; G4 J9 E5 o9 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 `* j- l! H# G; h! c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" l% [. |4 E% ^  r; }
  11. *         TO CHANGE.  G% N1 Y5 i3 m9 d" T& J
  12. *, l9 M# [2 \: h1 l6 C" v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! d" {5 {/ R; C* F$ X6 U
  14. *" g6 L0 t% \* C$ m# v
  15. * This program is free software; you can redistribute it and/or
    : p. h7 q! X8 m! }
  16. * modify it under the terms of the GNU General Public License as
    / m: \7 t; T& {& u5 ~( H$ o
  17. * published by the Free Software Foundation version 2." j: n0 w+ @) r) c' Q
  18. *
      c* d. h3 d! F5 a7 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : {2 ~# e/ ~; d. l* i
  20. * kind, whether express or implied; without even the implied warranty, [0 O, _: {; {! K6 [8 `4 i. t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) O! f8 B4 K  c& ?+ h; a9 a; h8 H( W
  22. * GNU General Public License for more details.- n0 r3 t$ W  K% R/ x6 S
  23. */
    " G1 O3 b- H  C) v7 |# k2 A2 e
  24. / G& w* G2 H7 G/ L# d% h: p
  25. #include <linux/module.h>
    % D+ M6 |. G- `5 V1 g/ _
  26. #include <linux/init.h>3 t* m# z% e% ~( |; R' k
  27. #include <linux/errno.h>
    * `1 T3 S# k  N4 D
  28. #include <linux/types.h>
    ( v' L' c5 v: E# ?3 E# M4 f
  29. #include <linux/interrupt.h>
    6 Y$ L& p7 G: Y  S
  30. #include <asm/io.h>1 {9 ]# M1 C: k. H7 _5 l  C0 ^- g
  31. #include <linux/moduleparam.h>
    6 U6 x0 k; O. d7 ]9 N' ]% b
  32. #include <linux/sysctl.h>
    + G$ @& _% D3 y; ^1 {8 s% m6 G' r
  33. #include <linux/mm.h>- s9 ?. I( T/ O0 R, [; m
  34. #include <linux/dma-mapping.h>' u; b- [, y9 ]+ u

  35. 3 f: P# X9 U6 S, ~
  36. #include <mach/memory.h>
    : N4 v4 r/ o1 P4 a
  37. #include <mach/hardware.h>
    2 A9 l  |' T! s6 d' h9 a
  38. #include <mach/irqs.h>
    5 P2 F; p+ N+ @: ^7 w7 `
  39. #include <asm/hardware/edma.h>
    + X" X4 i" L3 l% W" E* c

  40. . T! X6 D! R$ M! E
  41. #undef EDMA3_DEBUG6 s- v; D" }! t: @8 U7 ^, D. _+ i
  42. /*#define EDMA3_DEBUG*/5 s1 ^- t7 I  n# d. i; @. s
  43. 6 ~" x" O( M3 Z9 Y5 m* s; L
  44. #ifdef EDMA3_DEBUG* r! h) K% j7 M& e2 I" Z; q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Y8 r$ t" \. w4 o2 j- E$ \# A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 a/ V1 {; B/ E  a3 ^9 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): e! U) O) g: F7 ^+ K% j
  48. #else
    3 c( }% X7 n( q! C0 |
  49. #define DMA_PRINTK( x... )2 b$ u& P  G/ m2 \/ r1 f
  50. #define DMA_FN_IN$ f) C9 g! d( D
  51. #define DMA_FN_OUT6 t/ a# {2 r2 ]  k2 v! `$ P
  52. #endif5 F2 Z- h# {6 B* X2 r* E

  53. 2 N% E5 ]3 z/ V! O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) y# o$ ?% c1 M' ?: ]
  55. #define STATIC_SHIFT                35 `) ?+ e( Z  @* G1 C9 s' e
  56. #define TCINTEN_SHIFT               20) p+ l3 L& Y7 V( Z. S4 U
  57. #define ITCINTEN_SHIFT              21
    5 F) |8 H" J! e) v3 s' A; A
  58. #define TCCHEN_SHIFT                22% a0 ?- _& H- p. x8 K, ?2 \7 O; B
  59. #define ITCCHEN_SHIFT               23; E4 V, D7 J% b$ a

  60. 2 D3 n$ g3 \( a9 E: ~
  61. static volatile int irqraised1 = 0;
    0 p7 q9 z8 i( P& D  t/ C
  62. static volatile int irqraised2 = 0;
    5 C* T0 h( j. z/ \! d9 H3 m' n

  63. - Y; `- J+ i! O% j0 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 B8 {( K) U9 C$ \% `% C1 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ o) R. e3 G9 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e) R6 D; i1 f. w1 }& m! c% Z: c
  67. ( u- ^. m: s1 g1 T+ `2 R
  68. dma_addr_t dmaphyssrc1 = 0;
    5 S: f4 ^: y5 ^' R" B
  69. dma_addr_t dmaphyssrc2 = 0;
    ) O+ d- k6 ?4 C  L; X8 }) q8 N4 y
  70. dma_addr_t dmaphysdest1 = 0;
    5 [4 s7 E2 c5 N$ d( I" R& `
  71. dma_addr_t dmaphysdest2 = 0;" J0 `* I4 G* {; V/ d6 {, P/ r
  72. : o1 @8 H, t/ c  x9 z, x. \
  73. char *dmabufsrc1 = NULL;
    . y) w( i4 t7 ]- C: w" p2 g1 e
  74. char *dmabufsrc2 = NULL;
    0 j2 o  u/ S  W. s! }
  75. char *dmabufdest1 = NULL;
      k: F) U* ~9 }) @/ `* }7 V9 A
  76. char *dmabufdest2 = NULL;
    ' v' r' o* B! O, z

  77. 0 j3 y6 W5 K6 ]3 e! n
  78. static int acnt = 512;  @5 x2 ?' W9 ]2 O& ^! U  m
  79. static int bcnt = 8;/ `" Y  m4 `$ o" e3 S1 a
  80. static int ccnt = 8;, s9 B4 `* A% i! c

  81. + V* B& [5 a9 n" G2 e
  82. module_param(acnt, int, S_IRUGO);. K3 i& x% b$ r. i
  83. module_param(bcnt, int, S_IRUGO);4 g  J, |: M$ ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. B3 N4 Q' T/ B3 n/ D
% Q% F+ x- `+ _0 v# ]  A0 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 Z4 a1 }/ Y1 T7 \: larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 u7 T. y7 [" v0 r3 c6 a. B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 h- A1 B5 e) A
/ U8 d6 M% H8 z5 H. Q0 k+ m
# a. j+ _4 a" U% K6 P1 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 13:06 , Processed in 0.038092 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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