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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& \% _) E9 }" |7 _( N
  1. [code]EDMA sample test application
    6 p" r% ~# c% x* Y3 C
  2. /*
    - z: X6 G; c- _6 D3 u0 `$ F0 p
  3. * edma_test.c1 d! L2 v- H7 D8 f
  4. *
    6 e6 D- c3 W2 M4 l4 c
  5. * brief  EDMA3 Test Application* O8 X5 S! [* I
  6. *
    6 n8 u  g5 ]1 u0 Q
  7. *   This file contains EDMA3 Test code.6 @0 g5 o3 x4 G6 }$ [
  8. *" S# E/ t3 H7 H( G' [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * u# H$ s9 v) n* w0 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % q& o/ _" r/ N; w& Y' t& [
  11. *         TO CHANGE.
    ; N( {0 r; M+ h. I" G8 Y: T
  12. *3 f% A( V# ~2 H% f) J  z# ~8 g4 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / A8 T# ?" j7 B6 o# Z. D( v3 m
  14. *
    & Q9 F& I; x) W
  15. * This program is free software; you can redistribute it and/or/ N4 h2 [' O3 _* h. J/ S+ {$ \
  16. * modify it under the terms of the GNU General Public License as
    ; j2 X  e2 A  r/ F
  17. * published by the Free Software Foundation version 2.
    4 U5 k$ F$ W/ N* T
  18. *% x8 p6 P0 m, T6 y9 d) o/ ~; I8 A* R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ~9 j! j0 C# V
  20. * kind, whether express or implied; without even the implied warranty
    5 w7 l8 B$ {3 ^9 J: [. _. S# S$ I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 j! N8 }+ [! F1 P, d5 ?
  22. * GNU General Public License for more details.
    & g! L$ u8 c( z4 B% V, K; T0 w
  23. */$ z+ g* e$ w1 }) Y

  24. * t) ~7 E: S. v6 M1 Z) ]5 |. y
  25. #include <linux/module.h>: [+ C/ t1 h4 X2 Z0 e7 U0 A7 b" u
  26. #include <linux/init.h>
    . R: x2 o  C) X! E
  27. #include <linux/errno.h>" W4 l" d# l3 Y+ m' n4 A8 k/ ]$ ~
  28. #include <linux/types.h>
    4 j+ P0 [. r) Z2 q$ r7 i: u: [- B
  29. #include <linux/interrupt.h>5 j. S& p* u3 b* S4 t7 p
  30. #include <asm/io.h>
    % A% H3 R" f. O8 p2 J
  31. #include <linux/moduleparam.h>
    ' @, C! v! Y6 }5 S. C
  32. #include <linux/sysctl.h>
      x6 Q7 X# h5 O8 G! ]
  33. #include <linux/mm.h>
    ) `0 C  d" [3 R6 t. Q
  34. #include <linux/dma-mapping.h>
    6 t! R9 P5 f* B$ l
  35. * f! f$ \/ S1 r
  36. #include <mach/memory.h>' u( N, b" Q( T  P0 q, A6 U
  37. #include <mach/hardware.h>
    ) d* x# U  I/ ^* [$ s
  38. #include <mach/irqs.h>4 p, c  E: u. ~1 {* r6 T
  39. #include <asm/hardware/edma.h>
    ! G1 _, [: x$ W$ v1 i) O0 n) f0 |
  40. 0 k. D1 h+ A. B" v$ s. O6 r! C
  41. #undef EDMA3_DEBUG
    ! I1 u8 L; H3 C& I: E% H# ~6 M
  42. /*#define EDMA3_DEBUG*/
    3 d/ W: w/ P- h, p5 s$ h* i: R. _

  43. 8 T$ S" Z" j: l- O! @4 v
  44. #ifdef EDMA3_DEBUG
    $ M) P0 W$ H' E! r8 n# M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' Z9 L4 |6 L1 k& W2 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - g* Y3 u+ B4 e' t% j7 K! s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" b4 Z, {& P# l
  48. #else
    4 w2 t# y: q4 Z
  49. #define DMA_PRINTK( x... )
    ) ^# d) Q2 M1 i3 N' g* G
  50. #define DMA_FN_IN1 E6 t" T0 S6 {: d1 a
  51. #define DMA_FN_OUT% e2 ]2 N: j& X  J7 z
  52. #endif+ k0 ~' |4 `( \# R% u  ?
  53. 9 y5 N, o# Z% w! K0 a5 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). ?) o. v% l8 G% V# u  I  O" Z" b+ s
  55. #define STATIC_SHIFT                3' g9 d$ N' p. a1 G
  56. #define TCINTEN_SHIFT               20- ~2 y9 j# s7 Z& r( K
  57. #define ITCINTEN_SHIFT              218 e: f; ]! Z5 @/ K, @! N- l
  58. #define TCCHEN_SHIFT                22
    5 d  ]& T; t" d- U9 V1 H
  59. #define ITCCHEN_SHIFT               23) k" y: C: w3 ]6 Z

  60. 6 C7 ?- w, D# t$ C0 ^
  61. static volatile int irqraised1 = 0;* w' \4 Q5 t1 Y. L7 U
  62. static volatile int irqraised2 = 0;+ }7 p% t, c" D; c

  63. 5 q$ F/ F% k4 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 O) ]% Y! \. Y( `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- U+ b( l$ Z. J1 B) i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 p1 a8 w+ L3 }2 P

  67. - s% g8 a7 G; e6 \. J8 Z$ @
  68. dma_addr_t dmaphyssrc1 = 0;
    9 e$ ^& W$ E) `2 ^  p
  69. dma_addr_t dmaphyssrc2 = 0;
    ; a! H8 A* b1 W' Y3 z' w; S
  70. dma_addr_t dmaphysdest1 = 0;; a6 Z( G8 h& h
  71. dma_addr_t dmaphysdest2 = 0;
    3 D1 y. j# W, h; S% Z  B, B

  72. ( }6 B7 i3 R- A1 ]( C, r" I0 V+ d
  73. char *dmabufsrc1 = NULL;
    ) F" r: Q' ?+ y$ u3 Y! d
  74. char *dmabufsrc2 = NULL;" J$ f4 o7 z- l6 `/ h  n. K
  75. char *dmabufdest1 = NULL;5 S$ b4 i6 N& `- W  \& T0 Z
  76. char *dmabufdest2 = NULL;
    , b* O( [6 v% B

  77. 7 n2 B# q$ w% x2 ^
  78. static int acnt = 512;. {' L/ ]% D( ~3 h2 W" f5 A( Y
  79. static int bcnt = 8;
    9 ^8 T$ ~4 L7 h
  80. static int ccnt = 8;1 I) ^% _+ M! |

  81. , r7 u( s) O) d: q9 D; G) b
  82. module_param(acnt, int, S_IRUGO);
    # N, ~" p" d0 b! [8 r
  83. module_param(bcnt, int, S_IRUGO);
    ( S. |, [& D& ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, k0 {- C7 K/ q# _% e

1 u! Y: t$ k0 u) X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 H7 v, D8 p+ N; s0 W7 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& |+ ^! Y" B/ N% n$ m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. p# r% l0 m8 Q( t8 V% t+ @! d  q5 W$ u- B# N
: g6 z6 U" u+ G8 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-13 00:05 , Processed in 0.037627 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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