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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 O% ~. D) ~3 C8 H& \
  1. [code]EDMA sample test application
    . i- t' `  q, s4 T( \. H/ X; @% b3 L
  2. /*# ~8 [% n& f* n$ e% p0 C4 A
  3. * edma_test.c
    ! {; N5 A6 B- _" E3 P
  4. *
    ; [0 ^0 a! ~  }- @
  5. * brief  EDMA3 Test Application
    ( @+ C9 N- |- |" `) _: I
  6. *) J9 a9 Y+ c3 K8 {& m
  7. *   This file contains EDMA3 Test code.
    6 Z* t9 o1 L- J. u$ B1 r
  8. *
    / z  i4 Y+ x5 T$ ]1 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # N  ~, i6 K; I4 [6 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! E) W( J3 w; E1 E* V
  11. *         TO CHANGE.
    6 y! V. R7 P/ A8 p1 M' A9 S
  12. *+ q0 R0 f/ _0 U* \: o( {7 c. n& @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. i4 }) S4 F0 U3 t& w' G
  14. *
      E: Z5 b7 s" ~2 a8 _
  15. * This program is free software; you can redistribute it and/or
    $ H* Q: z# y  ^, t: ~5 S# R7 g
  16. * modify it under the terms of the GNU General Public License as! v* h  s; G9 `  d6 i' ?
  17. * published by the Free Software Foundation version 2.
    9 ]& {/ m) f! p  H. N
  18. *3 q% F4 O1 J7 w; W# z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ ?# m$ z$ a# r' Q  y
  20. * kind, whether express or implied; without even the implied warranty
    % S4 n6 L* l9 t# t4 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' D0 M8 H( M3 i; B1 o7 E
  22. * GNU General Public License for more details.8 [! m6 r' y7 G3 z" l( T
  23. */
    6 G3 S3 K8 Z( @9 Y/ H5 @

  24. ; X4 n1 o5 [" w  C
  25. #include <linux/module.h>
    8 H# R: a/ G# r* a7 j2 h
  26. #include <linux/init.h>1 P) k4 x& e$ r% h& k; |
  27. #include <linux/errno.h>0 t& ^, D5 m* e
  28. #include <linux/types.h>: f9 \0 K/ U0 W% G; p
  29. #include <linux/interrupt.h>) s3 H0 ^  z" p5 F
  30. #include <asm/io.h>
    ( e) B1 M( C# t0 c7 j
  31. #include <linux/moduleparam.h>
    # w. y, @3 L, L: }; w5 y
  32. #include <linux/sysctl.h>
    2 i6 k" m3 d9 x6 h) O0 ~& _: U
  33. #include <linux/mm.h>. [: k+ V. ?$ g* O
  34. #include <linux/dma-mapping.h>% U8 E" X* f, Z9 c1 O. G
  35. - k3 ?7 j( F  Q; E2 R
  36. #include <mach/memory.h>
    0 l8 s- E# _5 h& e( f# e
  37. #include <mach/hardware.h>* y) ?+ W/ Y/ h! u
  38. #include <mach/irqs.h>
    . e6 f# D- Y# C1 B& ]& L" U
  39. #include <asm/hardware/edma.h>6 h5 [# u6 R$ ^& ~- L
  40. / O) j8 J) V! I) m- b, C' p$ {
  41. #undef EDMA3_DEBUG
    % }% Q8 i% c. ?# U
  42. /*#define EDMA3_DEBUG*/
    , ~0 r' }! G$ X. T9 F+ f1 i+ z
  43. 8 a3 G1 L8 X: l( j
  44. #ifdef EDMA3_DEBUG% M, b" A6 D+ z. \' _" z  g5 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      Y1 C0 f( T: m  o0 U+ a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " d1 ^- q# M( @4 {% z( X# o6 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): c* D; i4 R5 J3 L
  48. #else2 x* H  L; F! T6 Q8 i1 D
  49. #define DMA_PRINTK( x... )
    7 m9 q' B/ Y! g( n/ M- w' F/ V
  50. #define DMA_FN_IN& s# I& D* Q; x& ?$ G4 ?! f
  51. #define DMA_FN_OUT
    2 p- [- `4 L# E4 ]$ t9 R4 ]2 p
  52. #endif
    , p- \3 l' s4 E! A/ t% Z
  53. % d5 a: [1 y) z2 P$ b0 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); q$ s. l* P1 h1 C! I; b. N3 N& @% i
  55. #define STATIC_SHIFT                3; f" g) o# M3 U' J5 S) i8 x
  56. #define TCINTEN_SHIFT               20
    + J4 Z+ ]! ~  l5 {5 I. H
  57. #define ITCINTEN_SHIFT              21
    ! w# ?9 `: {2 D( b2 s
  58. #define TCCHEN_SHIFT                22" R5 W8 m0 [, z
  59. #define ITCCHEN_SHIFT               23
    1 z: p8 u2 ~  t9 B$ d4 w
  60. & Y/ v' O2 c# B/ D! }' c8 W
  61. static volatile int irqraised1 = 0;9 ?2 z, O8 O, d% b0 r. Q4 _! I8 g  n
  62. static volatile int irqraised2 = 0;
    * O" _/ X8 c* c. M/ _( V
  63. . \7 t7 }8 E* T- |7 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( U! ?8 V" I- \: I- b* L( j& i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* _: k6 [$ Z2 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* R% j$ I9 w6 \7 Z9 E* y
  67.   u) {) G( X5 h) ^5 [
  68. dma_addr_t dmaphyssrc1 = 0;
    , A' t3 d4 |7 M9 ~% ~9 H
  69. dma_addr_t dmaphyssrc2 = 0;+ S# M& I+ K* V  o1 ]! @8 i0 x6 |
  70. dma_addr_t dmaphysdest1 = 0;& m7 @, w: L% x( J0 ?% i
  71. dma_addr_t dmaphysdest2 = 0;
    , F% k. G( i% {, h
  72. ' w6 |! X8 D' d6 }4 l  t6 f4 ~
  73. char *dmabufsrc1 = NULL;1 f% j1 z4 S& U' z) X6 J$ C
  74. char *dmabufsrc2 = NULL;
    5 V5 H- b  d9 P# R) S8 i
  75. char *dmabufdest1 = NULL;9 N1 r  j) h: F# @" K+ y* z& L
  76. char *dmabufdest2 = NULL;, y3 @. l7 a# T6 [7 ?
  77. . l6 Y5 r* v* T4 B7 D
  78. static int acnt = 512;
    2 L) \4 ~( O7 \: S" z
  79. static int bcnt = 8;
    / g) C/ s7 n1 o
  80. static int ccnt = 8;
    ( y' k0 w- v+ f1 g, B

  81. & `5 P- l) Q* g) Y7 G5 I* Q
  82. module_param(acnt, int, S_IRUGO);. U2 D6 r: T4 V' y. ?- p+ f0 \
  83. module_param(bcnt, int, S_IRUGO);  o9 P5 n2 Z/ q% t! U  x) N6 ~" D0 f9 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( W1 N: R) e4 R, @% c
: C1 Q) b7 k/ J8 w' F! B4 @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, `! J  z; `( t) G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 S( y2 {8 ]7 c+ e% M, H# @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" c2 R, o6 s8 j" v+ d

' D0 t& a0 E* D9 X) C0 E6 M: X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 01:19 , Processed in 0.047654 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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