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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + [1 ~+ s! y& O, r# m% H, d
  1. [code]EDMA sample test application
    : [3 ^4 f: t- `  P; K
  2. /*: l0 }+ _7 G  G) T; A
  3. * edma_test.c4 }) \- u1 c0 f9 ~* O
  4. *
    9 s2 q, p$ q3 N% ?% d1 |' J: s/ F
  5. * brief  EDMA3 Test Application; L! h+ K( j* u0 K3 p
  6. *
    ' m# O! r8 ?7 r0 G
  7. *   This file contains EDMA3 Test code.
    1 j& Y! g' |1 J1 i
  8. *1 q# _8 X+ v% M, B3 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . J' A5 \, `4 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 Q! ~: j. u' t0 k! J
  11. *         TO CHANGE.1 Q* n9 X. |. d4 d
  12. *
    / N0 l: T6 p. q* ]% i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 U  u+ z1 S, }" ~7 |) Z3 T
  14. *
    # w7 Z/ Z/ C5 Z  _+ e
  15. * This program is free software; you can redistribute it and/or
    / n8 J' ]* k+ L  ]( W! L' U8 r: I  j
  16. * modify it under the terms of the GNU General Public License as. L; a9 L1 D/ {% K* @0 o0 Z
  17. * published by the Free Software Foundation version 2.
    2 L& Y; Z0 o1 X, S$ Q( y9 N) G
  18. *
    $ J& G/ k9 A5 i' s7 A' E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) ^7 W9 A6 c1 Y; \- s) O: d
  20. * kind, whether express or implied; without even the implied warranty
    4 l( u+ C- q8 l7 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , R+ V4 z: E$ |4 I# i9 _: s! L
  22. * GNU General Public License for more details.' i/ d, N6 d2 s; k: p% p! K- b
  23. */
    $ Y3 m! G  ?9 s8 M8 V) n2 W9 c
  24. 5 h4 Z# p# N8 a
  25. #include <linux/module.h>, V  U5 D$ G5 n4 z9 |& c" }: X1 r! b
  26. #include <linux/init.h>
    ' i% l* N$ F" F1 L" f, x
  27. #include <linux/errno.h>
    1 P9 q! E% |2 _! {5 L+ G# D
  28. #include <linux/types.h>4 g/ Q/ N0 P1 S/ ?& ^
  29. #include <linux/interrupt.h>; y% u! e$ U- T! L: y
  30. #include <asm/io.h>
    . B/ w/ b6 z% L9 `* I0 a6 S% k
  31. #include <linux/moduleparam.h>. r5 k% a" o  N8 [' q8 L; X
  32. #include <linux/sysctl.h>
    6 c+ l1 w8 v, B) e, C5 A. c
  33. #include <linux/mm.h>
    , Y1 }  ?0 }; }! ^
  34. #include <linux/dma-mapping.h>
      c+ C+ V- o7 w- h5 a4 F' b: f

  35. + D, C0 P. `: w8 M9 R; x
  36. #include <mach/memory.h>0 z* |$ x# A6 W# v' |
  37. #include <mach/hardware.h>* U+ G- `7 b. l- i! A2 n
  38. #include <mach/irqs.h>
    + u- f9 q# j+ r" n
  39. #include <asm/hardware/edma.h>% D! i0 ~; [  F/ n& V7 Q$ f
  40. 2 |1 K/ o4 k  R9 I' Q( b( m& Q
  41. #undef EDMA3_DEBUG
    ! j. v9 Z$ C! r. y7 m
  42. /*#define EDMA3_DEBUG*/
    . S3 z* s* ?- Y! J+ p

  43. " ?5 ^, c) J+ E! s; b/ E
  44. #ifdef EDMA3_DEBUG
    " z7 [5 ]$ B; m- q5 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 r! U% K7 ]. q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 n  e  S6 }. l6 ^/ F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # M$ Z! `4 F+ i8 T. k6 R% G  N! T4 c/ |
  48. #else
    7 |+ `/ _$ U$ y: Q. z
  49. #define DMA_PRINTK( x... )
    " u* `- `  P2 S% E
  50. #define DMA_FN_IN
    ( p& f# g  V/ Z- M& N: h
  51. #define DMA_FN_OUT9 D; y* }) n! ~& @( A
  52. #endif) w: O; r, t" `1 D2 [% J
  53. + q% i2 @/ o8 Z5 ~+ T4 O; ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  e1 n) X1 |' r. S# Y. C
  55. #define STATIC_SHIFT                3
    3 |7 p# X9 i4 E3 }3 T: n" D
  56. #define TCINTEN_SHIFT               20
    ; @& E" O( g* V
  57. #define ITCINTEN_SHIFT              21! z) Q. V$ l$ `9 c! n  a: G4 d
  58. #define TCCHEN_SHIFT                22. S) g9 M/ {; |4 Z- R. V- z
  59. #define ITCCHEN_SHIFT               23
    ( }+ O; E0 J8 ]

  60. 3 R5 \8 M2 A8 D( ^
  61. static volatile int irqraised1 = 0;
    $ t. D5 L4 c: @, i# L% Q  `
  62. static volatile int irqraised2 = 0;+ u; _) x  d* Y) W1 o* Q
  63. 9 @4 M% x/ j* t% ]0 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  _. N6 @4 x& h- d) Q" ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ?: w) K( }4 B7 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 H3 [: q4 Z% V' i2 i( C
  67. : [' z4 Q( O* W: g$ x3 j# |5 D$ S+ |
  68. dma_addr_t dmaphyssrc1 = 0;
    + e6 \6 ]4 B+ X
  69. dma_addr_t dmaphyssrc2 = 0;  D% |! D  G4 P) y) k9 u
  70. dma_addr_t dmaphysdest1 = 0;
    & s8 d  T# U7 q3 m# a. B; G9 d0 @
  71. dma_addr_t dmaphysdest2 = 0;: w# \+ L2 g4 b+ f; ?
  72.   e! r; B% Q1 s$ _7 |- s2 J
  73. char *dmabufsrc1 = NULL;
    1 }' ~0 p* q: I
  74. char *dmabufsrc2 = NULL;
    ' q8 j4 W; L4 R1 `6 f0 y
  75. char *dmabufdest1 = NULL;
    1 s. {: U; F( b. \
  76. char *dmabufdest2 = NULL;
    0 y. U4 F+ L3 ]* \

  77. / h' p2 X$ Y4 c  V. t7 D; s
  78. static int acnt = 512;
    + M2 R* I* [, M8 @# J+ _. o0 y
  79. static int bcnt = 8;- M  K, i7 i2 Q1 {9 K; C7 r% Z
  80. static int ccnt = 8;, O7 a& K: }5 {( c+ k
  81. : q+ E' w5 N2 P% S/ e
  82. module_param(acnt, int, S_IRUGO);, ^/ e, s, B1 T& v1 [
  83. module_param(bcnt, int, S_IRUGO);
    , @0 C8 [1 }+ s3 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( f8 N6 q  \$ X/ V6 j

, v1 A% R/ d9 J& a; v7 \5 ~) k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 I: w- |' B) S6 g. `7 N) y( j8 _% oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 P( h$ |- J- E0 M& s  i. f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( |+ a1 [  P6 E- S+ ]; Y

2 e7 Q% E9 N' R6 i0 e' R. m- B, ]1 n8 t5 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 11:59 , Processed in 0.043224 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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