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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ L" c# Z2 t+ J
  1. [code]EDMA sample test application
    0 l5 M/ {+ u- d% Z* Z9 l) c
  2. /*
    - j. v3 }! r) e$ @3 s' u" w: h
  3. * edma_test.c; X+ `# r, ]( A& b
  4. *8 m6 N4 ~& B  x" n" Z. o5 Q
  5. * brief  EDMA3 Test Application
    ; w* S; A2 G* E3 j2 H* g
  6. *
    8 O7 ^" R3 _! d8 \2 m
  7. *   This file contains EDMA3 Test code.
    ' V# s: T! ]+ e' H2 A7 [) i
  8. *
    , Q+ H3 L8 G  F/ [/ U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 o0 \" }- j* C3 }9 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 N" U- }  R: ]! S: {3 p- p* k9 B( f
  11. *         TO CHANGE.; @+ b+ T* g2 C; z6 h! v5 Z
  12. *
    * r* S: @" i, L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 @5 E4 C9 C' d4 @
  14. *0 q8 Q' |6 Y* C1 X+ m
  15. * This program is free software; you can redistribute it and/or
    ( O; j( f7 ]8 `( h* j# C
  16. * modify it under the terms of the GNU General Public License as3 h* q  Z' s6 o
  17. * published by the Free Software Foundation version 2.
    7 H; ]# A! Z0 P) X: b6 a6 `
  18. *
    ; U* M( t# s+ Y# W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 l0 i7 R8 X/ [( g  j, j
  20. * kind, whether express or implied; without even the implied warranty
    , X6 _! u# e  I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      |" a! @* k0 X+ ^  f7 v
  22. * GNU General Public License for more details.6 T' u% t7 L6 x4 r  R0 C
  23. */7 l  o8 }8 f4 X+ S$ c
  24. 0 Q3 w' ?& v% ]7 ^+ c( K
  25. #include <linux/module.h>7 |+ F0 S' S2 s5 s
  26. #include <linux/init.h>
    1 f5 {* Z0 [3 X1 n
  27. #include <linux/errno.h>
    2 k+ k% }) k6 N9 s1 U
  28. #include <linux/types.h>
    " P( j) L3 o% S! P
  29. #include <linux/interrupt.h>) z" t, j/ T' y. q1 p0 ^- C3 q
  30. #include <asm/io.h>
    6 X$ P& l, I* O
  31. #include <linux/moduleparam.h>7 e4 L5 T- c- U0 i
  32. #include <linux/sysctl.h>
    " t) {1 z! ]  E* o
  33. #include <linux/mm.h>
    # }% @5 P" `- ?4 s! H" F
  34. #include <linux/dma-mapping.h>7 N2 _9 ~, k; s9 H

  35. ! {6 K, `+ m. U: B4 o) L2 u
  36. #include <mach/memory.h>
    4 ?! s- f4 R2 z+ ~, ~6 s( Z
  37. #include <mach/hardware.h>/ _% J! I7 Y$ ?" w- i
  38. #include <mach/irqs.h>
    ) W) o/ n+ [+ O) n0 p
  39. #include <asm/hardware/edma.h>2 I# P5 _% f" k9 a5 X
  40. ( V& C6 K; s: e9 n" P* y
  41. #undef EDMA3_DEBUG, z) M  `! m; g" D
  42. /*#define EDMA3_DEBUG*/) W+ h. \# m3 f
  43. 7 O) u" p. S$ J4 Z  ~# {) g
  44. #ifdef EDMA3_DEBUG% g1 N; i, `( ?$ J& p; c+ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ E$ \9 Q# e1 w& u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  @* o  g4 U! |% [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( w" R0 C! Q% |# g( g5 x
  48. #else
    4 l# j2 W+ f8 B3 d
  49. #define DMA_PRINTK( x... )
    $ ~, p! F* A7 C$ F$ a7 p3 l
  50. #define DMA_FN_IN% n0 V3 r4 a. n8 u. L& y: ^# Q
  51. #define DMA_FN_OUT9 f8 A5 J% }( k2 y
  52. #endif
    6 `$ g4 P3 k. O9 ~1 h

  53. 7 W9 k: a+ l+ V1 m! e5 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 i& P% M4 d9 f- @* P5 K
  55. #define STATIC_SHIFT                3
    2 X7 R7 C+ k3 |" w6 |3 m9 G  K4 m
  56. #define TCINTEN_SHIFT               20% p- ~: F' ?7 R7 H' r9 Q1 W
  57. #define ITCINTEN_SHIFT              21
    ; x: Y# Y9 V% i' l" d4 c  j: {1 O6 W
  58. #define TCCHEN_SHIFT                22
    * h8 b/ F& Y4 }  L# Y% a
  59. #define ITCCHEN_SHIFT               23' Y2 d+ L% O" V
  60. # ~: [7 y- x6 B0 m8 V
  61. static volatile int irqraised1 = 0;
    8 E# I' J0 r! V
  62. static volatile int irqraised2 = 0;1 {. ~8 D6 b5 [5 u: m

  63. ; x/ X' D0 b% V% l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ]5 `3 }  p* k) \" z; T/ d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 J7 l- V+ B( V, v$ ]1 o4 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : M" X& k- Z, R
  67. & n+ S5 D6 k5 x
  68. dma_addr_t dmaphyssrc1 = 0;. p4 v6 t) E, y  m8 ?
  69. dma_addr_t dmaphyssrc2 = 0;! S5 F: f6 d. v2 O0 J
  70. dma_addr_t dmaphysdest1 = 0;6 Y& K+ O! I+ R9 L
  71. dma_addr_t dmaphysdest2 = 0;8 G5 v  e7 _, z5 V! h  [

  72. % M5 T9 ~) I: m7 G% ?4 m2 ~4 e
  73. char *dmabufsrc1 = NULL;$ f9 V3 L2 L; d/ s8 J: K
  74. char *dmabufsrc2 = NULL;
    % S4 s, J8 b( i0 Z! E/ G
  75. char *dmabufdest1 = NULL;- {1 ~5 G$ w: ^; j9 \( W3 d
  76. char *dmabufdest2 = NULL;, f3 @# g4 S) D9 p

  77. ( Y+ L* [4 H& H. E' K
  78. static int acnt = 512;7 ^' `' u9 g( ^3 T6 A& a) [. x
  79. static int bcnt = 8;& M! \" p$ K! U6 R- S
  80. static int ccnt = 8;$ b- }( o  x% ~( Y' ~1 d5 i( D
  81. 9 r' U9 G6 s6 h" [3 {1 O  J
  82. module_param(acnt, int, S_IRUGO);
    - R$ o" g" N, i0 }. ~' B: x
  83. module_param(bcnt, int, S_IRUGO);8 g" M! \; I4 {2 Y6 x# B1 q* B8 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, H  B* C' ~! Y8 w8 W4 a/ d2 c$ h

/ L. `' Q$ [0 m6 |* R& b1 G6 z( W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 I0 P6 ]* j3 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 o( R& V. q; W& w! e2 t( U) ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. Z2 ?! ?- v6 j* F
$ H- @, E8 t1 E( N; G) W

) F$ _8 Z' ~9 U( s% k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 09:22 , Processed in 0.042590 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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