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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 d; ?  C. f+ o4 Y/ h' ~
  1. [code]EDMA sample test application0 D* K8 a- H2 k* o
  2. /*
    4 i! ?! }7 K$ f6 I+ m
  3. * edma_test.c6 i* w3 [0 p6 ~9 c! t
  4. *( f/ }- d8 K- U+ t1 g
  5. * brief  EDMA3 Test Application$ e1 s2 Q6 _' v6 j2 p' i6 m' O. s
  6. *) b# n$ @- y" m0 L0 I7 w
  7. *   This file contains EDMA3 Test code., [/ w) Z" M5 u
  8. *
    , U# ]4 H. B# j9 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* A- d. ^# D3 e8 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; C3 U' i* a" Z' m
  11. *         TO CHANGE./ G. T& k; j% x! H5 Q) z  I. J
  12. *
    9 J& m5 `+ S% v3 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " k2 g& a$ h) p0 b/ c2 n0 \1 O5 ]! j: ?
  14. *
    ' j! u4 ]6 u' m5 y. b
  15. * This program is free software; you can redistribute it and/or0 c0 Y8 b6 a# t: o. a4 u
  16. * modify it under the terms of the GNU General Public License as
    7 c1 W+ r; R0 Y5 ]2 }# l
  17. * published by the Free Software Foundation version 2.1 y4 U+ ]1 E9 c
  18. *
    * h/ u: W/ B8 I' I8 c" K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) \% y) Q& v; g2 G
  20. * kind, whether express or implied; without even the implied warranty; J) _8 F5 o+ p% [6 O5 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) {8 E1 W: ^% i+ ?/ }
  22. * GNU General Public License for more details.1 C) h- Y% f) w
  23. */5 a4 l. P0 W1 c) R# [6 `3 K

  24. + O/ T" Z, f6 l
  25. #include <linux/module.h>
    ! Y! u: \0 @% P5 l( w
  26. #include <linux/init.h>
    / {! I1 \: q8 B$ M* D
  27. #include <linux/errno.h>
    6 X. \  i3 q: V# c( R+ m2 s5 i7 S
  28. #include <linux/types.h>
    " O) b0 g6 _7 A
  29. #include <linux/interrupt.h>% S! g  N4 J  m+ r/ k
  30. #include <asm/io.h>
    ) \7 h8 E" }% _) k0 W  O
  31. #include <linux/moduleparam.h>0 N  X7 T9 B& \" P  l% ^3 Y
  32. #include <linux/sysctl.h>3 \- ~" p8 d9 ^6 B
  33. #include <linux/mm.h># k2 q2 x0 G' K) F
  34. #include <linux/dma-mapping.h>2 t* M; y+ ?6 t0 X% c# W( g3 T) J1 D

  35. ( C* e: A1 d9 W
  36. #include <mach/memory.h>
    9 V) {. i/ D9 _9 ^9 [
  37. #include <mach/hardware.h>
    , f  v5 A! _- l/ `) u
  38. #include <mach/irqs.h>
    ; Z2 B1 {. r( k  I: Z
  39. #include <asm/hardware/edma.h>% q6 t; p0 ^, G$ G: \
  40. : g  ~9 {3 d# W* y5 p
  41. #undef EDMA3_DEBUG
    " C$ r- b' X, C
  42. /*#define EDMA3_DEBUG*/
    , b# W/ q8 M9 W: I- Z
  43. * j1 f8 A! H- N9 C6 c% q
  44. #ifdef EDMA3_DEBUG
    : s. x( A- |4 _9 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( x' r1 a! O5 W$ t' L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 O/ r; B8 H3 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 T7 m  T" R5 j
  48. #else
    1 q9 }! Q+ @" I* x) l1 e, T
  49. #define DMA_PRINTK( x... )
    1 t) w7 U" P2 s  \9 Q
  50. #define DMA_FN_IN8 j. W) ?, d, U" G
  51. #define DMA_FN_OUT7 U  g) |2 i, [% [" e
  52. #endif$ f+ Z9 j. }# i6 h2 k

  53. + \$ F2 D) @; S0 \4 X5 ~% P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! |4 N! Q. |* ^4 w& z( a! l
  55. #define STATIC_SHIFT                3/ f+ ]6 Y4 |9 y! H! `
  56. #define TCINTEN_SHIFT               20$ @. Y. S/ h3 z$ _$ F; ^' a: l& Y7 q& T
  57. #define ITCINTEN_SHIFT              21- r. T! ~" Q' J# r" R6 S" Q9 O2 N
  58. #define TCCHEN_SHIFT                22  R) ~- K# b, w3 n( ~# [  b2 a+ p
  59. #define ITCCHEN_SHIFT               23/ }1 v$ ~  [8 g- W1 b  q( f
  60. ! Y1 C! @9 B, S6 r
  61. static volatile int irqraised1 = 0;2 _0 Q! W6 d4 U  Y. B7 C& E
  62. static volatile int irqraised2 = 0;
    ; T4 F" `8 k; D4 K! g+ _6 V% S3 |
  63. % w0 k: r# v. }# @' l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! O5 l) f! m# p2 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 {) @% H8 n5 ?5 v5 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z8 s7 x" U9 K3 I9 `4 k3 o
  67. 4 E( \+ x9 u* p; h* l; m8 u1 Z
  68. dma_addr_t dmaphyssrc1 = 0;+ R% y5 O# @* ~0 b/ k- O  w
  69. dma_addr_t dmaphyssrc2 = 0;
    3 M7 L( c+ _. E
  70. dma_addr_t dmaphysdest1 = 0;* Y3 T- {4 j; `3 c
  71. dma_addr_t dmaphysdest2 = 0;% Y1 j$ i% D3 w, Z  y
  72. * |6 r" R4 r3 U/ M
  73. char *dmabufsrc1 = NULL;
    7 {5 C- @, k4 y1 r6 B$ E
  74. char *dmabufsrc2 = NULL;
    " F6 t" f, }' P( H' d( w4 G9 ]8 j
  75. char *dmabufdest1 = NULL;
    4 l9 W/ n9 F1 w4 {1 \
  76. char *dmabufdest2 = NULL;% j3 S) t8 _! y. u5 F" a0 F; S

  77. % O; G) G$ E4 H; c% d( g7 n- m, M$ n
  78. static int acnt = 512;
    ) Q% A7 w9 I1 r' l
  79. static int bcnt = 8;
    " n: `; q( _6 Z6 P- _) R2 J
  80. static int ccnt = 8;$ l8 Y, u4 U( b8 C7 a$ ~3 v

  81. ) C0 B, T! p! Y' T
  82. module_param(acnt, int, S_IRUGO);3 V! M2 i  L  b
  83. module_param(bcnt, int, S_IRUGO);
    ! _: J! K  L- q# V9 x& Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( K8 x! v1 a. r* k+ @  z

; i' s2 k) r3 f1 Y4 \8 o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 j$ C% v- d5 ~% ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 p4 C3 I' j0 b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( g7 b$ D* h: M0 [0 p. y  @* n/ e, i- G9 r: R# Z

6 I$ K! R' |" z$ R$ E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-7 08:21 , Processed in 0.039688 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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