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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . K$ G9 ]* N& a$ H( {" n: C
  1. [code]EDMA sample test application& \8 i" s2 Z; n
  2. /*
    ! F/ p5 T0 i* d# _7 i
  3. * edma_test.c9 Z8 o6 H# ^; L* a2 X
  4. *
    $ r2 M7 W: {3 G: l9 Y
  5. * brief  EDMA3 Test Application
    6 a; P7 A+ q9 p7 a" T2 c
  6. *
    ! c/ Y5 r! B; X2 Q( z' j) R: Y
  7. *   This file contains EDMA3 Test code.
    * r$ c- c; B. r8 ?" _, {: p
  8. *
    5 A% X9 e6 T2 ~% T  a  u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ B2 Q3 F( `9 h: q. a* ^3 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 Y8 V/ g( V& z, J6 |
  11. *         TO CHANGE.
    1 {1 r9 n3 s) k7 f4 b
  12. *
    9 p& }) |  ~) D2 ~/ H2 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 |: Y: B' b. L- t& E
  14. *$ t7 N- Q* x8 B
  15. * This program is free software; you can redistribute it and/or
    ( H+ p" e7 \; n. d) `
  16. * modify it under the terms of the GNU General Public License as: F3 s( D& F9 B! V' K2 H& J6 ], |
  17. * published by the Free Software Foundation version 2.
    - T- d3 C$ n. D6 e
  18. *$ G/ ?% H3 Y9 Q' q4 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 `8 g  F! e9 O8 a) |
  20. * kind, whether express or implied; without even the implied warranty/ z* O" ^/ \3 @' L1 D- }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 L' B0 f0 N* v
  22. * GNU General Public License for more details.  u6 L' o  o' \8 K. ~
  23. */
      n/ m& P9 X" h  s4 ^
  24. $ n1 }% W, Y' A
  25. #include <linux/module.h>
    9 |, T$ N9 e5 p' n! C2 u
  26. #include <linux/init.h>
    , F, J0 L* t8 t4 h& X
  27. #include <linux/errno.h>
    ' h) d! Z8 y  S: J
  28. #include <linux/types.h>: p4 e! i$ K2 }2 Y3 E
  29. #include <linux/interrupt.h>
    % Y7 L( S& I5 X  `  J
  30. #include <asm/io.h>- j) n: X  G, H* d- v( U
  31. #include <linux/moduleparam.h>7 {: T8 Q; I6 r% J
  32. #include <linux/sysctl.h>
    / {0 Y- c7 Z2 s
  33. #include <linux/mm.h>/ S* t# g$ q8 K6 o, K
  34. #include <linux/dma-mapping.h>, N: k: E5 D( Q2 m+ a" w% m8 Q

  35. 4 O/ F; ^1 y5 t1 d8 w8 P
  36. #include <mach/memory.h>
    % A0 s( ?  A+ E: O& ~; Z
  37. #include <mach/hardware.h>
    * N+ R' \) p* D2 ?2 w9 L
  38. #include <mach/irqs.h>, f  q5 |8 B( n+ ^! p- Z, `$ E) C
  39. #include <asm/hardware/edma.h>
    ! C8 l. x0 L7 O* l0 q  P
  40. - g4 E: \: F0 f+ z
  41. #undef EDMA3_DEBUG
    / f* G; ]' _5 z. F( V
  42. /*#define EDMA3_DEBUG*/! d4 t7 I. J7 x1 L$ W& {" P

  43. 2 ^! V) K. _+ K6 L, [3 p
  44. #ifdef EDMA3_DEBUG- t% f7 K2 k( w+ y2 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 p( l5 d; t  ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ x' F; T" @0 u: [: d% z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 W. b: \( l9 ^5 H
  48. #else$ C; f. y5 m! `2 X' w! a7 I4 W4 ?
  49. #define DMA_PRINTK( x... )# b0 Z' F, V- n
  50. #define DMA_FN_IN
    ' F; I  A4 F& r5 M
  51. #define DMA_FN_OUT- T$ J. U$ M/ S3 R) t
  52. #endif* {  n. M& P  X& A
  53. ' R) ?2 P& q: c! W: j# e1 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; H5 K) v+ X2 G  O2 S/ _
  55. #define STATIC_SHIFT                3
    0 j+ I1 ^) ~$ I
  56. #define TCINTEN_SHIFT               20) s+ `; H6 S( }/ Y; N: x
  57. #define ITCINTEN_SHIFT              21
    2 L2 I4 ?; p- a( q6 f" o! n
  58. #define TCCHEN_SHIFT                22
    $ D2 D4 Q, {% y0 S% M  u
  59. #define ITCCHEN_SHIFT               23
    ! a, u0 T0 n' K% {/ Z, L

  60. * a& H0 a! m. X- v' D: V( l
  61. static volatile int irqraised1 = 0;& }- F/ X7 t) F/ {, ]: s
  62. static volatile int irqraised2 = 0;
    * N# y0 [: b, f9 C1 f8 e! z) k! p0 V' k

  63. " g' a  a& `5 A' g# A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * C  C) A* o) M4 e. V+ A: j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / V# i# Q1 L7 e7 O; N) p( y% ?3 r/ q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ I" A& g. X3 n4 d4 C3 [9 e

  67. 2 R7 l6 G' T! O* ~
  68. dma_addr_t dmaphyssrc1 = 0;4 r3 b' I9 ?  n
  69. dma_addr_t dmaphyssrc2 = 0;
    . O7 a0 c/ }6 T' R# E  e6 q5 t
  70. dma_addr_t dmaphysdest1 = 0;+ d9 E! O1 F9 y
  71. dma_addr_t dmaphysdest2 = 0;
    ( `5 s6 p3 l2 B  [" B3 S" [! \/ U
  72. " f" t" {9 z: f+ m# v
  73. char *dmabufsrc1 = NULL;
    . {( E* L+ {; ~/ `
  74. char *dmabufsrc2 = NULL;. h1 k/ a& E7 _2 ^' l% z, n, |
  75. char *dmabufdest1 = NULL;
    ' w5 }; _) |+ _! v) u, |- k
  76. char *dmabufdest2 = NULL;! W9 q" B6 k. Z8 c( N6 ]+ u

  77. ! N0 b* _3 R; L
  78. static int acnt = 512;. }' g* g1 L& k+ p2 i3 A7 t1 T
  79. static int bcnt = 8;
    7 ^7 @0 t: e$ C, D* y+ G
  80. static int ccnt = 8;* L6 [* d. r" K

  81. 6 D# j, ^3 N: m& ~
  82. module_param(acnt, int, S_IRUGO);2 b& b2 k' q5 V* r! y: M
  83. module_param(bcnt, int, S_IRUGO);
    : y, ~0 g) o2 j( i* s+ M! ]; J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 N4 L" Q  M6 _! y2 D" ?- d' F

* W4 O- L* ^# V  o3 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& |2 q* g/ f" H! u1 S% Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& Y; a7 l8 S  y0 X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 [# v4 T2 r5 L3 Q* ~

. [( d3 _* u+ U. ?5 x6 P- v- `8 }8 Y6 r* X* D' a) M  h: l! Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 23:20 , Processed in 0.042735 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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