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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 ~. G: |( h  e. P7 o
  1. [code]EDMA sample test application
    ; i" f- q* C( b* o# e. |" u) }
  2. /*  T5 n" N% M( |. h
  3. * edma_test.c3 ~$ \6 o: t% y
  4. *
    - c; C1 u3 X4 g* k  D
  5. * brief  EDMA3 Test Application
    & T6 J' t; {9 ~/ G0 \1 T% I# `0 o
  6. *. j4 D6 `. P$ D/ m5 b
  7. *   This file contains EDMA3 Test code.' A# {. S$ D" L# ]% L' q$ i
  8. *1 \- A7 Q2 y! W3 H! {% G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 v( w3 `# |0 p0 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. U( b* G5 _! l. t# Y
  11. *         TO CHANGE.
    2 K, {8 A) y% I5 F
  12. *# |& S+ @+ L7 K2 m  k" G, G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - {9 H$ g  S1 U1 `, {& N
  14. *
    7 U7 K/ y, v- y7 J8 \
  15. * This program is free software; you can redistribute it and/or* A4 O* }' o$ o0 ]
  16. * modify it under the terms of the GNU General Public License as
    % q$ Z& ]! B" Z6 O( V7 Y6 K% b
  17. * published by the Free Software Foundation version 2.# ^1 [1 X$ X, b, O9 }- X. ?
  18. *: j7 c, G+ F% y9 ^4 P: Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , V# G/ X# ~2 b9 K
  20. * kind, whether express or implied; without even the implied warranty2 ]# [, d$ L5 L1 U- D2 [& U& ~7 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ b4 G  v. E( u: J
  22. * GNU General Public License for more details.
    . p+ @, N& ?& g% o2 X& f9 q/ j7 d% I
  23. */# _' i; ]" `; R7 K: ]4 b

  24. * o1 s# T, J# D' {3 K' S" W1 G3 i. ^
  25. #include <linux/module.h>
    9 U4 O  M7 b; W% l4 `% k7 S
  26. #include <linux/init.h>
    ! W' K  e( u7 }$ V. M- i, ?
  27. #include <linux/errno.h>( l. K, P# m  B9 _5 I
  28. #include <linux/types.h>
    . i& u* x" g" K/ O* z
  29. #include <linux/interrupt.h>
    $ C9 A  F: r2 C) t7 i3 x& X
  30. #include <asm/io.h>
    # u8 u! l. q% o7 |* U
  31. #include <linux/moduleparam.h>
    + o8 ?6 ^& f3 F
  32. #include <linux/sysctl.h>6 ?8 `, g+ I% Z' d3 O8 ?- M
  33. #include <linux/mm.h>
    1 d9 {0 Q& [3 l+ [0 Q$ a5 N
  34. #include <linux/dma-mapping.h>5 L: b' x" V% T& i, s( Y; S7 D

  35. 3 P% {, G. x3 G1 x: S
  36. #include <mach/memory.h>4 v6 L+ r, Z% T( ^: f2 H9 }2 s& Z+ L
  37. #include <mach/hardware.h>9 B3 t7 q+ `0 y' H; e) Z
  38. #include <mach/irqs.h>- J! R0 ]& v9 e
  39. #include <asm/hardware/edma.h>+ w, l' D0 l6 A/ H  X* b

  40. 3 a! n- p; \0 Q
  41. #undef EDMA3_DEBUG) `8 Q  E  |" l4 S
  42. /*#define EDMA3_DEBUG*/
    ) c0 z1 E8 v* M$ i. A
  43. 2 U* \. L5 c2 [
  44. #ifdef EDMA3_DEBUG8 X  j/ f& H8 N; [9 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 H6 x' u1 d7 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + l% x. U* B! t- G1 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  v, M6 N! P/ I) C- k" Q
  48. #else
    4 N6 I# ^; _; E2 S0 C+ R/ m2 x
  49. #define DMA_PRINTK( x... )
    1 ^1 `- a- y* t5 I  R7 O  p
  50. #define DMA_FN_IN
    * K* ^' O) S7 U. N+ R5 o9 h
  51. #define DMA_FN_OUT
    9 U: d4 k6 d% A8 I) C+ B
  52. #endif
    + v& X2 L/ Q- C2 S  T( ?7 k
  53. 1 {& R/ Q0 E- r! f6 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' `" _: Y! ]; r6 K3 |3 C1 E
  55. #define STATIC_SHIFT                3
    5 w' u! E( @, x
  56. #define TCINTEN_SHIFT               20! p+ j- D' c5 M8 r
  57. #define ITCINTEN_SHIFT              21& F6 D, X/ G1 {" \8 G* y
  58. #define TCCHEN_SHIFT                22
    ; U9 r( Q  {- e+ u
  59. #define ITCCHEN_SHIFT               23
    % c$ U( m! ^  f7 J! a# n# c
  60. + Q1 ]6 s: P# y" j: s# z$ q
  61. static volatile int irqraised1 = 0;
    0 c7 q& i- r4 e$ Y, v+ x7 D
  62. static volatile int irqraised2 = 0;" L+ V9 ~) F' x7 y1 [8 n

  63. 6 B" ^( ]6 I4 n: V3 e# Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! n: H! c. ]* S7 K$ F2 O+ _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 n, p! K& l6 T1 B/ U0 V% U, @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : H4 c3 A& ?; F1 I/ [' |
  67. 8 C/ k; K$ K4 ^
  68. dma_addr_t dmaphyssrc1 = 0;
    + t: B2 b. g- W
  69. dma_addr_t dmaphyssrc2 = 0;) L  U0 ?" Z5 w9 U1 R& `: F; }6 r
  70. dma_addr_t dmaphysdest1 = 0;
    2 g+ j. {6 G* F
  71. dma_addr_t dmaphysdest2 = 0;
    / I4 H0 P# V3 X6 d) R+ Z, t2 g, S9 {
  72. " @3 G; j5 W2 ^0 ~+ m1 |
  73. char *dmabufsrc1 = NULL;
    , n- D+ F1 u; v+ ^  c$ D
  74. char *dmabufsrc2 = NULL;3 c3 W" o! {# S3 G1 s* r3 O' ^. _
  75. char *dmabufdest1 = NULL;9 O( O+ B% P& `. M& r$ D' r3 E
  76. char *dmabufdest2 = NULL;
    ; z' K2 z( `' B

  77. # k3 \) f: X/ p
  78. static int acnt = 512;
    2 u2 F3 n+ g, U
  79. static int bcnt = 8;
    7 N7 F3 T% E5 _9 v; \1 B" U
  80. static int ccnt = 8;
    : Q8 j. Q( U- A9 ~) M5 N

  81. 1 u1 z* D. |5 ~! n! W. E# `
  82. module_param(acnt, int, S_IRUGO);5 @8 Q7 `# ]5 X1 v1 F
  83. module_param(bcnt, int, S_IRUGO);
    , a8 f  d' }! z: Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# F) ]' M/ f. m% b5 a3 h3 Q7 N1 i# L$ g5 E- P% h: y9 p6 t, G( j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. E1 f: g! X, Q) M' l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( E! F8 }0 p" [. m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 G/ O- ^5 `( L( p
, H" i* w% O3 V7 ?$ p! P
4 j* M! @) W+ a. S' |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 02:39 , Processed in 0.045752 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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