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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : G) B9 Q1 v' ?% Q# L; I
  1. [code]EDMA sample test application
    & `& S% l; g% j2 C/ ?, n' M6 A$ k
  2. /*
    8 z( b+ V# S" u0 e4 a
  3. * edma_test.c) Y( I1 L9 M, M, H$ L* e; A0 K% t
  4. *
    4 R, F% x9 x7 X8 ]5 b7 Z3 V4 g$ H
  5. * brief  EDMA3 Test Application
    3 y0 d7 q8 A0 _' N& |/ }; u
  6. *
    & R7 Z' l' t( J1 k7 p% `
  7. *   This file contains EDMA3 Test code.& C% A) L$ ]& @7 I. j- D' R
  8. *
    9 l' ~5 h  D) I4 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , b. o' t3 C" i1 p1 e  r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ X7 R: t0 r; z% S" W
  11. *         TO CHANGE.$ ]" X+ z2 v0 h  |) c9 O6 d9 w
  12. *, }# J4 f' L' i& {. E6 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 h/ ]; q1 ^* ?, b4 k9 y2 l
  14. *2 t' z5 c" ^: g
  15. * This program is free software; you can redistribute it and/or# E. x& I( O$ T5 ^% C0 \
  16. * modify it under the terms of the GNU General Public License as  t8 c4 E; q- B( m. r. \5 E2 X3 K$ M
  17. * published by the Free Software Foundation version 2.
    , ~3 \; D" N& ^
  18. *
    . p) A$ \% o/ G3 O$ o; S2 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; b! t1 c# F- l2 e: ^
  20. * kind, whether express or implied; without even the implied warranty( \8 ^) l  t. @+ l. X9 \1 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - X/ ~8 E4 D; u* I* ]
  22. * GNU General Public License for more details." f' V, F1 B' S
  23. */
    ) c) T# L1 h! D4 m

  24. * v7 N8 @3 X. H4 w; @3 a
  25. #include <linux/module.h>9 @: U" Q8 Y  }/ Y
  26. #include <linux/init.h>
    $ p4 B0 P* s. n. _* j8 z+ _
  27. #include <linux/errno.h>! p, u+ e1 |5 J: i. k0 _
  28. #include <linux/types.h>5 M' u$ Z" A7 ?. k  p) {; z
  29. #include <linux/interrupt.h>  e- ?+ k, l( X( R* a- ~
  30. #include <asm/io.h>/ v; F. \3 |' }1 |, t( Z. D5 l
  31. #include <linux/moduleparam.h>
    . Y( l) [5 i3 K' s
  32. #include <linux/sysctl.h>
    8 s: L) S1 O. O
  33. #include <linux/mm.h>
    " |' x$ R" K+ T/ {4 ^, {# k8 d2 j' a+ Z6 Y
  34. #include <linux/dma-mapping.h>( L5 w* Y$ L4 \' d) a

  35.   ~( a# A; U8 t8 f% t- p
  36. #include <mach/memory.h>1 h& x7 {2 w6 N) P/ ]) {- U. b
  37. #include <mach/hardware.h>* G& l' m6 T- q, t1 K
  38. #include <mach/irqs.h>
    5 u& a) k. a  q+ g5 k, N- ^
  39. #include <asm/hardware/edma.h>
    8 d  c  ]1 G# D0 i8 b" {/ Z/ x3 U

  40. ' t/ F8 s2 Q5 ?* @3 p0 t
  41. #undef EDMA3_DEBUG9 U0 e/ j) y/ ~
  42. /*#define EDMA3_DEBUG*/$ @4 A* o* y3 h+ P) p( [; K. i7 }$ u

  43.   q+ O7 k( {& y4 e
  44. #ifdef EDMA3_DEBUG) J- O/ i- J' R! p2 y; ]# m1 P$ F* Z- s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- v' U$ |9 u3 s  ]- K; h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): A; d; p& r3 [. h- B+ D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 K0 a4 D$ ]# z  p
  48. #else
    0 l+ {5 e  \9 Y. p+ s$ D3 w$ K
  49. #define DMA_PRINTK( x... )7 R. }- B, H; J( R- [: i
  50. #define DMA_FN_IN6 R3 C: `; R" m# D) e9 h5 T4 _# C
  51. #define DMA_FN_OUT
    ( ^# s3 @. K/ L, t2 ]4 V9 X7 ~! t6 y# |) E
  52. #endif( E3 `3 y( R/ _
  53. / \& |. t, I$ w3 {  ~; W+ h1 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 F' i$ k# b4 _) P- R2 A
  55. #define STATIC_SHIFT                3
    * H% _( o+ \) w) I) h. O
  56. #define TCINTEN_SHIFT               20
    6 @' z) J" b: q; Z- k2 l. F
  57. #define ITCINTEN_SHIFT              21( H0 Z% o) Y$ W$ {! r+ y* X' }
  58. #define TCCHEN_SHIFT                22
    ; n: t. N1 D* {! A" r! w/ Q7 z
  59. #define ITCCHEN_SHIFT               23
    & D$ k$ y2 y0 d5 p: P
  60. $ Z6 O1 I  S( W; Y: ~' ?
  61. static volatile int irqraised1 = 0;( x7 b2 c# d9 K7 Y" ?$ Z. F3 `
  62. static volatile int irqraised2 = 0;
    * B! z1 k6 S5 r$ v5 K& f0 j8 q. o
  63. 6 g! ?3 c2 g! ~3 g2 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G. T  Z3 T  u2 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, K+ y/ K1 x* z: Y3 ]- }5 u- y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) m2 P. R9 |1 D1 a
  67. 5 _5 D. ~9 l  [% w4 r8 H$ d& C: ?
  68. dma_addr_t dmaphyssrc1 = 0;
    # M% e2 [4 z" c: @8 q  ]
  69. dma_addr_t dmaphyssrc2 = 0;% {* {6 x( D) o5 J( _( n
  70. dma_addr_t dmaphysdest1 = 0;1 u' U& q/ A6 w5 O
  71. dma_addr_t dmaphysdest2 = 0;- m7 V/ R$ V' a4 R
  72. " k9 {+ d$ E. f/ M
  73. char *dmabufsrc1 = NULL;
    8 i6 t0 m, G& C6 n& ~2 D5 U9 E
  74. char *dmabufsrc2 = NULL;
    # n/ \2 G1 Q  X  T
  75. char *dmabufdest1 = NULL;
    5 c2 i$ J" C' V
  76. char *dmabufdest2 = NULL;5 u7 _& L6 z/ [6 S) J
  77. 1 _$ B! m. O5 B6 |5 ]
  78. static int acnt = 512;
    5 G& t* V9 N" J0 A. F
  79. static int bcnt = 8;: y' h7 A$ W6 y
  80. static int ccnt = 8;
    6 b3 V! M9 Y6 S8 K: `

  81. 1 Q  m1 R( ?" H! ?9 |$ J
  82. module_param(acnt, int, S_IRUGO);6 P- o4 v& \4 h5 ~! P) M1 }  M
  83. module_param(bcnt, int, S_IRUGO);
    ' U8 v/ S4 T: l6 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; g6 A1 r2 o6 X$ J$ M8 y" r. U( T- N) h  a  j2 n3 B# M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 H# ]9 N, A: I6 p' M& M* L/ Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 w+ m% ~6 ~- D' a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; P; q1 n9 |# R
. ]6 g, C# W( R2 O9 s, V5 }
/ i3 q$ S; b. B/ f( I/ f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 15:07 , Processed in 0.038413 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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