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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ T+ V( L1 F9 U' [- U2 {$ G4 v( h
  1. [code]EDMA sample test application
    : b  a- s* V+ M& a2 g# w/ T; {
  2. /*
    # k6 f+ Q6 r. I; a0 Z4 E  _
  3. * edma_test.c5 u2 C4 \4 m) q! O$ Q
  4. *
    * V# ]1 L, @4 D7 m$ A
  5. * brief  EDMA3 Test Application0 [3 V% j; Z7 s  Y
  6. *! O% C' ^6 G/ v3 o
  7. *   This file contains EDMA3 Test code.- H  U& s. k$ e
  8. *' y% z/ v1 [4 v9 T9 [% k9 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ L; S4 q  C; r( y& k" |4 _+ J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# P- H) z. W1 _. j( ^- Q
  11. *         TO CHANGE.
    . A  R2 }7 L$ _) k3 ]
  12. *
    ' ?$ z! I/ U0 ^/ t9 h' y8 O) }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 f: w* d9 S/ m8 z
  14. *' u2 B1 L! u" s; I
  15. * This program is free software; you can redistribute it and/or% n' p7 B& i0 N3 e; L1 v+ L: y$ m
  16. * modify it under the terms of the GNU General Public License as
    6 Q, Y" v3 @  D) \( x" V* n
  17. * published by the Free Software Foundation version 2.* }0 r4 r/ {5 e1 r
  18. *
    1 q& W0 D& x- A2 y" ^: G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 a, i3 n3 q: ~! y' M6 I
  20. * kind, whether express or implied; without even the implied warranty
    / \6 y% r9 k" H8 k1 S9 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- {% k& E4 m+ Z4 A' [$ K/ f5 ?0 W4 w6 F
  22. * GNU General Public License for more details.
    1 w$ y# c3 r& _. P
  23. */
    $ m, K- I; f& M9 Q) u+ e

  24. 9 c) `, G! V  q2 T5 H8 O
  25. #include <linux/module.h>
    0 O# R) }2 _! e5 n( U+ L3 y% |+ {2 u
  26. #include <linux/init.h>
    ( s2 W" u9 n& ?9 I6 W8 U& x1 S# [% D0 q* k
  27. #include <linux/errno.h>
    ! o8 Y! L1 P: q
  28. #include <linux/types.h>6 a1 C! `9 u4 P4 R- M/ O
  29. #include <linux/interrupt.h>
    5 L* m: o$ M3 |1 A$ I; |
  30. #include <asm/io.h>3 n, y. l0 R; I  ?9 N6 A# }
  31. #include <linux/moduleparam.h>1 R1 [" h/ _) I- w$ F4 h& O4 h
  32. #include <linux/sysctl.h>
    ! ^! k: x6 K) {( O# Y3 X+ l
  33. #include <linux/mm.h>
      u7 V2 B! E* \3 j0 k2 h* p
  34. #include <linux/dma-mapping.h>1 L, h) b* M: x6 ?1 \; C
  35. , [( @7 @$ `7 J: ?& [7 q) O  ^! o. K
  36. #include <mach/memory.h>
    2 o3 C7 t1 x2 G
  37. #include <mach/hardware.h>
    / A. C# C% q3 A2 ~' K" V
  38. #include <mach/irqs.h>% U: U8 T# w, I; P4 _3 ?
  39. #include <asm/hardware/edma.h>. ~1 r4 `1 D5 I# U5 w0 [

  40. # _/ B6 f' \- {( w
  41. #undef EDMA3_DEBUG
    % z% q+ @8 x! @" `  j
  42. /*#define EDMA3_DEBUG*/
    ( x, q) ~9 e" Z6 s
  43. 6 n6 ^9 t/ o+ U4 g+ j
  44. #ifdef EDMA3_DEBUG5 o3 l0 o+ U$ R$ g. q7 P* ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 n, q: n8 e! ^0 M* r  {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' M, }5 d  [  ~3 {3 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 ]8 |2 W/ k( x1 c& l: N5 }
  48. #else
    8 X$ w) P2 m9 R: e) K3 W
  49. #define DMA_PRINTK( x... )
    . i  B  r+ c" f8 i2 ^
  50. #define DMA_FN_IN3 G; m; N/ P! w: S5 o) d' A
  51. #define DMA_FN_OUT
    5 x% T9 w. A! I, ]- P
  52. #endif
    " n" j, S2 b1 V8 _$ i' l# W

  53. 3 \0 ^/ [: w$ `1 i& q8 H5 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 Y+ T9 M5 U, L$ |
  55. #define STATIC_SHIFT                3
    # v5 R1 y3 g5 m8 U
  56. #define TCINTEN_SHIFT               20
    3 f& {3 i0 F! l3 W& \$ m
  57. #define ITCINTEN_SHIFT              210 b6 A/ J8 T# K: b1 I) {
  58. #define TCCHEN_SHIFT                22
    ) Y/ I5 {, d+ S( x; u: w8 m% r" F# E$ J
  59. #define ITCCHEN_SHIFT               235 g- X3 q; v: E7 t3 L: r" C
  60. / z! ]$ R+ I, A" P6 m4 c6 Z3 e
  61. static volatile int irqraised1 = 0;
    1 K% N6 ~' B% |$ G. c
  62. static volatile int irqraised2 = 0;
    $ M1 [% v) G3 m4 z

  63. 5 a' A% }; Z- x, q6 d/ p9 x- `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o8 ^8 M0 S7 r, g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ ?% L( d0 {% U9 x- G1 Y6 \# [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) e1 o- J1 D  B, J. L
  67. # G% C5 r9 [) t( v8 x
  68. dma_addr_t dmaphyssrc1 = 0;2 `' I( o& `* ?. j
  69. dma_addr_t dmaphyssrc2 = 0;- k  j7 X; S4 o
  70. dma_addr_t dmaphysdest1 = 0;  O2 Y( m* T9 J7 {) D' e& c% G4 Y
  71. dma_addr_t dmaphysdest2 = 0;& |+ v( K. H8 i, P4 }

  72. / i. z6 t$ \& C; B2 F
  73. char *dmabufsrc1 = NULL;' [! C/ o; k* U3 g4 Q# T( K
  74. char *dmabufsrc2 = NULL;& Q. K1 m* I) I2 u" e( S2 y, _8 ^
  75. char *dmabufdest1 = NULL;
    2 K9 f2 }! v- `
  76. char *dmabufdest2 = NULL;
    0 e( y0 w% P  T% p/ N. u! x9 N3 ]
  77. ' p% Y( q  A/ b8 `1 B
  78. static int acnt = 512;
    2 C1 z5 `) D. G
  79. static int bcnt = 8;
    * C/ ~2 }" V4 p/ d, f  A
  80. static int ccnt = 8;
    $ Y" r: r; ^4 O4 Q2 i

  81.   V# T- \: j# s) C* S% O, p% r2 d
  82. module_param(acnt, int, S_IRUGO);
    " E6 W2 ~* n7 ~( B- `3 v/ Z
  83. module_param(bcnt, int, S_IRUGO);
    / F2 E- Y0 q2 V) j  e6 F0 E7 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ W  j& K8 O, a+ y5 a5 a, P( \' K$ m7 i' ~' y) Q5 F$ M' A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' o; Y) t' Y& }+ B7 @$ _2 h! \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 j1 ^/ I3 J+ N" L. f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 O, `8 t% S& z; ^) t
/ G1 E: {0 w/ s8 [
- R5 a9 h' ?0 Z# z: S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 11:45 , Processed in 0.037794 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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