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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 S: s" m# I: ~6 {+ G
  1. [code]EDMA sample test application5 Z9 Z+ b8 N1 f2 S8 C  I
  2. /*
    # v( ^) E) Q2 ?; f0 f3 E, O6 [  F
  3. * edma_test.c8 m# ~. P3 M& g9 o
  4. *5 l2 @- B" z. v# }5 A& r# Q
  5. * brief  EDMA3 Test Application9 ~, B; U# p( y2 B- F5 A' ~
  6. *$ S6 `1 Q$ j. Z" H3 O
  7. *   This file contains EDMA3 Test code.! f7 ?/ J3 i  [+ q
  8. *
    & Y: D) T. ~7 k3 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, j, A: H, G2 R1 G0 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% D7 M7 w/ w3 d6 c; y/ f8 W
  11. *         TO CHANGE.
    / |/ t( E2 F9 h7 F* q* N# R3 D
  12. *$ A; [; R* i% _( c6 p1 B, `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ r0 C' Z! Q* H/ H
  14. *
    + c" f; f& D: ^) r! P( x) T
  15. * This program is free software; you can redistribute it and/or
    0 F$ p  |0 C' p5 M7 h0 e: _+ j
  16. * modify it under the terms of the GNU General Public License as
    : }0 z& H) a$ ]0 ?8 q
  17. * published by the Free Software Foundation version 2.) e% W" \. q3 l
  18. *+ P" S  M2 Q8 {, A$ _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 f& E% w- a& d
  20. * kind, whether express or implied; without even the implied warranty
    5 l! m! f0 j# T/ C1 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! u% c9 L/ u2 E& c3 R# P
  22. * GNU General Public License for more details.* V7 `0 h* ^/ U- w1 K
  23. */
    2 {& I9 W, _; {1 F- f: k

  24. 8 T  m' ~8 E" G7 q2 B: y5 Z
  25. #include <linux/module.h>, n  Q4 i) @  e/ S1 V
  26. #include <linux/init.h>
    * A% {) C& {" G! v2 J; k0 E1 J0 X8 p
  27. #include <linux/errno.h>* }/ ^9 \, ]! B# r
  28. #include <linux/types.h>$ Q/ B( j7 e" Y+ x0 `
  29. #include <linux/interrupt.h>, `" X! k' `+ B: {/ {7 g9 |
  30. #include <asm/io.h>
    ' Z/ U: e1 ]" t: w! T$ [
  31. #include <linux/moduleparam.h>% A* l1 O7 o% [- u5 ^% d
  32. #include <linux/sysctl.h>! r4 {/ g/ D2 f$ ?+ r0 L2 X
  33. #include <linux/mm.h>
    : P% M* W6 m4 f; y& J
  34. #include <linux/dma-mapping.h>; C" M: M$ E' l' t8 l0 D

  35. 7 O- M% n1 B8 D" z3 R% ~
  36. #include <mach/memory.h>1 ]$ [% x  A. Z8 o0 {) N
  37. #include <mach/hardware.h>' P4 |5 `5 ^( J* ?" _
  38. #include <mach/irqs.h>6 _! q$ C6 P2 \: k
  39. #include <asm/hardware/edma.h>
    ) v% p' M/ i  A4 F5 p2 }' X& K
  40. 8 T6 ~$ [- y) H: r& w; E
  41. #undef EDMA3_DEBUG
    8 d, P' R1 ?* Z
  42. /*#define EDMA3_DEBUG*/
    , K' j0 F1 A. M* V! M6 x- Z$ n$ w

  43. + L& S1 L0 I' m, [8 u8 |
  44. #ifdef EDMA3_DEBUG: V4 c' a2 Y( q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( D# B5 D6 F) o. Q' v9 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): B8 y' V& Y" s0 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# h5 u- h1 X/ X& ?, D5 J
  48. #else
    ( Q* G' K" f1 z8 m  a
  49. #define DMA_PRINTK( x... )3 {) Y0 |0 J# N7 U; L5 H" U
  50. #define DMA_FN_IN
    4 J) t; s" X4 z' M
  51. #define DMA_FN_OUT9 m/ A  P3 Z3 `& K# h9 e- o# ^( @  h
  52. #endif) H+ |- _) {1 G7 P
  53. 0 Y6 R' j9 D# J+ F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& f2 _" S9 z5 }7 n
  55. #define STATIC_SHIFT                38 M+ l: {0 m4 \' S+ H! O
  56. #define TCINTEN_SHIFT               20' |, f5 c4 P4 K
  57. #define ITCINTEN_SHIFT              217 L7 j# }  [  m: R- Z: w! `
  58. #define TCCHEN_SHIFT                228 @  H' a" \, k/ r4 o) P
  59. #define ITCCHEN_SHIFT               23
    ; M; ]: {2 h6 k* k
  60. / ~& H. p1 L* x7 C% X6 ~
  61. static volatile int irqraised1 = 0;
    $ K9 t* @6 }! X# ?# s
  62. static volatile int irqraised2 = 0;2 @( g- g7 i: s  b9 K

  63. & d, E: z) F" d$ y0 h. o3 K/ K& P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % C- }# h' p. U0 ?: ]$ ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" s5 O8 h5 r* f  b& K+ a) {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Z2 r3 n& E$ j% u3 p/ o9 l

  67. # ?. }8 `- G6 w' C" w/ e* A
  68. dma_addr_t dmaphyssrc1 = 0;
    5 S& f4 C) Z$ x+ J' x6 O
  69. dma_addr_t dmaphyssrc2 = 0;) o8 K% s0 s- ~& ^
  70. dma_addr_t dmaphysdest1 = 0;
    0 D3 B: G6 ^' z' t8 i( _
  71. dma_addr_t dmaphysdest2 = 0;
      i5 X$ }5 P$ ~: M# K
  72. 5 q  T- M: p% [" k
  73. char *dmabufsrc1 = NULL;
    0 {8 v# |; r' k5 L
  74. char *dmabufsrc2 = NULL;
    ) t  L$ O: O- N) R0 a
  75. char *dmabufdest1 = NULL;
    " G( I7 b7 A. e# _4 q# p3 g
  76. char *dmabufdest2 = NULL;
    # E; }5 w& Q$ X
  77. 4 v% u; S; c- j/ M* a6 V4 V
  78. static int acnt = 512;
    + r  c1 w) X2 u( V
  79. static int bcnt = 8;, t' a( J/ }6 N+ y
  80. static int ccnt = 8;0 _/ P7 v* ~7 H5 I) \

  81. 0 Y# U$ P3 v# U( w! ]3 h. y* n
  82. module_param(acnt, int, S_IRUGO);6 i! @8 l% n7 ~8 f8 q8 b* j
  83. module_param(bcnt, int, S_IRUGO);. r# y' i8 ?: V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- |& {9 A- J8 S* ?, N/ D9 Q5 g7 S% Q3 D; d/ \, X, Y4 B! N  W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ V: W2 G1 t2 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& ~$ P1 O1 |2 B/ I# Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! {, L# O3 J% o% B& _1 I2 p

' |9 s, U7 t% a" x
; ]: A, Y: G3 @( ?, i2 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 14:04 , Processed in 0.038734 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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