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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - s3 Q2 P& o5 `4 e+ q+ S
  1. [code]EDMA sample test application4 d& n: x4 ]& ~) I& R8 F, X
  2. /*3 R  A* N5 |+ t/ ]3 x. |+ q
  3. * edma_test.c  \2 u5 N. R, T6 i
  4. *
    . A9 Q4 u; ~1 H9 n
  5. * brief  EDMA3 Test Application) N9 T4 Z: Z6 v! I+ u2 ]4 Z& Y# y5 A
  6. *5 u; O4 f; }( l
  7. *   This file contains EDMA3 Test code.
    ( x- ^2 H# X) C& N: o! l
  8. *
    1 K1 G9 C* P. Z4 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      ]( p# v9 g6 C+ N/ ~; d8 a& r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 J) k3 m9 t# C
  11. *         TO CHANGE.
    , y+ G6 ]; c! |5 p7 @: x* z9 c
  12. *
    1 [0 H, r( V, y8 l! a3 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) @/ F# ]8 R7 f
  14. *$ i% b' W  S# g" ^+ o/ [) i
  15. * This program is free software; you can redistribute it and/or1 t4 H+ b* p8 @
  16. * modify it under the terms of the GNU General Public License as4 a3 _  X7 ~7 q
  17. * published by the Free Software Foundation version 2.
      w) D' n2 K9 W$ f7 g3 R4 \* z
  18. *
    , e+ q8 Z( V6 Y: C% R; i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& z5 K/ X( C& f; Q! {
  20. * kind, whether express or implied; without even the implied warranty5 U: |2 J' s1 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      o  N" d; H' [- |' X  x! u* g
  22. * GNU General Public License for more details.9 C. i4 `, h- v0 N& ]' F3 S
  23. */
    : D( ?# b9 j. e5 m. h
  24. 5 ]: O' N! y7 E6 l1 ]) A
  25. #include <linux/module.h>
    ) Y3 v: s' H/ w, ~8 n: [
  26. #include <linux/init.h>4 j0 y$ F' c: {7 y/ J' E0 r
  27. #include <linux/errno.h>8 ^; L1 U# t, M" R4 p- E
  28. #include <linux/types.h>
    9 \  A, O: [/ }1 W, N
  29. #include <linux/interrupt.h>" B2 c" H7 N" X& M
  30. #include <asm/io.h>3 C5 m8 R; |+ O7 f
  31. #include <linux/moduleparam.h>8 X8 f; }2 x  A0 ~
  32. #include <linux/sysctl.h>
    ' m6 m6 _2 I  j
  33. #include <linux/mm.h>% c6 s( T3 l4 K4 H& P
  34. #include <linux/dma-mapping.h>9 B, Q8 f6 O' }1 q; _8 Z1 h4 k

  35. 2 D" v2 C$ ]) g0 S. {0 `3 b( U
  36. #include <mach/memory.h>* X# Q5 K4 S8 t$ G$ N- ~
  37. #include <mach/hardware.h>5 n: s4 P. j- d; F4 T* T  k
  38. #include <mach/irqs.h>& Z" w: O) B5 }4 t; S
  39. #include <asm/hardware/edma.h>" g* |  V. w* |: b+ V" b: R" K
  40. ) s, \( R: U, g6 A
  41. #undef EDMA3_DEBUG
    : O0 V7 C* z1 V: F
  42. /*#define EDMA3_DEBUG*/
    ! x: ~! Q  s- h/ D. R. C1 Z& N
  43. 9 a3 o5 P0 R+ F+ _- \
  44. #ifdef EDMA3_DEBUG2 T) H. C- |! ^  G6 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 ?. R9 ~5 ~$ ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 v$ F# R8 A1 I' ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 h: [2 J) y5 E9 ]2 l
  48. #else
    . C8 Z  o; e; x3 R! i% a2 x
  49. #define DMA_PRINTK( x... )' s; K4 t# j3 i+ y1 V
  50. #define DMA_FN_IN
    ( E; ?3 Q9 @" j
  51. #define DMA_FN_OUT$ o' K  N0 R- ^1 V9 o
  52. #endif
    2 c. [0 I5 C2 }/ X0 o5 o
  53. - p3 V# Y7 M* [6 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : m/ X1 Q! x. q/ M8 F3 j
  55. #define STATIC_SHIFT                3
    4 a6 l5 W& t1 K# ^
  56. #define TCINTEN_SHIFT               20
    6 R  q& b: R( [6 z& @. \/ r
  57. #define ITCINTEN_SHIFT              21  I, B, b" N' c$ h
  58. #define TCCHEN_SHIFT                22
    2 R' K' I0 F5 F- _0 W8 M+ ?9 N
  59. #define ITCCHEN_SHIFT               23
    0 ^2 x( C( f" Y2 S9 M2 Q
  60. + k! W! W0 a9 m
  61. static volatile int irqraised1 = 0;7 {/ ?4 Y: h1 B0 \4 ]7 V
  62. static volatile int irqraised2 = 0;2 }( k: p5 W5 n; q7 i: T
  63. $ V; r& }4 L+ ?5 v: b* o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ?6 y' A! S: r2 O5 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 s% }* n: X" Q# v: c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 [/ L" A/ c% I

  67. ; C' I/ C# a* z: }0 c
  68. dma_addr_t dmaphyssrc1 = 0;
    % n8 `5 ?2 z7 v% `1 J9 {
  69. dma_addr_t dmaphyssrc2 = 0;
    ; Y0 g) [9 [) |4 ]$ _, E" N$ I) f
  70. dma_addr_t dmaphysdest1 = 0;  C7 u7 A. v; @2 r( H  f  q
  71. dma_addr_t dmaphysdest2 = 0;
    / P, o. u+ T/ D) Y, x- r4 t

  72. 1 p$ y: x: {6 L5 G( p
  73. char *dmabufsrc1 = NULL;
    7 b# K9 ^) D5 O8 b
  74. char *dmabufsrc2 = NULL;
    0 b9 p: h' l- z( U7 s
  75. char *dmabufdest1 = NULL;3 q4 Q" ]3 c/ P% ?
  76. char *dmabufdest2 = NULL;
    2 I9 Z1 H2 J- p4 B8 t! f
  77. 3 A9 D. L( P2 }' e5 Y1 {2 \* R
  78. static int acnt = 512;
    + g3 t  q0 b* P( z2 ~, D
  79. static int bcnt = 8;6 N+ D# C6 H. ^2 _; b
  80. static int ccnt = 8;
    6 K, Q& I/ `8 P6 w- Q+ ?' k9 E
  81. 3 J4 G, ~1 S( B0 [1 w0 D
  82. module_param(acnt, int, S_IRUGO);( \7 ^" }! L% O" _+ j. u" B
  83. module_param(bcnt, int, S_IRUGO);
    $ b( Z5 Z/ [1 M" G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ {4 U- A% j/ y6 Z0 {, U$ m! P; M5 j6 c( f+ f; }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- x" M' d5 a& L1 G) c  h! I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 P3 B3 k* L7 P& D4 p# ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 _! v" y3 |# C9 o( u
5 l8 a/ d5 X. Q, G" A0 b$ J. p2 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 01:30 , Processed in 0.038022 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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