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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - U% a( o6 T! N. X- o3 F
  1. [code]EDMA sample test application
    + \7 Z2 K# Q5 r* O# I+ K' M! G2 i
  2. /*- i7 k" ]& U  x- M0 @
  3. * edma_test.c' n6 e% M  }7 W7 G: A6 h# k
  4. *) ^% l# ^3 Y5 v% g
  5. * brief  EDMA3 Test Application
    / ]0 F9 Q  E/ ~1 b9 K; @" c& v
  6. *8 u. z2 B% E+ o% h
  7. *   This file contains EDMA3 Test code.+ b* _+ B8 _* z% |0 B+ a
  8. *
    + n% z  H# X; `4 I) C- D7 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 z7 ^# K# J! w) G8 P# Q% y1 {2 Q& ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# N* z9 G% ]" G# V" B6 I* _
  11. *         TO CHANGE.
      i1 s* U0 v2 k  ?5 x3 D+ Z& ~0 H
  12. *' t4 N( R. V/ e2 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % n6 L5 N$ M+ y
  14. *
    * U1 Y- i' Y/ U( b4 L
  15. * This program is free software; you can redistribute it and/or
    # n# f! M6 E2 _  ~
  16. * modify it under the terms of the GNU General Public License as$ V: n. r% L8 g$ Q* k8 Q; q9 x! D
  17. * published by the Free Software Foundation version 2.
    4 c- d9 U! o9 e; o% M
  18. *9 [; H5 _9 ^& \' ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) @$ n" j1 L& J2 G" J+ \* R; l5 i
  20. * kind, whether express or implied; without even the implied warranty
    5 s- ^9 P6 T- b; B) f# F1 o7 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' g* m9 {; [' E9 @, h
  22. * GNU General Public License for more details.1 L8 g5 h2 `6 a6 Z
  23. */
    1 Q* D% U3 m6 \

  24. 8 s4 s8 H/ J1 w& ^" ~
  25. #include <linux/module.h>7 E* O6 v3 X- I
  26. #include <linux/init.h>
    5 \' s: L5 Z' g! f
  27. #include <linux/errno.h>* F5 G/ ^' j& N- r' I( p0 J6 F3 {
  28. #include <linux/types.h>
      c9 n% [% Z( ~8 h" W4 Y
  29. #include <linux/interrupt.h>
    # L2 y+ M5 ]) q# r
  30. #include <asm/io.h>
    # h/ x+ w# ?; t8 \$ V" ^* @5 y/ j
  31. #include <linux/moduleparam.h>
    7 _" D6 m5 N' y. V/ u, t/ a* K
  32. #include <linux/sysctl.h>
    0 h1 o  x( B2 [- L
  33. #include <linux/mm.h>
    - D) x9 [4 J' k) l
  34. #include <linux/dma-mapping.h>
    * E- e/ ~: J* \, N' Q2 O3 Y" d

  35. & C4 e, _% q  ~8 F! t( q+ i  T4 W
  36. #include <mach/memory.h>  W% J) k! g7 g! ~# G+ X/ O
  37. #include <mach/hardware.h>
    ( M" ^; Z8 S7 q9 ~
  38. #include <mach/irqs.h>
    , a& \" F+ Z; y4 z7 J
  39. #include <asm/hardware/edma.h>
    9 U- x( j' C  K% f6 ?6 i4 |1 J
  40. + ]/ F/ U) K5 t+ H+ I+ T9 N
  41. #undef EDMA3_DEBUG7 {" y- F% O/ }
  42. /*#define EDMA3_DEBUG*/
    ' K6 y4 o/ q4 X  j0 b+ n

  43. $ S9 m+ j3 u5 R* P. ~5 Y
  44. #ifdef EDMA3_DEBUG, i: `8 f6 s8 `1 w% u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " Y& o/ y3 O- Z5 W6 ?6 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " ?  @; w0 G2 j# w2 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 _* }$ Y. z- u2 m
  48. #else
    ; s# `" }* Q5 a: L1 h$ l* k
  49. #define DMA_PRINTK( x... )
    1 v4 j$ E$ p; n6 a
  50. #define DMA_FN_IN  |( M: \6 \/ D5 f" o3 J; z1 d; L3 \+ }
  51. #define DMA_FN_OUT
    - G9 H! ^. Y/ L* L
  52. #endif
    ( T& A4 V" \' A( e3 S# \
  53. 3 O# v& ~0 k  Z# i) M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- S- `5 u5 s3 w4 W" K6 i) P7 K
  55. #define STATIC_SHIFT                3. f( X/ t! M! g6 @' a1 n8 ^
  56. #define TCINTEN_SHIFT               20, C- b1 _% Y- ^, T- H, b% e
  57. #define ITCINTEN_SHIFT              21
    ; e  q5 x7 t, B" s. h
  58. #define TCCHEN_SHIFT                22
    & O8 ]5 E: q8 m" r  V
  59. #define ITCCHEN_SHIFT               23
    9 l) ~0 i$ J, f
  60. , q$ x6 e" r7 b8 R- x
  61. static volatile int irqraised1 = 0;8 N6 \5 h& u: I
  62. static volatile int irqraised2 = 0;
    " P* {% d, l: g) r  y; P9 L& o2 U

  63. 8 \/ {2 \- \# b( p2 b7 y% q5 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& P6 e. p5 @" [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 J- j: \7 \8 y& ]" L5 t$ d! v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; E" j2 S7 b  Q2 Q
  67. : A7 `+ q. B9 \. Z0 i# X. z
  68. dma_addr_t dmaphyssrc1 = 0;1 R# ^* h3 o# w
  69. dma_addr_t dmaphyssrc2 = 0;" q9 Y: h# w0 X+ c
  70. dma_addr_t dmaphysdest1 = 0;* R8 a1 |+ G" Y% l, X7 O1 @
  71. dma_addr_t dmaphysdest2 = 0;8 @6 x8 ^. U# ]8 i# I' Z& K8 n  s; l; S; Z
  72. % e7 w7 b% i! c
  73. char *dmabufsrc1 = NULL;% d% Z  g! [! H
  74. char *dmabufsrc2 = NULL;
    6 e* O- ~, \- ?5 F
  75. char *dmabufdest1 = NULL;" K0 h) u! f# L1 ]8 y
  76. char *dmabufdest2 = NULL;7 X1 X9 T0 b! E$ Q
  77. 4 q% M8 l+ Y( j) @) R" O2 C& s
  78. static int acnt = 512;
    3 u5 Z* u' s% r, k! O
  79. static int bcnt = 8;
    : k% r. G. G0 f: v/ I
  80. static int ccnt = 8;6 f2 M8 X# n, b( h

  81. 6 G9 `* q* q# j( S- E* t
  82. module_param(acnt, int, S_IRUGO);
    1 Y+ _) n# h8 K% z4 g/ ]% ~
  83. module_param(bcnt, int, S_IRUGO);" t% _6 R$ @4 m- V" Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; f/ q  b1 ~: f0 D8 `, P) E: g# Z% E6 i5 K3 b8 Q6 X3 {: w$ o5 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! S! U9 U+ N: _: {5 H" T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. g- d- d! l1 R% B( S' k! F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) ~8 u4 [4 E/ e5 C0 Q  a4 u8 M

; s2 h/ v# K! h7 Y7 v6 p& r8 K" ?1 a# D2 y' b1 k. Q8 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 01:49 , Processed in 0.053577 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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