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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( y, P8 Q, W7 M
  1. [code]EDMA sample test application
    3 k/ i# Q, g0 k! W0 Q! V
  2. /*+ L2 l8 k) R. _7 I0 R
  3. * edma_test.c
    , ~6 F7 `& j# I% u
  4. *
    1 M5 R( b7 x  B
  5. * brief  EDMA3 Test Application
    % f3 f6 ]1 |+ F/ G+ @' w
  6. *
    9 ?3 K* X' U/ ^% {: \' o8 l& _, M
  7. *   This file contains EDMA3 Test code.+ r, @! M' o: O( r" \- s
  8. *
    ; N4 {3 y  k$ a' Y0 i3 h+ @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: ]* }$ l+ f" E- F( _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- i+ j: a: H9 b# m( _
  11. *         TO CHANGE.
    $ ^9 d  h" J! r5 ]* ^/ W: R* C' g
  12. *
    & }: C5 g6 F7 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; ]7 P! V+ }# }& ~$ o+ w
  14. *1 t: A) n2 R) Z+ s) o2 ?/ p
  15. * This program is free software; you can redistribute it and/or6 H7 M" A1 U0 W. v( e
  16. * modify it under the terms of the GNU General Public License as: N* X6 Y# d( I  b7 [, c
  17. * published by the Free Software Foundation version 2.- T* j  x6 i, Y% y; M6 s& B
  18. *& n0 f: M& N0 K, Z1 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . j( A/ P# m* v- N1 i, }( e
  20. * kind, whether express or implied; without even the implied warranty- d" V; V+ b$ ]  ?; K8 I& i; p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ Q/ |- O4 l, b
  22. * GNU General Public License for more details.
    / ~4 n8 O, w# A8 p+ o2 h
  23. */
    + W1 R/ i+ ]+ W1 T: q. z( }
  24. 7 g+ L7 @" B6 |6 Y6 b1 L
  25. #include <linux/module.h>
    3 L# \) M/ `% h  ]  u# U
  26. #include <linux/init.h>
    5 W2 K% e: r  j1 @5 S# X
  27. #include <linux/errno.h>
    8 R7 \0 g" ]6 c$ M& f) ^
  28. #include <linux/types.h>$ u# |, O" T2 ?( X/ }
  29. #include <linux/interrupt.h>6 `$ ?, C/ Y: n: ~6 T5 U
  30. #include <asm/io.h>7 q( m, h: T3 p, `
  31. #include <linux/moduleparam.h>
    4 ^5 N. Z  R9 @& r+ ~8 H. u. i! x
  32. #include <linux/sysctl.h>, u& g9 L: n$ i& d
  33. #include <linux/mm.h>6 l& d1 S$ k. w7 ~! o! h4 T
  34. #include <linux/dma-mapping.h>1 N* h* ?' `7 J  G- g, q

  35. 1 r; h. g' k  N& h$ q4 ]/ {5 X$ u
  36. #include <mach/memory.h>  g$ ^  y9 w/ d$ [: y0 Y
  37. #include <mach/hardware.h>$ p0 }# U6 W  F: |
  38. #include <mach/irqs.h>, w% C2 \8 c, h2 i  J- G0 z$ i
  39. #include <asm/hardware/edma.h>
    # L+ N. h- W1 ^
  40. 8 Z+ T5 Q2 l0 [0 [
  41. #undef EDMA3_DEBUG
    $ F& ?5 P0 U+ i" E. K
  42. /*#define EDMA3_DEBUG*/. J' N( z6 O' f9 \
  43.   R  I: c8 h4 `, ~$ g* U, b1 P$ P
  44. #ifdef EDMA3_DEBUG  F3 m" \- E# t3 ^, ^+ x+ K' ]$ L- t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + M; n- X" D1 J$ f1 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( ?! C2 F" R+ I; }! O! Y% E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / O; B+ u' Y3 w, }( s# _7 \+ d( P
  48. #else! ?) ^. U: x# i; d$ k
  49. #define DMA_PRINTK( x... )( o$ D2 x5 B4 R) t$ S
  50. #define DMA_FN_IN! L6 A$ E/ a* x; `! R
  51. #define DMA_FN_OUT  [9 ~4 l' U; J+ M: [! Q. D" \
  52. #endif
    " y" T7 u& E- @+ u: T! C! a4 _

  53. & h7 i. d' j3 ~) U+ u  z2 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 V8 J, q$ m+ _
  55. #define STATIC_SHIFT                3
    ' i+ M  J" `: _" q8 h! y2 h: w
  56. #define TCINTEN_SHIFT               20/ r0 I% L5 P$ E* i
  57. #define ITCINTEN_SHIFT              21
    3 p  r2 ^; K6 S2 _* k4 G
  58. #define TCCHEN_SHIFT                22% Q& \- b- M3 |9 e% s" N9 y' ?
  59. #define ITCCHEN_SHIFT               230 x* z* w/ Z+ z
  60.   ^8 G' o3 f1 w8 ?1 @
  61. static volatile int irqraised1 = 0;
    & K1 l2 ?' ~7 r% i  K) B0 W
  62. static volatile int irqraised2 = 0;
    8 e4 e5 o$ b$ k, K( a) ~

  63. ' z- S  B6 b' }2 q: g% f# _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; O8 W! D! R( y: z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ~% _) ?. l/ w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) |: h+ Y6 \4 U# }5 @. U5 v* l2 \' R

  67. ! T* j" |2 p- d
  68. dma_addr_t dmaphyssrc1 = 0;) Y1 j3 V! w& T5 e! k! R" Y; b
  69. dma_addr_t dmaphyssrc2 = 0;! K, P7 v. V* O( w' S
  70. dma_addr_t dmaphysdest1 = 0;. H) i% E) v1 x% y; D& h
  71. dma_addr_t dmaphysdest2 = 0;
    . ]7 c8 j# f+ ^5 E- r- z, I
  72. 7 [- ^" K4 Q5 J
  73. char *dmabufsrc1 = NULL;! H4 u& K7 u0 a3 o8 {- \
  74. char *dmabufsrc2 = NULL;. q7 P% ~% i  f4 S5 h4 M* \3 Y- p' p
  75. char *dmabufdest1 = NULL;  [% p3 F& t, F2 @
  76. char *dmabufdest2 = NULL;5 X5 K1 H6 T/ B. S* n' Y" I- }5 [
  77. , C5 ?/ e- w8 r) Y* V
  78. static int acnt = 512;( ^# x/ a2 s. ~  \
  79. static int bcnt = 8;
    , D: c2 G3 f5 l4 S/ Z
  80. static int ccnt = 8;! r* A2 a% h* ^8 U" [1 N

  81. 4 _/ B/ h" e8 K0 M2 {; u5 [' q! `
  82. module_param(acnt, int, S_IRUGO);: m/ L& B7 d  t/ m1 S8 a
  83. module_param(bcnt, int, S_IRUGO);0 h. b8 e) y" O, O% l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 j' {! q5 v" `' q$ Y/ \

6 z/ }! U5 Y4 H! w) P6 J( F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% h' j. A1 N# Z& [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 K' o( G  O+ e8 L# k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 e+ ~7 C( I* Y! v( y
+ t: `! q4 W; Z0 M( S/ O1 Y
4 ~  ]' Q4 I( g' E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 08:14 , Processed in 0.038266 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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