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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. ~( m% g* J+ j- c7 J
  1. [code]EDMA sample test application
    - h8 o" x2 ^! }- J# i7 B/ ]
  2. /*# Q* @; ~5 G/ @. G* j. C
  3. * edma_test.c# O3 c+ h) u. I, ^& z5 i
  4. *
    0 \4 t5 k8 _5 W+ w
  5. * brief  EDMA3 Test Application: v. e+ V' V3 N7 q% @9 m" u! @5 E
  6. *0 w& b( \1 v2 r2 [, L, L
  7. *   This file contains EDMA3 Test code.1 j8 x# ]6 _  u4 c# D0 w& B7 C
  8. *+ I% n* g2 X" M4 s7 N. |: [- K: S% ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 p; E  P  g6 Q3 r6 M2 A& Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 d$ q4 }: U" h# \" X+ e
  11. *         TO CHANGE.
    ! k; u2 Z3 X. n) h
  12. *
    . N" D8 w% l& P2 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / l8 ~3 C7 q& I  r- m
  14. *6 t+ X' ~1 `% H/ L& g
  15. * This program is free software; you can redistribute it and/or
    ; O( `* A. I) |' }* {
  16. * modify it under the terms of the GNU General Public License as; b& v3 I5 J; R! h! D& O' C7 W. k( s! W9 V
  17. * published by the Free Software Foundation version 2./ [3 M8 h9 i( A2 |9 }& H  l- k" V
  18. *
    ; c( ]. V) u& R" ]/ M* i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) n6 N' I2 `+ j
  20. * kind, whether express or implied; without even the implied warranty2 x  \! d1 w& B8 j- u' J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) h! Z- b. q. y2 W' S; c
  22. * GNU General Public License for more details.
    , s  P* Z: D2 i6 Z; h- @; T& K
  23. */
    # e9 R4 d: X3 K( G9 U0 A

  24. / B) i( B# K9 l$ L
  25. #include <linux/module.h>
    & F! R' S" X2 w
  26. #include <linux/init.h>0 b: p. _! R. W. q1 y' ^8 P) v
  27. #include <linux/errno.h>  ?0 ^% P. ~  L' J0 F* ?- G
  28. #include <linux/types.h>
    ) I+ q# ?  T: F( @8 U
  29. #include <linux/interrupt.h>
    ; }2 x, F, ?- T8 |' _
  30. #include <asm/io.h>
    : y( `- @* g9 \% K. ~! D
  31. #include <linux/moduleparam.h>
    6 ^2 E3 ~6 Z% U% X4 G7 t
  32. #include <linux/sysctl.h>
    / v* Q+ P( l2 o% n8 T
  33. #include <linux/mm.h>( A( w, O6 U: F; n( s% }( N
  34. #include <linux/dma-mapping.h>/ K, I- k, Z6 I, A

  35. 7 g& Q( A* z* t: m
  36. #include <mach/memory.h>
    : p; ^$ h3 k1 H. F( W! P
  37. #include <mach/hardware.h>
    " L* Z* K5 i( ?% c  O
  38. #include <mach/irqs.h>! q1 Z2 r$ p5 q/ Q+ k
  39. #include <asm/hardware/edma.h>+ Y' U' J, ~, a1 S, o) ^# D
  40. . l( r; e; S/ E: y
  41. #undef EDMA3_DEBUG: {, j  w; `: {& l0 W% g$ F% n
  42. /*#define EDMA3_DEBUG*/9 ], b& G, W. T1 K& b
  43. 4 l/ l, f( e  ~/ B- a( J) |# @5 T
  44. #ifdef EDMA3_DEBUG+ L* Y* Z" W# \% H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ @  M& k* |& x/ F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ x3 C: t5 R3 O3 X# X! ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 B. s7 O  ^& y& u" N
  48. #else" F6 f( o" ?2 d
  49. #define DMA_PRINTK( x... ); |- g: G4 ~! r2 r
  50. #define DMA_FN_IN
    * ~1 t6 p  w  ?8 `& R
  51. #define DMA_FN_OUT
    - _- m* m# H" C: q! c+ c4 w
  52. #endif
      Y: ~7 k( W& b! Q' b( W# p  X, ]1 w
  53. ) m! i9 m' i1 s1 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), e+ Z: P6 T. f1 a  y. M5 Z. `
  55. #define STATIC_SHIFT                3/ q$ b) N8 s9 s! n/ F
  56. #define TCINTEN_SHIFT               203 I4 \5 o7 P* m  i+ a5 i0 ]
  57. #define ITCINTEN_SHIFT              21
    & X/ j4 s- U, u8 g
  58. #define TCCHEN_SHIFT                22. K8 C( G5 J! z' K3 v
  59. #define ITCCHEN_SHIFT               23* J4 x3 i+ J/ z9 M! K$ W6 y( d

  60. $ g8 x( M5 E  Z2 \- T3 [
  61. static volatile int irqraised1 = 0;5 k3 Q5 P0 Q# \5 u
  62. static volatile int irqraised2 = 0;
    ! l, @$ k( ~0 v* U

  63. ( }4 w. Y9 g: i4 R: E$ ^5 D" y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( E8 E3 m0 h6 N2 H- ?' @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Q) l  n& Q5 _! U" l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 i& O0 @8 Z' l, ]1 ~; n3 F

  67. ) |0 M* G2 F. N5 q
  68. dma_addr_t dmaphyssrc1 = 0;
    " v- c: H) U) u5 x  b' j
  69. dma_addr_t dmaphyssrc2 = 0;
    + G: E. j4 g& P; j
  70. dma_addr_t dmaphysdest1 = 0;
    # D" h0 j% D5 f8 Q2 C+ N
  71. dma_addr_t dmaphysdest2 = 0;
    $ B' }  w+ w/ f# t, q

  72. , A$ x. t/ e' {' e7 `
  73. char *dmabufsrc1 = NULL;
    / o# x9 h! c* o* O: _7 k1 A; h
  74. char *dmabufsrc2 = NULL;, K  Z) v, w& e9 F$ v6 H
  75. char *dmabufdest1 = NULL;: I* D0 J( u! H
  76. char *dmabufdest2 = NULL;
    5 y/ D  b, K5 n! j. f: T

  77. * T# N; h' b9 d9 R$ E; V3 Z
  78. static int acnt = 512;
    " i/ e1 }2 z) N$ g0 i
  79. static int bcnt = 8;* J( j6 C) l. A9 q( E
  80. static int ccnt = 8;+ f. {  h" x9 d3 N+ l
  81. , ^3 @8 [" D9 P8 h- k- I
  82. module_param(acnt, int, S_IRUGO);
    ' X+ t; x5 N; Y+ P' n
  83. module_param(bcnt, int, S_IRUGO);. v1 `7 }# x7 z' k& m( M+ W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ q$ V: n+ W$ e9 [5 }5 d% k8 a7 t& [
/ F- a4 S$ t+ b. ^  w- h. P: p9 Z$ G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ @; P3 \# t- P" p0 R. Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! G5 M$ ~) `9 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, h7 t: ^5 Z0 K) J
" {0 e  D$ p* h, ~# m7 J; H1 W$ j6 f9 i1 @4 F5 d- f2 a2 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 17:19 , Processed in 0.042917 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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