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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& z: d. E) s% K. I, b* T
  1. [code]EDMA sample test application% L: }. P9 Z2 J  X
  2. /*5 \; ~2 G1 d5 y- F9 R& H* I
  3. * edma_test.c# [' c/ N8 _' T! S. Z& a1 X
  4. *
    1 O6 Z' W. v6 b+ i. w. q) T" J
  5. * brief  EDMA3 Test Application
    9 g8 r. j) H  J3 q( G5 ^
  6. *
    # ]4 Q, R1 g0 _' H0 z8 q8 b9 x% l
  7. *   This file contains EDMA3 Test code., O$ s+ Q- ^# }3 t) t  Q5 c1 G
  8. */ J2 k$ R5 D6 F( Z4 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * c( ~5 I; |1 O1 V) `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 d3 a# I4 y& T1 M. h8 C$ a
  11. *         TO CHANGE.
    ) J; W" j/ d$ R% @3 `
  12. *
    ; `& j7 l# G4 `2 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( D( B, O6 G6 W4 g* h- n
  14. */ ?+ R3 z4 v) ^
  15. * This program is free software; you can redistribute it and/or
    * j9 o7 ~. H+ b) Z, ~: {8 G
  16. * modify it under the terms of the GNU General Public License as
    6 X& x" L3 \, T+ F3 D+ G
  17. * published by the Free Software Foundation version 2.& n' W8 t1 ]" Y  J* s. `( N& p) e
  18. *5 w8 G1 ~& I) {7 W  c6 y& |4 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  X' A5 V) U9 [, A; o
  20. * kind, whether express or implied; without even the implied warranty
      b7 c! `9 T- M# S- F2 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 h3 O9 i! u5 v5 s* D# M- S
  22. * GNU General Public License for more details.9 {+ F5 b" S* A; R7 e
  23. */
    , T( O" y' ^$ r) {& l

  24. ) ~# s1 s( _  i% G) a" L
  25. #include <linux/module.h>
    + u+ y! U- H% X( W
  26. #include <linux/init.h>
    6 z0 P7 g1 z7 E* _* M2 ^" y3 m
  27. #include <linux/errno.h>
    % w( R! m$ l) U, l& z7 g
  28. #include <linux/types.h>
    - H8 N% L  k- q1 n
  29. #include <linux/interrupt.h>4 |: n* }" m- l7 Z7 M$ z$ N
  30. #include <asm/io.h>
    1 n9 v  ~- W0 d# R# @$ |
  31. #include <linux/moduleparam.h>
    $ m! ~, V0 V5 B7 X1 t
  32. #include <linux/sysctl.h>5 Z3 @8 T# P2 q# ?* E1 E/ o& x
  33. #include <linux/mm.h>
    # U! Y% H% N8 f2 C$ N6 ]
  34. #include <linux/dma-mapping.h>
    3 a, _7 u' A: K6 ]; Z+ s

  35. / B" ]- E2 \2 P# ]5 a8 h& P8 c
  36. #include <mach/memory.h>2 Q6 ~+ F1 P0 J% R
  37. #include <mach/hardware.h>
    , n/ s* F, `4 I7 q8 ?  {
  38. #include <mach/irqs.h>
    " c! K* A" i3 O  A7 s
  39. #include <asm/hardware/edma.h>: {* D; z/ D! x! t
  40. 3 c  Q7 c2 ?# M* W0 u. N5 a
  41. #undef EDMA3_DEBUG  t! y( I8 S' L3 c
  42. /*#define EDMA3_DEBUG*/
    4 l: O, u2 J( g1 x4 Z4 T
  43. 0 {5 A2 K1 P+ s
  44. #ifdef EDMA3_DEBUG
    6 \) Z( V$ H( W* p9 o1 B/ i. ~  B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) x2 J" O& a  q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      D8 ^$ {- w0 U  k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : p0 _9 G8 ~, a
  48. #else
    6 B7 ~! O5 t/ {* \
  49. #define DMA_PRINTK( x... )) J6 a. O0 n7 g; f. C3 t7 J) }) x
  50. #define DMA_FN_IN$ H! g9 A0 M5 K8 w  e
  51. #define DMA_FN_OUT
    0 ~, _4 Q" c& X8 ]/ `8 U8 W
  52. #endif
    8 I/ V* z0 Q6 G! B
  53. % l( U0 E) P4 u, n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! F0 s/ h- n0 `8 I8 o+ U
  55. #define STATIC_SHIFT                3+ V+ ^) j  ?' J* r2 [
  56. #define TCINTEN_SHIFT               20
    5 k$ V- d+ a5 F+ S  t# p
  57. #define ITCINTEN_SHIFT              21$ \7 z, ?$ E& I6 ]# Q7 p
  58. #define TCCHEN_SHIFT                22, q3 L) d1 l4 o. Z2 C0 ~. R
  59. #define ITCCHEN_SHIFT               239 Y$ F+ m5 j+ |6 c9 B, y

  60. ! [" E+ a1 W+ H) d" g: d
  61. static volatile int irqraised1 = 0;
    , q6 s( d" E% o. p+ p. _
  62. static volatile int irqraised2 = 0;
      y- e( K& U0 o4 f; N% y2 M* l$ j, }

  63. 8 H1 c7 U5 g3 X2 `- M( Z9 r' Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' U3 d& ]* H: `/ ?" v& U6 p8 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( \# T# j7 [" o" _; ]" c9 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 n  r& h6 g7 O8 y5 h: G
  67. " Z8 V! U; q/ a" U" P) A/ r
  68. dma_addr_t dmaphyssrc1 = 0;: l9 H6 B& E) w8 B! K
  69. dma_addr_t dmaphyssrc2 = 0;
    - n3 k8 D; \* F' d( o
  70. dma_addr_t dmaphysdest1 = 0;  j! n; l, p+ P
  71. dma_addr_t dmaphysdest2 = 0;; j  p, d" o+ h

  72. ! w: A7 P1 X- V: o
  73. char *dmabufsrc1 = NULL;
    " S2 B! U$ ^9 m& B
  74. char *dmabufsrc2 = NULL;
      w- f1 i% M; }2 k$ r' K
  75. char *dmabufdest1 = NULL;
    & R& n, H5 C1 T6 C
  76. char *dmabufdest2 = NULL;
    + N3 z8 E) Z6 }7 L5 K! r/ q) P8 ^2 ]
  77. 0 u7 s$ K+ G& J& l( ^$ y/ P
  78. static int acnt = 512;
    9 o$ G, |- b8 K* b% m$ l6 \
  79. static int bcnt = 8;
    + D$ p# T& L) z/ w
  80. static int ccnt = 8;
    9 }0 L. s8 J$ _9 d
  81. * D8 {. N& }* u! S. L$ T5 @2 M
  82. module_param(acnt, int, S_IRUGO);
    , E0 p' v+ u+ I, k! y8 w, g
  83. module_param(bcnt, int, S_IRUGO);
    ( H' Z& v- m* I; g% ~. z6 M3 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 V+ c: K7 q3 f  w% I

/ f4 q: o. Z- m! ]4 M+ n$ ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) \# q6 B& I+ T/ f0 ]0 b0 p6 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- @" z" ^: k6 w3 G8 l" i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, v  w) T8 }$ U( }! j& ~; B8 R- q
( y' a3 |* e; B: m$ r* ]- ~- u# v' U8 ]* X2 U4 X4 j) l0 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 17:17 , Processed in 0.039032 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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