OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! A8 C- r) t9 n8 C7 H* J, F: n& Z) q
  1. [code]EDMA sample test application
    " \; V. y2 x. H( Q! L4 {1 `6 B
  2. /*' P8 m2 {1 c" w" j
  3. * edma_test.c
    % }6 z  o; I  w
  4. *
      J% B! C0 J9 \* b
  5. * brief  EDMA3 Test Application
    * ^/ h# o, m; N6 Y: F) ~# ^2 o1 d
  6. *: C1 g3 R( ?7 J0 s
  7. *   This file contains EDMA3 Test code.$ O. l$ N( M+ x. G- J# N
  8. *; o5 T7 h% L& O: F7 }7 v+ k& _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, ?* O( Z: E2 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / M# \; U8 n1 h- e% X- y! ^
  11. *         TO CHANGE.
    ( w3 z9 ]: E0 u2 _9 ?8 q
  12. *
    & @8 j3 c$ @% [2 A  {5 l) ~& P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) p- m5 h' v8 j7 }
  14. *
    $ C8 z$ U4 ~) d5 L$ p. U9 H# j6 w8 F
  15. * This program is free software; you can redistribute it and/or
    # X( Z2 W, b/ y# q1 m& C
  16. * modify it under the terms of the GNU General Public License as; i5 s( g  c0 w9 a1 n: G/ \5 M
  17. * published by the Free Software Foundation version 2.4 ~+ L* K2 O7 z1 m$ A1 S
  18. *8 a5 d% U* ]/ @5 P& N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, M& E4 ^. c  C1 ^
  20. * kind, whether express or implied; without even the implied warranty& S0 R0 ]+ k# n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  p# [$ T7 ?$ L- q- N
  22. * GNU General Public License for more details.' m7 W0 g  D7 l* J
  23. */( |) t7 o2 `# i$ B, ]. G& a7 A

  24. , p9 r0 V+ v8 a' ^( T1 _
  25. #include <linux/module.h>
    , Y' Z) i, y" l( }* \! `7 z
  26. #include <linux/init.h>
    ; O& }& T& C1 V% c
  27. #include <linux/errno.h>
    / L+ y  K' |3 G2 v8 @0 ?' m; `
  28. #include <linux/types.h>' \: J# A( `& S# x# P
  29. #include <linux/interrupt.h>$ z  H% {6 o0 c/ `' G; D
  30. #include <asm/io.h>/ h4 }4 A3 \; I8 P9 d9 n9 |
  31. #include <linux/moduleparam.h>1 K: V0 W! N% {6 w4 @
  32. #include <linux/sysctl.h>0 I8 T: M1 o, w2 u6 n+ V; h; O
  33. #include <linux/mm.h>
    : n7 p6 n3 k  ^' _6 o
  34. #include <linux/dma-mapping.h>
    % h1 u6 L. v& \9 b3 T+ P
  35. 2 d' ]: m* L% u, O
  36. #include <mach/memory.h>
    % Z  M  X0 f* o4 N7 c; C& o
  37. #include <mach/hardware.h>
    4 |4 O% S8 t4 p) H  @2 e' V
  38. #include <mach/irqs.h>' ?- z+ t/ X! |* @/ g9 X) ?
  39. #include <asm/hardware/edma.h>8 V3 M, \  s% \9 m% y2 m4 y

  40. 4 Y& U7 V0 W& W3 f
  41. #undef EDMA3_DEBUG2 R0 V8 i$ d, J, R. j" P2 C. `
  42. /*#define EDMA3_DEBUG*/
    ) X  D5 N3 B( j& M! ^! R/ S
  43. 4 _3 s4 o- h- n* _# o
  44. #ifdef EDMA3_DEBUG
    - M! G4 y' u4 p" G% Q  `1 z& W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& e8 q) R* x1 U7 f/ P$ k, l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ l' R" n8 |$ ^$ t$ _) ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 i3 t/ w3 o9 P1 j  G
  48. #else
    0 g- e1 ]9 K) V$ z
  49. #define DMA_PRINTK( x... ): R% o: D' ^7 j) k! _/ {7 U  @& h+ V
  50. #define DMA_FN_IN
    4 M- K0 G/ c7 t) c* G- m+ S! p
  51. #define DMA_FN_OUT/ d7 f4 i/ S4 S3 ?2 u" {
  52. #endif
    8 X: o! P, u; a/ P) V# V

  53. 4 Z: n$ m  N; a9 Y4 p4 h% ^; }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# \( p! Q6 b% a% N2 K( q4 E; G) q) L8 Z
  55. #define STATIC_SHIFT                35 F9 I% G2 \, O" c- n- O; y
  56. #define TCINTEN_SHIFT               20- ?% x; H  V9 v; S) d/ W
  57. #define ITCINTEN_SHIFT              21
    # |- k2 G! |2 v( h* C
  58. #define TCCHEN_SHIFT                22: X* d9 J* S$ [
  59. #define ITCCHEN_SHIFT               23
    2 C# H5 e' @: Z6 Z

  60. ( T7 S/ _/ Y- E$ d; `" R
  61. static volatile int irqraised1 = 0;9 c* o0 c) v* n, u9 m6 L8 Y0 x2 G
  62. static volatile int irqraised2 = 0;
    6 M# ]- y8 b: k) K# N! H3 M  ~9 }( ~
  63. , `) c) Y% n6 P4 I+ k. g5 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. G) M% Q# }* {$ H' w+ m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a/ H! b, F( e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , t" T7 M# N2 v
  67. ; q" F, b! U. s; q& K& M
  68. dma_addr_t dmaphyssrc1 = 0;2 O% W; E8 {' J! Z( D9 ?3 G
  69. dma_addr_t dmaphyssrc2 = 0;
    0 n6 I0 b. M2 ]# q, O- e* l" ?
  70. dma_addr_t dmaphysdest1 = 0;8 Y4 n" F/ _  ]; |5 F$ {5 V
  71. dma_addr_t dmaphysdest2 = 0;) U( w! z+ V3 ~
  72. 4 o1 q( S. T" w0 v
  73. char *dmabufsrc1 = NULL;  U6 S" `1 `, U4 s4 M5 }# B. s4 o# N
  74. char *dmabufsrc2 = NULL;% t9 h" S) Z, S& Y6 ]; e
  75. char *dmabufdest1 = NULL;- v8 _- V8 s( x  }- H( K
  76. char *dmabufdest2 = NULL;
    6 ?" K9 j! ]# M/ W

  77. & [  a1 z. V/ F( P' S
  78. static int acnt = 512;8 x, N% P3 M# C6 h& T3 W7 }6 L1 P
  79. static int bcnt = 8;4 P* z2 Z# @: z9 ]
  80. static int ccnt = 8;
    * O, _. M# o2 ]7 @2 J0 Y% H

  81. 3 i$ X' M7 O( o5 A1 N' {
  82. module_param(acnt, int, S_IRUGO);" T" ^9 S8 a+ ]8 |7 y, d1 p. {, v
  83. module_param(bcnt, int, S_IRUGO);0 H! p' V- ]! d4 L# }9 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 h/ k, p9 b$ D& u5 W
& y& @6 a$ y# i5 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) L; U1 f9 h- B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; o, Z% \- G( ~! H% G( J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& f, k& ]! j" t! ~' N& G2 i

8 T/ R* A3 q( f4 w* P& b, e5 n' I7 g7 c; @. P2 S& g6 Z) ?, G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 12:04 , Processed in 0.039324 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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