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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' j" b" N2 ]; E1 a+ R
  1. [code]EDMA sample test application. G" u9 d" [4 q
  2. /*
    & ]# E' P; f7 I' D  M3 M
  3. * edma_test.c& E0 S6 s# s( B9 m1 X
  4. *
    . R$ b; _" X. H# ~7 C$ l) K3 {) e' T
  5. * brief  EDMA3 Test Application" ]1 E) I7 b9 c- Q- \
  6. *
    + Z6 Y4 D5 E8 S) @- B5 {# p5 h
  7. *   This file contains EDMA3 Test code.
    6 l# X3 r1 a- F, ]. }
  8. */ W& ^. d+ X1 K+ S1 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * `  j& @, c2 ]3 y& `9 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 B2 n( J- s2 ]: E  y
  11. *         TO CHANGE.
    ; g1 J4 ]( F2 t
  12. *$ N  I6 k8 T- L/ M/ T, i- \9 X% ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : S# z8 x6 u" G% V
  14. *! A! \) k& K& h* j1 }
  15. * This program is free software; you can redistribute it and/or' g: p( P$ V: x) k: C; O) `
  16. * modify it under the terms of the GNU General Public License as
    / S! w# |* m/ X$ T+ C* Q
  17. * published by the Free Software Foundation version 2.
    % |! q. W: v7 @& `* B1 {$ _
  18. *
    / i- J5 I/ E1 N! o9 ~% j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& R) S8 ~3 X, O2 M% v
  20. * kind, whether express or implied; without even the implied warranty5 C, t1 R6 g  D' U: y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% _/ C+ G4 c% z4 \* S
  22. * GNU General Public License for more details.
    / y% ^2 |% L& ]$ W7 t
  23. */( V  ?5 l( t! y" H- [
  24. " ]) I5 y6 ~+ c( O3 @6 p0 l; x" c
  25. #include <linux/module.h>. b5 V6 w* a; n- ]8 O
  26. #include <linux/init.h>3 X$ m, w! X* C$ w" B' R
  27. #include <linux/errno.h>
    7 t) T9 y3 T( Y
  28. #include <linux/types.h>
    : h8 r; p! m4 K; L
  29. #include <linux/interrupt.h>* ?. ^& u+ p  g% i9 Q; R
  30. #include <asm/io.h>
    8 b0 s8 z0 M3 m& I( q! m+ s
  31. #include <linux/moduleparam.h>1 x& I( B+ ?# p! f# `. B
  32. #include <linux/sysctl.h># V( f+ Q) V% T2 ]3 s
  33. #include <linux/mm.h>
    6 s. t9 j# ^% `
  34. #include <linux/dma-mapping.h>. Q4 z  h7 t) I" L; E$ o) L
  35. 5 _4 r/ W. |  D$ l  \+ A
  36. #include <mach/memory.h>( q) b# f0 J0 i% C# g
  37. #include <mach/hardware.h>7 Z$ _' Z; D1 I$ i  v' R0 f/ k
  38. #include <mach/irqs.h>) C  a  I/ W7 \8 f# }. Y; H
  39. #include <asm/hardware/edma.h>
    $ B0 ~$ S* z9 z6 x
  40. 6 c. ?* o2 o$ V& m+ ^
  41. #undef EDMA3_DEBUG; l  i5 w' T1 S8 |4 r7 `$ [2 k
  42. /*#define EDMA3_DEBUG*/
    % X0 |/ f8 z9 O! S* f& @
  43. ( ?5 s& E/ r$ s% d$ {
  44. #ifdef EDMA3_DEBUG
    * |' e( W1 G4 E7 Y0 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( z; B1 A0 w5 d* r& h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % m3 _/ L( a! g) e, K+ V& r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" A7 Y6 X! W% C& ^
  48. #else. j. |  e2 y: E* g" \
  49. #define DMA_PRINTK( x... )
      H7 Q! q* e6 I4 R* U
  50. #define DMA_FN_IN$ E- E* P0 A$ ?, M  F# Q5 U9 H
  51. #define DMA_FN_OUT
    + b* J  f5 |. K& T; O% N
  52. #endif
    % m' Q: G5 f7 @+ K( }4 `

  53. 6 A4 \2 q  D5 F" p+ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' H  G0 Z" ^! M" l+ I
  55. #define STATIC_SHIFT                31 b5 ?; u6 k8 ]1 a) N8 _) c" i5 H
  56. #define TCINTEN_SHIFT               20
      q+ M& h! l  P" k2 |
  57. #define ITCINTEN_SHIFT              21" q  G* [2 O2 I) E; k1 `, ?
  58. #define TCCHEN_SHIFT                22
    0 S  A$ ^0 g1 ^; m4 V
  59. #define ITCCHEN_SHIFT               23
    ( ?+ c! \8 U  [% H$ x  J% R
  60.   t7 K  |6 S& d% [. ]7 |" i, u
  61. static volatile int irqraised1 = 0;
    % e6 }6 E& r9 A& h
  62. static volatile int irqraised2 = 0;
    6 I* R& m$ f; W: W: p
  63. % Z2 b( q; t) L+ m/ {6 ?( {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 W( T. u6 U% r( _# v2 F/ K2 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 I- q& W+ P" D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" g* K, X6 e( i1 G
  67. 2 u# a  Y# b/ X
  68. dma_addr_t dmaphyssrc1 = 0;
    ( I9 o+ Z" q5 L
  69. dma_addr_t dmaphyssrc2 = 0;% @2 J; k" ?" |8 f, b, k
  70. dma_addr_t dmaphysdest1 = 0;$ r$ a* P8 u# n3 J9 Z/ G
  71. dma_addr_t dmaphysdest2 = 0;, v2 w! `6 ?4 H8 G' Z( b
  72. / [1 Q* b5 u5 |  G% e6 I* _
  73. char *dmabufsrc1 = NULL;% ?9 [/ Q% e$ i! j) v8 |3 H0 ?
  74. char *dmabufsrc2 = NULL;. @; n4 p- G$ P' C
  75. char *dmabufdest1 = NULL;
    7 F7 D. a( m1 K6 j7 w$ K
  76. char *dmabufdest2 = NULL;
    ( e/ p( O5 Z3 d. \; v# X5 E3 c# M
  77. 1 M. w+ N" B: C; H8 |
  78. static int acnt = 512;/ R, b" {' V/ T* i
  79. static int bcnt = 8;$ f% r) {+ i5 S1 d1 f; y
  80. static int ccnt = 8;
    ; s- B; E/ d# P# X
  81. - w* _1 c; `2 ^
  82. module_param(acnt, int, S_IRUGO);; ^8 a" M+ I: ^; i4 p7 X7 o8 @! e: t) b
  83. module_param(bcnt, int, S_IRUGO);4 s" U% J" R: g' J; C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ }& k- J0 H# ?; s9 Q5 |

4 L8 s/ O' `. K+ d% E! R1 x+ Y, s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; p: w$ Q3 k! D0 E6 r% \3 o2 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ M# V6 d% `4 g) [3 S' V) G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" T5 f0 Z, \. r- Y5 D

) M2 J/ d/ W  U; }, Z# B! x6 t: A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 21:40 , Processed in 0.040555 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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