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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! N* a$ I* M$ w. {
  1. [code]EDMA sample test application3 f6 T: m) F3 W9 D: S( B) T
  2. /*" H! M( c1 L/ J3 o1 R
  3. * edma_test.c
    ! e0 K3 }4 H: |+ W2 g
  4. *
    8 k' x# b9 w7 o  ]1 C( p& v# v. M
  5. * brief  EDMA3 Test Application6 B6 Z+ M# W8 P- Z- B
  6. *0 I4 g2 m3 j6 q+ e
  7. *   This file contains EDMA3 Test code.
    8 p3 R) T: N4 _
  8. *
    * G8 ^, @: [. s3 l0 [7 Z4 I8 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 k' e0 b0 G3 s4 k; e0 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # x& p  W! }$ r
  11. *         TO CHANGE.
    0 d8 Q" M1 [5 t6 f% z/ d
  12. *+ i6 e0 K3 f4 E8 O  `; x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* G+ ^' m8 H! T  S( S; t4 h! N
  14. *
    & i3 ?' s" y! K. n5 x
  15. * This program is free software; you can redistribute it and/or
    # e' v0 w7 w* s: [4 c( D
  16. * modify it under the terms of the GNU General Public License as
    $ d& F/ q9 U9 E4 b
  17. * published by the Free Software Foundation version 2.* Z# A1 j& E: i/ T, ]
  18. *, N: g1 \$ Y1 t! l/ q/ m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 L6 k, H' U  R! c; @3 J( J+ p+ D
  20. * kind, whether express or implied; without even the implied warranty1 `1 k- |0 H  l$ y; Q1 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ n' \3 p8 f* V' y' v4 A& x
  22. * GNU General Public License for more details.
    " M; V* [8 ~) _& I8 K# j6 s) T
  23. */
    1 ^/ J* d, u, `3 |) G
  24.   a, E0 N3 ]" E9 D9 v, w
  25. #include <linux/module.h>! n5 I* ^) J2 O' q* I  A% k6 m
  26. #include <linux/init.h>
    : d  n4 U, M* w% L
  27. #include <linux/errno.h>
    - n6 q2 S2 n3 R. M- y) k4 C
  28. #include <linux/types.h>
    $ C' h& u$ Q; Y+ V1 B5 C4 ^  V
  29. #include <linux/interrupt.h>, b1 w( T& W! x: x: P
  30. #include <asm/io.h>
    5 \4 v- N. M+ Z$ [, u& l
  31. #include <linux/moduleparam.h>( B2 X% q, g( C% M* P% ]
  32. #include <linux/sysctl.h>" p# T5 u; Y1 @4 I2 }. ]* _
  33. #include <linux/mm.h>
    - m7 J5 [) L4 U: S8 V) R- q3 R5 \
  34. #include <linux/dma-mapping.h>
    * S/ A; q# t$ }* ]

  35. 5 q& I3 p' L- ^  {; w& q8 V
  36. #include <mach/memory.h>
    2 R0 @' ]2 H6 P1 J
  37. #include <mach/hardware.h>
    1 h3 U6 U& e" K) Y
  38. #include <mach/irqs.h>/ @. y3 q8 U) J8 @& F8 K5 \
  39. #include <asm/hardware/edma.h>
    : S+ K8 O- k- ~2 M
  40. 8 Y& L6 P& Z. I" G# e$ o/ c
  41. #undef EDMA3_DEBUG
    1 y8 S" G/ X2 x; l
  42. /*#define EDMA3_DEBUG*/% m2 ]8 \2 Q/ ?6 L1 F

  43. 4 ^* ?! N. Z5 |5 n0 }# W7 J
  44. #ifdef EDMA3_DEBUG
    , w2 Q1 b2 z; w; I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + \' E- K6 M. ~# K+ E0 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); x- c) K, @$ r0 k0 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ y9 \  B/ _' D9 f* o, C4 n6 ~
  48. #else/ v7 m- o5 n* l/ @7 J
  49. #define DMA_PRINTK( x... )
    ( h+ D7 O+ R( o
  50. #define DMA_FN_IN
    : `) m% B& G' X* ]
  51. #define DMA_FN_OUT
    * o4 F; n, i1 B5 S
  52. #endif
    % }6 k6 ^; F/ I, A7 E
  53. # k% h. Z: {* a! s/ L* n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 B# i; w6 m+ g
  55. #define STATIC_SHIFT                3' g, G$ g6 B, `4 A( K
  56. #define TCINTEN_SHIFT               20$ U) ~7 {* S5 K( @# [
  57. #define ITCINTEN_SHIFT              21
      x5 r+ ?" }% J% F1 _" b1 F7 \3 @, {" z
  58. #define TCCHEN_SHIFT                22
    1 v2 ?. s% J0 m4 _! h( S9 o
  59. #define ITCCHEN_SHIFT               23
    ( \* d. `# j# T1 u4 e

  60. 6 g8 Y2 _) O/ m3 ?
  61. static volatile int irqraised1 = 0;0 r& M8 k7 R" m6 d0 w2 U: C
  62. static volatile int irqraised2 = 0;: F: t( o6 j9 `6 F" o: {

  63. ! K( S9 L* _# ~) q% l, }2 f* C3 t1 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# M0 L; Q  Z$ E3 d! X5 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) f8 N$ C# t* h# H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ Q# b) }' T! y9 n. @, [

  67. ' x& ~7 e8 ]( V* x" @
  68. dma_addr_t dmaphyssrc1 = 0;6 J8 w3 {3 q0 V7 B
  69. dma_addr_t dmaphyssrc2 = 0;7 J5 b6 J! u. K# m" N
  70. dma_addr_t dmaphysdest1 = 0;7 v$ I4 L% K; D7 s
  71. dma_addr_t dmaphysdest2 = 0;. T  r) O' t$ R
  72. & n  _& j3 T( z1 r1 S2 W$ M/ \
  73. char *dmabufsrc1 = NULL;1 F3 i1 g( \8 M, q) A
  74. char *dmabufsrc2 = NULL;
    ! K2 r6 u' n( H& w. Y  j0 b
  75. char *dmabufdest1 = NULL;
    ) e* X; W. l) S
  76. char *dmabufdest2 = NULL;  v+ D) d; N. W4 x0 ~

  77. % {+ |; L4 z& f# L2 v
  78. static int acnt = 512;
    # ^9 ?' z  W" |3 h" R
  79. static int bcnt = 8;8 p" \3 x' b4 E7 d2 B
  80. static int ccnt = 8;' L& @9 Q% r/ C; g: e
  81. # g# _/ w+ C+ c4 _
  82. module_param(acnt, int, S_IRUGO);
    . A. j7 y/ k8 Y4 C- K; ?* B
  83. module_param(bcnt, int, S_IRUGO);# `7 x# l8 ^. S8 D& F, @, `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( X" J, x: J3 A& D* C  I

, i' Z3 ?+ H- ~+ }/ Z  J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. D! ]# \5 R: X, h! v) K
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 t$ F% s  H& w* W: P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! I( G  z/ |. c4 r8 C; B: G* p: C! G2 p/ @: ?

( Y' o! h( l. r2 u5 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 11:14 , Processed in 0.047423 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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