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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 C% Y6 H+ F7 C4 A2 s
  1. [code]EDMA sample test application
    ) J4 _1 d$ O0 B, E: R2 e5 T6 R
  2. /*
    $ \+ S6 C& ]  r/ j
  3. * edma_test.c
    $ D/ }( g6 ?, J8 b
  4. *
    * l9 L- T( y7 v" i6 l
  5. * brief  EDMA3 Test Application
    6 {8 m3 x2 c1 @1 N& D: H, |
  6. *
    , N( Q6 M6 L7 G4 E3 ?; A# Q
  7. *   This file contains EDMA3 Test code.
    * k+ a0 R9 n; N' ~- f8 ?! M# w) |
  8. *
    8 i/ d* t% _+ z$ N6 [- l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 m! s& ~% Z* D& y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 n# @, m3 B- z* O7 G; @3 ]1 l
  11. *         TO CHANGE.
    8 X1 R* n) ^( y4 f' |
  12. *' P6 W' N' D$ Z* h1 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) X  P! ^7 b  C2 V
  14. *8 q. V  V; l) U/ Z9 J
  15. * This program is free software; you can redistribute it and/or- C- E9 m7 Z+ i  W# _
  16. * modify it under the terms of the GNU General Public License as! V7 k' H  J+ I) B9 U6 E8 C
  17. * published by the Free Software Foundation version 2.9 ^  @8 D. @6 K9 P. [: h
  18. *
    " V1 @1 l. F* E7 [" b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # o5 T% N1 k+ c, k+ o6 ~# s  i& M
  20. * kind, whether express or implied; without even the implied warranty4 n6 n, v: M# D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 d7 v6 T' {# B2 z8 ~. ^( l, ~. o: U
  22. * GNU General Public License for more details.
    / S0 B+ I" I6 b1 d7 z
  23. */
    , T4 v: g! G+ E  I

  24. ) w6 r- P' I% X% X
  25. #include <linux/module.h>$ m( k0 b2 l* \5 a5 g
  26. #include <linux/init.h>
    1 ^0 @; A6 S* V" V1 P; M
  27. #include <linux/errno.h>
    , a3 M6 |: {" g- }7 M3 t
  28. #include <linux/types.h>% l2 n' e3 ^: @. ]  a
  29. #include <linux/interrupt.h>6 J8 E6 ]8 t! i) |  p' t# a
  30. #include <asm/io.h>
    / j! ]2 f7 d; H" w: j6 p
  31. #include <linux/moduleparam.h>
    + j* ?  C3 j0 @7 _0 n
  32. #include <linux/sysctl.h>
    7 O9 x6 p4 t( b! E5 z
  33. #include <linux/mm.h>0 T' x7 X7 p) V: O: ^
  34. #include <linux/dma-mapping.h>1 F6 m. l7 _: K6 e; s; a1 `# S
  35. - N: I8 @  Q5 g  _0 O0 C
  36. #include <mach/memory.h>
    7 R/ ^$ \; x  @- O2 |- m/ @
  37. #include <mach/hardware.h>3 i5 ^& j* n  Q
  38. #include <mach/irqs.h>, ^! _2 C! V' A+ H6 }* T4 n' ]* g
  39. #include <asm/hardware/edma.h>
    - Z1 Z! w0 j; \

  40. * Q4 L6 R/ s4 I) `8 R
  41. #undef EDMA3_DEBUG1 O) M) _5 X8 A
  42. /*#define EDMA3_DEBUG*/
    # }% G( l! q1 l6 L

  43. 8 A, S( f5 N5 j6 t$ h% o4 F
  44. #ifdef EDMA3_DEBUG4 ?4 ^9 w2 ~  ?2 ~% ^1 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : b+ O: ]2 B) u+ z# g, y" ]$ b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 R9 ?! K3 d. ~7 E1 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): [8 x" a- R0 y5 W& Y. ~
  48. #else9 d1 d, I+ U! D1 a
  49. #define DMA_PRINTK( x... ). E8 T9 s. e- M# w1 {
  50. #define DMA_FN_IN
      _5 x0 k: h  q  h* `0 b
  51. #define DMA_FN_OUT
    ) t' `4 A" m# {3 x. F$ b! L0 _
  52. #endif! N9 c+ Q, o# z4 ]
  53. $ ^* L5 s8 t+ o2 A2 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ C0 b6 G& a/ I& L" M# W7 X! w- J# Z
  55. #define STATIC_SHIFT                3
    " R3 O) P8 k# w9 m: ~
  56. #define TCINTEN_SHIFT               205 D% S& o7 r0 Z2 o' R
  57. #define ITCINTEN_SHIFT              21
    & ^3 [" `% X( x- `
  58. #define TCCHEN_SHIFT                22. ?6 Q- K( i& a! p/ D
  59. #define ITCCHEN_SHIFT               23
    4 Y. m  H" j/ H+ z

  60. 8 j  p" B& b# ^5 d& Y- G- L5 C0 g
  61. static volatile int irqraised1 = 0;
    5 N( s2 a+ E" s- K5 @
  62. static volatile int irqraised2 = 0;" B$ V$ e" {8 T1 D7 l, e1 R- X9 f

  63. / o: D2 H, ^9 H" y9 r( i8 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 O: r: u8 t! J$ ^7 o" F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : C" ~# G% l9 D4 o1 h' n/ |  `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 C& ?4 P* h7 b( z
  67. ) T/ j. ]& Z# b- X
  68. dma_addr_t dmaphyssrc1 = 0;
    7 `; ~5 @. q( x* w
  69. dma_addr_t dmaphyssrc2 = 0;
    6 ]% ]2 f" |5 s* K
  70. dma_addr_t dmaphysdest1 = 0;
    " s/ w: t6 _9 C  J/ `# ^% `5 ]) {
  71. dma_addr_t dmaphysdest2 = 0;
    4 f& q: E" k7 I
  72. 6 y# |4 O8 u( p% o+ B( V' j! U
  73. char *dmabufsrc1 = NULL;
    0 Y* X! n  s9 L& M
  74. char *dmabufsrc2 = NULL;
    - }% U) h( K; q
  75. char *dmabufdest1 = NULL;, c' U7 s# v& N& z: F* ~
  76. char *dmabufdest2 = NULL;
    0 ]' p& i5 j9 v' `8 [6 E0 Y

  77. " v2 v  T; G0 `: j5 p# M( w& u' v
  78. static int acnt = 512;3 W1 H+ P; f3 Q( y! i, B' h
  79. static int bcnt = 8;0 q/ ^7 x6 i: k; p6 N$ Y) h& x# ?! X
  80. static int ccnt = 8;+ n/ ~- E; l2 T+ O

  81. 3 ?) s* H: K: p4 m9 G% j- Z# }
  82. module_param(acnt, int, S_IRUGO);5 K7 n# V) m/ R( d% G9 h1 y8 h; X
  83. module_param(bcnt, int, S_IRUGO);6 V0 C7 h2 M4 x% w4 H! E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 p! J  ^, \0 f: m8 n: I/ c/ f3 y7 z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 f. e) o+ Z* Y. f; B6 ]2 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 y% |0 M: A* N! a: Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, c; c' B% E/ U* D! |6 h/ [0 I4 t" n7 [# P) Y: ?( y) w
8 S% w3 D3 D+ o5 ~1 B1 Z& U$ \- H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 08:32 , Processed in 0.038484 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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