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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! n2 w" d/ T: i$ d+ l
  1. [code]EDMA sample test application
    9 K1 [) H( k: u8 G) v
  2. /*4 R4 y" S3 F8 E. R" p
  3. * edma_test.c" E  X: ]2 M7 H  S
  4. *
    ; P$ S3 E/ a8 L% E3 l4 I/ Z
  5. * brief  EDMA3 Test Application
    1 |* i9 H8 ]2 `) N- o" U' p
  6. *
    5 x+ i+ @/ O& v$ n! m
  7. *   This file contains EDMA3 Test code.
    $ B8 W/ _4 K* j7 T
  8. *
    ) Y; `% p- t3 t  s* d+ I4 d7 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, g( B" C; w- S2 Z0 F/ e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( k) d: T- G; X  [
  11. *         TO CHANGE.  T3 @9 x% }; ~; m6 D* D
  12. *
    $ K& K, D! ^8 N! ~$ ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( |4 G& @: h6 |0 a7 [
  14. *
    - T* ]5 K0 w6 F2 }8 v# I' q& W* f
  15. * This program is free software; you can redistribute it and/or
    5 A; ]' o; H; |$ S
  16. * modify it under the terms of the GNU General Public License as
    5 x* J7 e" m2 i! V
  17. * published by the Free Software Foundation version 2.$ A8 G  ~0 o8 e& |2 g
  18. *
    & Z8 ]8 a4 F* m3 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 Q" O+ Z  n: u! Y' _; S/ n
  20. * kind, whether express or implied; without even the implied warranty
    % s8 p* `9 d+ M: @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 {4 r* X1 m! V
  22. * GNU General Public License for more details.: x1 ]9 G2 o/ O! N
  23. */
    1 |3 q* q/ I2 U5 e; M
  24. 4 i- n8 E' t1 q6 r+ ^# o
  25. #include <linux/module.h># \$ w  A; v  V" t4 z% e4 i
  26. #include <linux/init.h>+ D% Z1 X' F" i1 H/ U
  27. #include <linux/errno.h>
    1 B2 g5 l1 J& v$ U
  28. #include <linux/types.h>
    ) D/ n9 n3 O) @% s2 O" O" ^
  29. #include <linux/interrupt.h>
    $ Y) G* Y4 d5 x1 e9 b
  30. #include <asm/io.h>
    8 m5 T/ R: n% m6 p& v4 }
  31. #include <linux/moduleparam.h>8 ], A; c) i3 n2 Y4 v/ p7 x1 b" F$ @
  32. #include <linux/sysctl.h>
    + q' g: U: \: l5 d
  33. #include <linux/mm.h>
    9 Q6 m% D# i* G, G% |
  34. #include <linux/dma-mapping.h>
    ' i. _6 W) D0 ?- G
  35. 5 F/ O6 t8 }$ b  Y, {$ @9 v8 t( K
  36. #include <mach/memory.h>3 T5 K) s1 I: I: R
  37. #include <mach/hardware.h>+ \& ]( d+ A% E1 q! [
  38. #include <mach/irqs.h>, v2 ~6 y5 {9 c& ^
  39. #include <asm/hardware/edma.h>
    / a; _' n" I3 ]5 A  b
  40. + }$ g" x+ V+ J! I! a5 _
  41. #undef EDMA3_DEBUG
    ! ]5 u; s( S% |, Q0 S
  42. /*#define EDMA3_DEBUG*/  U- H  D% @+ g- r6 L

  43. : }7 Q" [9 W, T% [3 M1 }
  44. #ifdef EDMA3_DEBUG
    ( p5 a" {0 G; p# U7 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 l) m6 g, V8 ^3 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  [/ a) ~6 T+ U& p% r8 X' @& u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  {; m% j) @: g; s4 j
  48. #else
    " o6 T" [% D+ X  P( E
  49. #define DMA_PRINTK( x... )
    1 m! t3 E! D5 c# |/ \# |, b
  50. #define DMA_FN_IN) P7 o& H) ?3 a. C7 n/ O
  51. #define DMA_FN_OUT
    ) p- v" t* q& |/ U
  52. #endif
    % y: @5 H! U' O, R2 d# M

  53. * p# G- W4 U! R1 J* y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ P) z! a. Z2 d0 b& E8 h9 t: K/ D0 k
  55. #define STATIC_SHIFT                38 t! c) B- u' X
  56. #define TCINTEN_SHIFT               20
    $ @: X& `# o' U/ f3 f( W
  57. #define ITCINTEN_SHIFT              218 j3 ~+ u0 f: z1 U& j- g: {) {
  58. #define TCCHEN_SHIFT                228 |8 e" `7 J0 M1 p) o& u: Q7 B
  59. #define ITCCHEN_SHIFT               23
    8 O& S) a. t& Q$ z

  60. & [7 A& L; q/ e7 o+ Z( ]4 V! u
  61. static volatile int irqraised1 = 0;
    : o- U4 k( c; y( m6 G8 T8 y
  62. static volatile int irqraised2 = 0;
    " `/ ]9 d, @  f) m) ?

  63. : Z6 Q5 ?$ w8 d% b* q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 p* M# `- f8 @& A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ _: ~2 ^# d9 ?9 p8 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : I" Q, I6 J* m5 r! k- Y
  67. , g  c+ ?' e7 e8 b8 v1 j
  68. dma_addr_t dmaphyssrc1 = 0;
    : S( n) C4 R! [3 K
  69. dma_addr_t dmaphyssrc2 = 0;
    - V. n2 I0 t1 S& T
  70. dma_addr_t dmaphysdest1 = 0;
    * `8 Y" r4 M& F$ z
  71. dma_addr_t dmaphysdest2 = 0;
    ( n, H3 R, F) K/ j, O) h' G

  72. , I, R% M. C. {2 V% m) e
  73. char *dmabufsrc1 = NULL;6 P6 @4 ?! c6 h; b1 o9 G
  74. char *dmabufsrc2 = NULL;, W  C0 q1 R3 Y$ C0 q
  75. char *dmabufdest1 = NULL;
    , B7 \' t' O) M" i  P; I% \9 b2 p
  76. char *dmabufdest2 = NULL;
    0 E" Y7 K/ k* j, a( |( p& v
  77. ' p/ h8 Y" H% c/ x4 J" C: l
  78. static int acnt = 512;
    9 _, K* c6 A8 U& L8 ~( u
  79. static int bcnt = 8;; \7 S* q2 g/ g8 z! b) j$ l
  80. static int ccnt = 8;
    4 _6 S+ c* [  Y7 I9 m3 L

  81. * `6 j4 ]6 T, \; M* y
  82. module_param(acnt, int, S_IRUGO);
    7 _+ o5 W' l% P5 o3 Z4 D1 @
  83. module_param(bcnt, int, S_IRUGO);
    ' c7 v" Z  i3 d  b- m6 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. {/ {9 p$ C$ x$ f9 V5 K2 B" e* ^4 a% `4 ^6 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- p% P9 f9 Z/ @! [8 f- C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. r% _" z. b1 Z+ r& M- i' a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& J2 m3 @+ K* C  j# A" F' M) u: g# Q+ Z4 i; w) W- X4 K4 }0 i
& X/ Q% x  S) R( W9 `5 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 01:21 , Processed in 0.039706 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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