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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 e& C9 G+ {  B& v
  1. [code]EDMA sample test application7 B: c- X$ H+ u- R" E
  2. /*
    4 N7 [- A6 Y# X; y. E7 J* o
  3. * edma_test.c
    - r: t( {- {4 S2 r
  4. *
    7 ?! X; q& G* `' i" I# _- k
  5. * brief  EDMA3 Test Application
    + k$ y0 e9 K2 d6 n# M0 v6 q4 B
  6. *' ^- ?  V: b9 }- F$ w0 x
  7. *   This file contains EDMA3 Test code.
    6 j7 D% {) U9 C  Y# j
  8. *
    - G! Z7 K$ T! f3 f$ j) C0 A$ g" Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ e) q+ _1 c) p# F9 y9 U9 |0 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 b* A) S" X4 Y5 c6 w0 t' |
  11. *         TO CHANGE.4 V" {+ E4 ?8 `
  12. *5 L1 f& e$ |# [7 c% G! w' g7 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " s; v8 p  N- V1 P  W& U
  14. *
    $ M- p- _- x' a6 g5 C
  15. * This program is free software; you can redistribute it and/or
    6 |* O& n* X5 z! v/ @7 S: e
  16. * modify it under the terms of the GNU General Public License as
    8 K/ w% a. \8 @  g, i
  17. * published by the Free Software Foundation version 2.6 _8 g1 G, L) y% V* e) t! C# L
  18. *
    # g" g7 d2 n0 I6 v: y2 S* ]1 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) Q2 u1 ^  G2 c# q7 j' u- b
  20. * kind, whether express or implied; without even the implied warranty
    , T, d& T* r6 W# J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 {) L7 N2 Y# b3 j, ^! K
  22. * GNU General Public License for more details.
    $ Z* L6 ^& q& D) g# i
  23. */9 Q: s1 c  {9 ?( p
  24. ! G. l9 F( d# R) I9 ?2 @5 `- k% L
  25. #include <linux/module.h>
    4 S5 ^$ j* g; ]
  26. #include <linux/init.h>' _( ?8 c- h+ O- m1 c7 x+ Q
  27. #include <linux/errno.h>* w  e$ b* H( V  G" n
  28. #include <linux/types.h>
    # h- I$ c* f- j" q
  29. #include <linux/interrupt.h>8 j) e% X. U' @! |( {, K
  30. #include <asm/io.h>, o7 M  S5 i6 j' ~
  31. #include <linux/moduleparam.h>
    ; ~5 J7 ~" G$ e( E$ \6 w2 }
  32. #include <linux/sysctl.h>" c, l  w  s2 f  G4 l
  33. #include <linux/mm.h>
    ) |4 W/ s% C, L" S( }# |
  34. #include <linux/dma-mapping.h>) Q& V  J8 _  H2 h) h

  35. ) Q+ l( Y7 G" `4 \2 I% p3 y
  36. #include <mach/memory.h>
    # H7 `$ w( j: P) j+ w! L) `
  37. #include <mach/hardware.h>( N% f* n3 G+ e' |
  38. #include <mach/irqs.h>
    ( @" O) Q% t0 C* u! l1 N! v
  39. #include <asm/hardware/edma.h>6 X* H$ a( b$ e8 L( ?
  40. " z& a5 L, Z  }( T* z
  41. #undef EDMA3_DEBUG
    1 I& t% A% E3 ]- d
  42. /*#define EDMA3_DEBUG*/
    / Q# C2 N0 x% h+ y1 ]* f

  43. $ {  C7 H* n4 a7 ]
  44. #ifdef EDMA3_DEBUG8 m; a: M! ~4 d, g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 j% D% v5 u/ j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 c5 ~3 J' C, E" k. U7 ^5 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * J* I! x" x9 Y# [
  48. #else: O/ p* }2 T( H5 _9 O0 @
  49. #define DMA_PRINTK( x... )- }/ V2 n' u! d4 \; Z3 A, i& _
  50. #define DMA_FN_IN8 s1 C. d  Q* G! k$ ^6 ?# r
  51. #define DMA_FN_OUT
    * M3 E  _+ ]( T9 k
  52. #endif6 p* I8 G, @: n7 ?  X
  53. - b& Z# m9 _) T8 p: S5 o3 p( M  @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) `; J+ M  e/ a+ d' {
  55. #define STATIC_SHIFT                3& \' i. u7 |8 O. o9 L& n
  56. #define TCINTEN_SHIFT               201 @, O/ i# u- ~
  57. #define ITCINTEN_SHIFT              21
    0 V2 m" g! Q3 P/ y  p
  58. #define TCCHEN_SHIFT                22. E2 B3 O# \3 B* f0 x% U0 A
  59. #define ITCCHEN_SHIFT               23
    ; U- M( v7 T% @

  60. / p( i$ A5 l; Z3 r% C
  61. static volatile int irqraised1 = 0;& V6 ?. X& q9 u5 v* b1 `
  62. static volatile int irqraised2 = 0;
    . [$ V, S1 o8 H
  63. 8 }' [& f) ~- K3 O9 l7 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! r; z& L! \$ A/ m8 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ c. f: E" \* @# p0 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" o" R# ^5 |+ ]7 T4 Q5 s) o7 }

  67. / }+ i  D7 l" H% O/ ?  B
  68. dma_addr_t dmaphyssrc1 = 0;: U1 Y! i& Y" y8 \" N4 ^) x- J
  69. dma_addr_t dmaphyssrc2 = 0;7 ?1 Z: N- Z* L/ N: e6 P0 P, j
  70. dma_addr_t dmaphysdest1 = 0;
    1 o6 ]0 u3 R- ]+ Q8 e5 ~& m
  71. dma_addr_t dmaphysdest2 = 0;
    - U% H& p0 ]5 j) l% A4 C

  72. 6 t5 E, ]- T6 f/ W* K( q2 t8 w$ |
  73. char *dmabufsrc1 = NULL;
    ; Q& n, Q0 X. r1 L) ^- D
  74. char *dmabufsrc2 = NULL;  O/ U2 d" X; e. [. S, A
  75. char *dmabufdest1 = NULL;7 C( [8 w- E% z
  76. char *dmabufdest2 = NULL;
    2 r& T5 p+ z" b# Z# Z

  77. $ K- n, f8 O7 E+ r: o; k
  78. static int acnt = 512;8 P+ y  c7 K& i" u9 g
  79. static int bcnt = 8;
    : K- D8 p/ i1 R6 \
  80. static int ccnt = 8;
    8 |/ s) u: z8 x7 `

  81. 1 @# T5 N2 b4 [9 n) n' _$ y
  82. module_param(acnt, int, S_IRUGO);
    3 k$ \! z7 d9 y
  83. module_param(bcnt, int, S_IRUGO);
    ( {& n" {$ r1 [+ p! v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! @; q5 z/ q: l; g( Q
/ U& U' m. O7 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, t: j% x7 N/ a  u/ E- I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. Z; i1 l6 t/ d- `+ A' G$ o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: b  o- w" J$ E. _9 h4 J

; L" I) j" F) a6 r6 k! x( v; L/ P% W4 t8 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-22 00:58 , Processed in 0.041476 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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