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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% t2 }3 U, M1 s) b% q& q
  1. [code]EDMA sample test application, k  K+ h% o9 q+ ^! ]& D% v
  2. /*
    7 ]8 y: r/ _. h+ l3 U; Y2 Z
  3. * edma_test.c& J% y7 r# o! A
  4. *
    9 X' C' X3 O1 @
  5. * brief  EDMA3 Test Application0 d" {0 b& \/ [% P. e  ?0 @
  6. *+ Z8 L5 k2 Q2 M
  7. *   This file contains EDMA3 Test code.
    ! [3 `6 P5 R3 V' d1 h4 r
  8. *
    ! ~: e  |( @( w5 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ i- W5 m! x# L: [$ M9 o8 n, l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( Z8 p  g5 H' f1 t
  11. *         TO CHANGE.
      j0 S7 n3 Q/ q. a* R& C' c
  12. *
    * V, U% ?" l0 z4 B2 e9 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; R, F2 H# l- k" H& Y, T  [1 [
  14. *  R6 b  I: D: j4 c
  15. * This program is free software; you can redistribute it and/or9 P4 ?8 Z/ a7 _( i  ^2 U8 y8 Y
  16. * modify it under the terms of the GNU General Public License as
    / e  {) k) |9 o6 m0 n, g; Q3 `
  17. * published by the Free Software Foundation version 2.
    " W; o+ e( ^* S* ?
  18. *
    ; b; J0 h+ X9 r" H5 V4 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 k/ ?6 w3 _3 k7 j
  20. * kind, whether express or implied; without even the implied warranty& b. L5 A- ?2 @" n2 k$ ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 o/ f3 s. t4 i2 D. y, n  `
  22. * GNU General Public License for more details.
    - T6 I" v& \( y( a" e- E
  23. */
    $ c9 J' X; H' {: \) v% E0 p

  24. ' G8 J0 u/ Q( q9 e
  25. #include <linux/module.h>/ R2 T/ J! u1 h7 R/ ]
  26. #include <linux/init.h>
    7 Y5 v3 a, V) s, M* ~
  27. #include <linux/errno.h>  Y7 p8 ~5 G  J- G
  28. #include <linux/types.h>
    7 O5 ~/ j, w6 {! A5 r' l& m/ u
  29. #include <linux/interrupt.h>
    # E" c# k3 f) V/ `
  30. #include <asm/io.h>
    ) n3 r  }7 D$ m# L5 ]# l. H
  31. #include <linux/moduleparam.h>8 a6 W/ T4 V  f! `- a
  32. #include <linux/sysctl.h>
    ; q: Y6 X0 j, D' T& E& @
  33. #include <linux/mm.h>) e# v) z4 A, b0 r+ ~' ?) b+ Q
  34. #include <linux/dma-mapping.h>7 _* C. z+ q& @6 ?

  35. * e5 |; [5 R3 z* a! o6 m
  36. #include <mach/memory.h>
    ) ~; x$ Y! a. s
  37. #include <mach/hardware.h>
    . _; R5 ~. }6 c/ ^
  38. #include <mach/irqs.h>) ]1 B; ]3 u$ H6 `0 j
  39. #include <asm/hardware/edma.h>! p: L, u! {( _+ [; @& P0 c1 _
  40. " _: c* j$ F; X: @% I" y
  41. #undef EDMA3_DEBUG9 ]4 W3 A3 s$ M( o* c
  42. /*#define EDMA3_DEBUG*/
    - Q$ E6 k. t  j0 {; }
  43. 2 j8 p7 b0 a2 p4 y) k0 w- `& F% G) X
  44. #ifdef EDMA3_DEBUG
    * F8 j9 F. d; a# s4 K. U; S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 t: V5 b1 ]% t& e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ W! m* E6 j7 A$ Z" b4 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 E2 h2 N: i' N5 B% [2 `  {" s
  48. #else/ E- q# w) ^6 |# F2 m5 W
  49. #define DMA_PRINTK( x... )6 Y, Z" Y( y$ O- C! e. k+ i
  50. #define DMA_FN_IN
    1 s- i8 g/ ~& e7 c! f
  51. #define DMA_FN_OUT
    + `3 f+ |  m  V5 l" K' O
  52. #endif
      C2 D) v. k7 v" n5 O0 C
  53. / e$ W3 E0 x2 j" d& T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); M5 L& C) t' h! j5 F4 c
  55. #define STATIC_SHIFT                3; a7 d" O; A# p5 V, }- C! j
  56. #define TCINTEN_SHIFT               20: L. J8 Q5 p2 e- k, c% T
  57. #define ITCINTEN_SHIFT              21
    $ h  I! y' Z6 b
  58. #define TCCHEN_SHIFT                22$ ~3 D6 M0 k7 @, V+ {" b
  59. #define ITCCHEN_SHIFT               230 N7 W2 g. j/ |: q3 T# e  L

  60. : v2 `$ y4 m+ I' k# O& K
  61. static volatile int irqraised1 = 0;  R6 U6 R" M! s6 T" w- f% V# @
  62. static volatile int irqraised2 = 0;
    * b7 t: P2 O+ c9 h

  63. 1 ?0 C  M5 F$ q# O5 P- @$ j4 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ]( E% [- V" J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' g! b+ }/ p% H$ F1 h" s* t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 U5 i. Y- P9 L# H( q1 a/ E

  67. 3 Y" T2 L  o8 {8 D# O
  68. dma_addr_t dmaphyssrc1 = 0;* \! y& G; B* \) ~
  69. dma_addr_t dmaphyssrc2 = 0;
    5 B' Q- k9 D; ]; p. o8 {3 W6 H+ v) v
  70. dma_addr_t dmaphysdest1 = 0;
    . R/ O' c* r: U& ~% ~8 b
  71. dma_addr_t dmaphysdest2 = 0;
    2 M; w. E7 l3 n' C7 |$ z

  72. : I2 \3 n) i% T# b: A/ M1 ~# ~
  73. char *dmabufsrc1 = NULL;$ `& L! N: x" V! J" [
  74. char *dmabufsrc2 = NULL;
      r0 ?: e$ ~# t# t% @! x2 k
  75. char *dmabufdest1 = NULL;
    7 {$ y' E- o7 Q( L! l% a
  76. char *dmabufdest2 = NULL;
    5 ^6 U) K, l6 L* m1 V" d* A6 V
  77. # K* U5 [5 j$ c$ b- [  R
  78. static int acnt = 512;
    6 }; P' m1 X0 h
  79. static int bcnt = 8;9 N" d# X/ n' Z  X0 o7 E+ F
  80. static int ccnt = 8;
    ( n. c' a8 r8 N1 R
  81. : a: @- g% o* G* @7 F
  82. module_param(acnt, int, S_IRUGO);9 k, P0 b& ]) V3 Q) E& r
  83. module_param(bcnt, int, S_IRUGO);7 `8 |/ ^  S% t6 V+ y4 g; x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& c/ F9 ]' G) b$ o: i4 d! T

) ^4 s1 }) `0 N! Q8 x$ P9 y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ x% q- n5 f1 I% L" C) x& O: larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: X# B) f6 }, L- M3 j" U8 C) B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: c* X/ k( T" m+ x; U6 J
7 ~9 g" H- S( O6 w1 x
% [  `% B" {6 p& Y8 Z/ U! S$ `! j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 06:03 , Processed in 0.039639 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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