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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 K8 b6 @( o4 T- e' ~3 I
  1. [code]EDMA sample test application' e( g6 H, {- [
  2. /*
    7 t- R: w6 P& Q( L) `& h. ]# a
  3. * edma_test.c
    0 {3 C. _* d& C% N+ O1 E' D
  4. *
    1 B6 W# I4 y; u: G) c( ^1 e' q1 S
  5. * brief  EDMA3 Test Application+ V; I! d0 p( k9 J9 G4 J3 \
  6. *
    8 r( u1 d& B( I) ^
  7. *   This file contains EDMA3 Test code.
      L- o% u% M  J- i5 |% @
  8. *
    ; n4 s2 p2 H0 n* [+ _9 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; m' Y. L1 Z: x0 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / Z" i7 V. N  N. c2 m1 i/ b
  11. *         TO CHANGE.( h3 ^. M6 D8 ]6 b- P7 G% w& Q
  12. *
    - D) r8 M4 _. n6 {" {& }6 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* t) m7 u/ }- r: y0 {6 z2 I
  14. *
    + h" j' r. H6 s0 m8 s
  15. * This program is free software; you can redistribute it and/or, ^) v) q+ h3 `' o! k$ A' N) g  y
  16. * modify it under the terms of the GNU General Public License as& S5 r- [4 L; ?' w9 Y5 }( u
  17. * published by the Free Software Foundation version 2.$ v& v' z2 F" x" P7 e" l
  18. *+ J, T% S# i- B* [' t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 |: J3 p& |; V4 e& A6 H1 G
  20. * kind, whether express or implied; without even the implied warranty
    + c+ |& U# b0 R' @7 i- D9 @0 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ {/ \9 W/ r% _. Z
  22. * GNU General Public License for more details.) m2 j7 W* O6 T8 b6 V# D) C
  23. */
    2 W0 R1 g6 [- _9 P

  24. : o9 w* b( q2 d
  25. #include <linux/module.h>/ m% x7 h: o# L4 N) Y; y6 _
  26. #include <linux/init.h>
    6 O/ v' b5 K  y* S
  27. #include <linux/errno.h>
    2 d9 M& \& e/ C, J
  28. #include <linux/types.h>3 }' I# _: {3 n/ q* t% H0 r
  29. #include <linux/interrupt.h>
    ; r  ?. \8 O9 M; E" o
  30. #include <asm/io.h>
    . ~9 G  N' Z) n+ _& ?1 V
  31. #include <linux/moduleparam.h>
    : V* e3 b2 P  `
  32. #include <linux/sysctl.h>" L6 I& a5 m( ?( j
  33. #include <linux/mm.h>
    . I- F0 _, @+ u/ _  Y9 q3 g9 [$ n
  34. #include <linux/dma-mapping.h>
    , Z7 z. O3 w& Q8 ], K% x

  35. & h/ B  a! V' C* D. c
  36. #include <mach/memory.h>/ o6 L4 F, P; Y8 }* d. J5 F+ p
  37. #include <mach/hardware.h>
    / N7 D1 N# m) Q% ?
  38. #include <mach/irqs.h>
    1 x. U0 b; l+ Z; s& v. Q
  39. #include <asm/hardware/edma.h>
    5 ?* v1 P4 W1 Z; R# J9 [5 b

  40. + a0 y3 O6 m! T* y# h9 d( u* @
  41. #undef EDMA3_DEBUG
    / ~2 |9 S5 q5 e3 G3 J- {
  42. /*#define EDMA3_DEBUG*/
    : ^& |4 j" z! ]  z1 C$ P% n# C! \

  43. 1 z. M5 V- @+ v3 J. Y
  44. #ifdef EDMA3_DEBUG( Z) S/ Q4 r; n+ X. W( i3 L9 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 A! Q& N* E/ S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 c  `" w; X1 s% t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 a8 i# w5 }5 L+ g9 s" X  z! J
  48. #else$ ~) L. j9 A! S/ E
  49. #define DMA_PRINTK( x... )  ^6 d, U# x. I
  50. #define DMA_FN_IN5 s% `7 A2 }! a. X9 a
  51. #define DMA_FN_OUT
    ) c0 I8 d! B* ]1 W; U8 w
  52. #endif- e5 R1 ]& G  t; {7 c

  53. : S; I6 `' S) O& q$ r' c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : V9 o9 ]. b4 }% G  y
  55. #define STATIC_SHIFT                3$ w3 S9 q# K- U. N. w" _5 R, I
  56. #define TCINTEN_SHIFT               208 X: n) \' e, j; q) x/ V! W1 o/ r$ H
  57. #define ITCINTEN_SHIFT              21
    3 I9 q. ^: e5 f5 F2 F) w
  58. #define TCCHEN_SHIFT                22) y5 i" _  {0 s9 Q& j/ T
  59. #define ITCCHEN_SHIFT               237 n- G& H+ g( F. j& d: |- v
  60. " w  r* ~4 N6 b" [8 ^$ e5 u
  61. static volatile int irqraised1 = 0;
    3 V3 e- Z8 h' v8 b
  62. static volatile int irqraised2 = 0;
    : k* o7 q% [3 B

  63. / |: E% c7 v- u  t3 X% [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , G0 K; s3 R  o. J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 U  w5 Y0 T# o8 V4 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( D9 i; m8 ~5 o1 V
  67. " m/ O( U9 k" S5 y$ N
  68. dma_addr_t dmaphyssrc1 = 0;
    8 ?, Y5 y5 B2 R3 _% Q/ \6 J
  69. dma_addr_t dmaphyssrc2 = 0;) Z& C6 z7 [& }: @6 X# w/ `" A
  70. dma_addr_t dmaphysdest1 = 0;% X% L2 ^. e, g% n! {: J
  71. dma_addr_t dmaphysdest2 = 0;
    1 a! w  @; n2 p5 z  X4 x# t- _& ~

  72. $ C7 s$ }- p! q( j
  73. char *dmabufsrc1 = NULL;
    % I! V5 g) I& h
  74. char *dmabufsrc2 = NULL;
    , W$ b% [' [: }( `  [. n) s, C
  75. char *dmabufdest1 = NULL;
    . [4 m0 Y, L! _5 o! b# ?
  76. char *dmabufdest2 = NULL;
    / ~1 _9 A6 O8 v  {0 P- m

  77. 0 g% W3 n3 ~4 k, r3 h
  78. static int acnt = 512;
      K3 j! Z8 U, \
  79. static int bcnt = 8;
    6 ~5 X: `8 N/ {8 z. B% i- S2 U- {" D
  80. static int ccnt = 8;3 l3 D' g, P( _2 E! W1 s) f5 g3 S3 s8 q

  81. 6 ~) Z1 f1 w# O" T! R0 P( x4 j9 I8 F
  82. module_param(acnt, int, S_IRUGO);( o! e* [* f7 k. F; M# W
  83. module_param(bcnt, int, S_IRUGO);1 N$ }; {, p+ y* L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 o7 {6 |2 a, F$ \

/ k- g! z3 o- V" }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 U0 {# x5 H1 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! `9 [' R4 E  J# }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, _- F) N0 y4 ?* ~* W
% J0 j: _- P9 W

7 u0 h4 h! |! B) r' ^8 {* y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 15:40 , Processed in 0.041575 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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