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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % v2 V' v# B8 n: |3 o6 ?' W
  1. [code]EDMA sample test application* [, T5 Z: l% X. j: M! J
  2. /*
    % u' L5 h- W4 c, C% I# X% Y; b, K
  3. * edma_test.c
    3 U5 y; L3 J# Q7 n
  4. *
    : J- A) ]7 t4 L2 E8 H
  5. * brief  EDMA3 Test Application
    5 E) I* d  D$ J+ ?& O
  6. *) \' }, j, v8 T7 j
  7. *   This file contains EDMA3 Test code.
    4 I: z( s; F0 u2 x* m7 M
  8. *
    ) j1 W: w. A. ]9 x3 I6 K* u1 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 z3 ]7 p1 Q( R9 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 N$ y1 I, x' j
  11. *         TO CHANGE.
    ' _9 O0 v6 V  j/ f
  12. *7 J$ ^1 O; H! l% o) L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! N* E/ ^) T: u. \' a- u9 a
  14. *% V9 A+ z* @! w
  15. * This program is free software; you can redistribute it and/or
    & z2 W9 H0 W6 j& k0 H$ M
  16. * modify it under the terms of the GNU General Public License as
    ! E3 B5 }% K! u* T! ?% [
  17. * published by the Free Software Foundation version 2.
    , N; b) }) @- b- h, B! j# N
  18. *% o* N- x8 }+ _4 z' k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. h2 k$ Y% q5 `# i
  20. * kind, whether express or implied; without even the implied warranty
    9 M& q  a- X$ e0 H+ r9 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / l* i3 o6 B6 m4 G, [( `
  22. * GNU General Public License for more details.% i- L8 S4 o+ b& b9 J0 w2 r
  23. */
    1 n5 Q3 J1 f3 F* e

  24. " S2 O7 |5 m9 @. `& D) H
  25. #include <linux/module.h>! O3 l' d- e3 }6 V
  26. #include <linux/init.h>5 E' ?- m3 k$ n6 u
  27. #include <linux/errno.h>
      C1 q( T( X: j+ I3 t
  28. #include <linux/types.h>
    + V0 @! z9 }+ S
  29. #include <linux/interrupt.h>
    , s8 L1 z" L0 A8 @- j) `
  30. #include <asm/io.h>* o4 y8 m; Y+ v
  31. #include <linux/moduleparam.h>- X5 ^0 ^( F( r
  32. #include <linux/sysctl.h>9 r- y5 {! ^3 N
  33. #include <linux/mm.h>) Z1 c" E1 e$ l, Y' z0 j: ^6 S3 g
  34. #include <linux/dma-mapping.h>% o" ~& m/ H( x
  35. ! u. y2 N/ d4 G$ q1 M6 b4 i% m) u
  36. #include <mach/memory.h>3 Y/ ]: ]2 j8 o7 U7 e! u
  37. #include <mach/hardware.h>6 ~* d; s. @  _) a+ o3 F6 S7 n
  38. #include <mach/irqs.h>
    + H7 q# O- j: l0 M3 T
  39. #include <asm/hardware/edma.h>; _  c, {9 v9 u+ j

  40. # x. f3 k: [5 s0 h3 B, v
  41. #undef EDMA3_DEBUG
    & T5 A1 o9 V! v  Y6 `' ?' b
  42. /*#define EDMA3_DEBUG*/. G' P. E# f; n$ X" n4 ^) A* g
  43. , P2 L4 k/ z* @! H, d. f' Z
  44. #ifdef EDMA3_DEBUG
    0 V" O+ g1 K0 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- P/ s5 ~" @; _$ L6 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! u: x( O9 a; W7 A4 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / V1 w* s; w, ~% |
  48. #else
    + P+ f3 r4 O: ]& I' S
  49. #define DMA_PRINTK( x... )
    5 \. ?' l  d9 X" y: a2 @5 }; ]* I4 p
  50. #define DMA_FN_IN! S& C. |' s1 S+ ^1 b
  51. #define DMA_FN_OUT" `( A& w3 c/ P: S, t
  52. #endif
    & g- m' ?3 t2 B2 n; s) r
  53. # g) R' L8 O/ n" ]; ]7 K" f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * K  T. ^( H8 _/ e' g
  55. #define STATIC_SHIFT                3
    4 T" L4 b) _  s4 p% M" e
  56. #define TCINTEN_SHIFT               20
    8 v# g+ L3 [- z+ N: B; m) \+ Z6 a: G7 }
  57. #define ITCINTEN_SHIFT              21; [4 A0 s6 `+ u7 K& M' `* Q/ g
  58. #define TCCHEN_SHIFT                22
    ) C6 {  S, H# J8 R+ ^( F( ?
  59. #define ITCCHEN_SHIFT               23
    . |, c5 |! o0 a0 S6 O9 I

  60. * J) s2 d8 `# F) P; z
  61. static volatile int irqraised1 = 0;
    ' C# W1 _+ V* m2 z; D
  62. static volatile int irqraised2 = 0;
    ' c4 S6 e. W, x: d
  63. : F2 y5 M# y, i, I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ h7 W7 f% Y( a2 y' q' C3 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ?7 V, W1 |" H% ^: N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ H$ d& q" o' D$ C. G  B8 ^; C. o/ x
  67. & d& }) W! N( o% d/ Y
  68. dma_addr_t dmaphyssrc1 = 0;. A5 V+ _% B1 r
  69. dma_addr_t dmaphyssrc2 = 0;
    5 f- b, t! O  T( Q0 j  C. ?7 e
  70. dma_addr_t dmaphysdest1 = 0;
    " L- u, Y/ W7 o, `1 l
  71. dma_addr_t dmaphysdest2 = 0;
    . X/ ]" O) A5 I' O) ?
  72. 3 r9 M7 \  G0 [% ~3 X
  73. char *dmabufsrc1 = NULL;, j6 t0 P% u& g/ L0 G4 A6 ~3 ^
  74. char *dmabufsrc2 = NULL;
    7 D# T) Q9 w2 b9 o" g
  75. char *dmabufdest1 = NULL;
    2 }- U" O0 s& m; l2 w$ w
  76. char *dmabufdest2 = NULL;
    . u' a6 M1 _7 f  x% N3 S3 r: }
  77. 7 }: C& G+ O9 @; ~* Y
  78. static int acnt = 512;- V" |; T, P" Z' [
  79. static int bcnt = 8;
    , o" k8 j9 ^$ ]+ i8 M& c
  80. static int ccnt = 8;
    6 J3 _& f: N$ K/ `6 J
  81. " q4 X" s- a9 W$ l
  82. module_param(acnt, int, S_IRUGO);& [% u8 Z: T) ^
  83. module_param(bcnt, int, S_IRUGO);" W5 I) _: X9 }8 q" V. P7 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 ?$ I1 n1 Q/ z" w! M( L* d2 [% h0 g* B' H2 T2 d! J) @, ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 P$ Q- |1 o. h6 G4 U( H! tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 |# h: s' D. p* v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* X  s1 j9 S) n6 V# G+ I

) v3 u+ d6 S4 E, S2 O5 j7 G/ Q, w9 f4 M7 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 13:18 , Processed in 0.040637 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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