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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' i* W  g: D/ f8 D
  1. [code]EDMA sample test application
    6 F/ ~1 m( h4 O" d$ X4 z
  2. /*
    , S- ]0 C* ]9 O4 W1 T( V
  3. * edma_test.c$ q' g0 c' k1 o+ u% V
  4. *' A6 O7 }; M0 w! w
  5. * brief  EDMA3 Test Application/ @7 y: f7 C1 V8 s% R9 M6 J2 |
  6. *
    & n7 t( X1 e- a) `8 e7 ~! C' {4 g
  7. *   This file contains EDMA3 Test code.
    2 t% A' f/ z) ~8 Y+ w
  8. *
    0 n7 p9 i& [$ p& T# t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & b) ~- n5 {2 A6 \2 g$ O# E* O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; I3 U+ E' ]3 d, C7 {
  11. *         TO CHANGE.
    ) x2 S8 x+ d; u+ D6 l
  12. *
    4 L. c7 B, T/ n% L6 T3 V8 c. r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 U' N7 a' U) Y, g6 d8 B) J
  14. *
    - e2 {$ B* K) M) Z- q6 G3 X
  15. * This program is free software; you can redistribute it and/or
    & ~+ b- C$ E, r
  16. * modify it under the terms of the GNU General Public License as1 v5 \% l, R1 Y6 p: J2 ^
  17. * published by the Free Software Foundation version 2.
    * E" F* c3 S( N+ }, Q/ r
  18. *; o- ~/ X% k% G6 T; j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( u5 `- n" {( b3 G* k& T
  20. * kind, whether express or implied; without even the implied warranty: d4 Y0 Z% n! X& B# k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; b& ^/ Q! J+ f. y, _: U! w
  22. * GNU General Public License for more details.$ P& }  W. A& l7 y4 Y3 D- G
  23. */8 b+ x5 W& z6 R$ b0 m3 z7 h* q. b

  24. $ M' X9 p- [5 s, I( A
  25. #include <linux/module.h>" g! d9 [$ w# l2 {, B
  26. #include <linux/init.h>* }% y5 ?9 P/ |  {' n8 y
  27. #include <linux/errno.h>
    . \- a- h0 r' j
  28. #include <linux/types.h>- T* ], w4 {) ]0 g' a
  29. #include <linux/interrupt.h>
      p+ x7 a" ]8 `
  30. #include <asm/io.h>8 o( X. H9 S6 n4 R4 |/ v0 }5 R" i
  31. #include <linux/moduleparam.h>) T! L1 X- W# O% K. o* W, {1 u
  32. #include <linux/sysctl.h># h: m9 a+ U2 `9 t$ E3 ~
  33. #include <linux/mm.h>
    & ~! A( U. G. K: ?  J
  34. #include <linux/dma-mapping.h>
      N: A1 G' g; r
  35. " a5 |9 {* |* O
  36. #include <mach/memory.h>
    ) ?5 Y: O. X: [
  37. #include <mach/hardware.h>
    $ ~  g$ ^5 ^1 p9 e
  38. #include <mach/irqs.h>
    - @" _% D) Q! c/ j3 `! c2 w
  39. #include <asm/hardware/edma.h>. a3 X! \4 U% \- @0 Y. [

  40. & g% H0 y, T0 g* X# z' h5 H
  41. #undef EDMA3_DEBUG
      L! I2 R* C4 P, S- b" j3 W
  42. /*#define EDMA3_DEBUG*/
      B$ \9 T( b! T6 H  F1 B2 h! W

  43. ) i. V( M/ l) n8 x8 R
  44. #ifdef EDMA3_DEBUG
    & T! P$ {7 O  g2 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 i! U8 R: A, i8 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 m7 [, X. [- C* A0 v3 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- l$ W# D) @/ T7 n8 \
  48. #else2 g/ |, `7 X& Q1 a' Z8 \
  49. #define DMA_PRINTK( x... )% c0 x3 M5 D9 j  i
  50. #define DMA_FN_IN
    & V# L) ^1 b, L( E- J" z  B# k0 V8 t
  51. #define DMA_FN_OUT
    3 w7 G, C0 S" A
  52. #endif
    6 ]/ S6 [) f/ ?

  53. # y% X9 P- Y8 F- [/ x% V  D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# l; @9 l4 _- U" A
  55. #define STATIC_SHIFT                3' D5 ]5 L$ A4 x' P+ c$ ^! Q' @
  56. #define TCINTEN_SHIFT               208 h2 c5 |3 V1 X7 [
  57. #define ITCINTEN_SHIFT              21
    # D; @+ r) n9 ~% Q% e8 \
  58. #define TCCHEN_SHIFT                22- F  C% n4 o4 p% ?' c' g
  59. #define ITCCHEN_SHIFT               23
    / s8 r( A" f- t; U' `! l6 I9 m( p

  60.   X& a: ~4 o  B. Z
  61. static volatile int irqraised1 = 0;1 p6 M! E* h% \
  62. static volatile int irqraised2 = 0;7 @) H! g( t5 J" J. W

  63. # w# z4 }3 J( r$ L2 M% n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 K8 `& H% ?0 _1 u: I% g& U4 k3 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ e' ^3 w, b5 U: S# O7 b  P6 _# T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 D! e( v4 I; Y4 s# {# N, }
  67. 6 u: l* d  Z0 Z# ^, X: E3 ^
  68. dma_addr_t dmaphyssrc1 = 0;- ^( O8 O- S( J0 R; B" t
  69. dma_addr_t dmaphyssrc2 = 0;
    ) q6 V; a- w" [) F# c
  70. dma_addr_t dmaphysdest1 = 0;5 e7 @3 V9 P8 j3 k' f6 g
  71. dma_addr_t dmaphysdest2 = 0;
    * ]+ {, X  M0 F& v3 w  s$ V
  72. . a6 ]/ P7 |. y7 g5 ?$ N+ `) ^
  73. char *dmabufsrc1 = NULL;
    7 R. `; n5 {& Y6 y4 Y( P
  74. char *dmabufsrc2 = NULL;. ?# a" \" m  s; t9 f
  75. char *dmabufdest1 = NULL;
    / U. T7 x& ^$ P
  76. char *dmabufdest2 = NULL;
    - F  M9 R; r5 ]1 _) H

  77. ) m8 C5 [! \" Y9 p4 W+ u# W% ]1 K6 y
  78. static int acnt = 512;
    ) E& J/ v7 K4 R& y9 G4 r
  79. static int bcnt = 8;2 }# ~( K: S) ~0 A
  80. static int ccnt = 8;
    ) V" L+ _0 {/ {! ~6 t2 h% G

  81. 8 y% Z- ?0 }# ]
  82. module_param(acnt, int, S_IRUGO);
    $ d# n$ b) g; [, X0 s
  83. module_param(bcnt, int, S_IRUGO);
    : V: s; Z" O7 g4 m6 ^: G* T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  t3 R, r- s' U) R9 a; [

* w' `4 q0 x/ z# a( ^' E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ g6 A; _$ Q/ r+ n# _% @. q, s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; W1 w. d& f2 ^8 I$ K' V: D3 d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ Z8 g% Q. K/ \/ \1 s
6 K1 b1 }- g1 p% _: U+ l$ n: t! v# z6 b6 E! g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 09:13 , Processed in 0.056659 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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