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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 W1 U3 g. Z" y5 i
  1. [code]EDMA sample test application
    # E% l, H& ^' {/ l' T% A" x) L) }
  2. /*6 B# g7 g% F7 M9 u% Y0 B
  3. * edma_test.c. K+ r, V7 p: F% P: a( A
  4. *
      U8 z8 Q5 A. k' P8 u
  5. * brief  EDMA3 Test Application0 g! l' \5 p1 Y# d
  6. *
    . d. T" j/ X' L6 [- l- |
  7. *   This file contains EDMA3 Test code.. n2 c1 N9 I/ Y+ m1 R& h
  8. *
    " x4 z- t2 ^/ l2 d( |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ [" a4 n6 y$ ~4 o- ?$ j& a7 A( ~  R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 j% H, Y: {' b$ f# W& J
  11. *         TO CHANGE.
    6 _; A4 {+ c: U( N" v0 [
  12. *
    " C) l& Z8 \/ n% |0 x* c+ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      f- m/ f% w* H# }1 `
  14. */ z! I( P2 u+ Z- ^+ ]
  15. * This program is free software; you can redistribute it and/or$ }! \* r+ T2 g9 |
  16. * modify it under the terms of the GNU General Public License as
    ! f" N+ x6 w0 r
  17. * published by the Free Software Foundation version 2.
    / L: t% K8 y5 M. S- n
  18. *
    9 \* d7 F) o! A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  p2 o* b( n/ w: B9 l6 T% y
  20. * kind, whether express or implied; without even the implied warranty
    ; i2 |/ n) r! _3 r+ @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - S- I! G3 a/ b' E, V6 u# K
  22. * GNU General Public License for more details.
      G2 t1 p  j& S. z  N2 t: l1 a
  23. */: v5 F, O- e* s# D
  24. 0 l3 A; S3 M' H0 f) Z
  25. #include <linux/module.h>
    . ]1 T1 x& I" y- n! Z
  26. #include <linux/init.h>
    ! j' I3 d+ ^7 o
  27. #include <linux/errno.h>
    0 t8 F/ l' u( ]2 F
  28. #include <linux/types.h>
    ! {6 S0 Y9 L6 Y) O% h
  29. #include <linux/interrupt.h>
    + U; Y, e0 Q% T+ @& }# U- z! q
  30. #include <asm/io.h>8 Z" \7 C" [! }* F! S7 ~# j; ?, W
  31. #include <linux/moduleparam.h>7 w+ Y8 Q4 ]) w( y$ t! v1 G5 _1 P. V
  32. #include <linux/sysctl.h>' T$ U. v% c% M6 @; W8 ^
  33. #include <linux/mm.h>7 k* H( n6 @5 ~; w$ o
  34. #include <linux/dma-mapping.h>
    4 i/ L& P0 k# q. n8 u5 O& x

  35. , c, e$ r' t0 v- Q( w
  36. #include <mach/memory.h>  L5 z) t1 {+ X+ X: E( E" |
  37. #include <mach/hardware.h>8 d( D+ a" G, @! B- x" \% z
  38. #include <mach/irqs.h>
      s9 A5 @) T0 C' @
  39. #include <asm/hardware/edma.h>8 N: E3 U* N2 z* f/ {: V

  40. 3 v7 m) N# K0 R: A5 H) t& w
  41. #undef EDMA3_DEBUG
    $ {9 J+ W$ ]& s3 H: Z  N
  42. /*#define EDMA3_DEBUG*/; h' b3 k# x7 [
  43. + Q, Z7 z8 `1 p) I
  44. #ifdef EDMA3_DEBUG( V$ e/ l! s2 t( i- g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), y" o) L+ ^8 l# \& Z- k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; W* S2 {' a/ C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 ]) h' m) [) p* a# I5 e
  48. #else
    ( i: C8 g. [  ?" b* X
  49. #define DMA_PRINTK( x... )
    . m  T  u* W7 o% c+ L
  50. #define DMA_FN_IN$ y% ~! a$ i; u3 o" ]- c0 o: _
  51. #define DMA_FN_OUT
      i/ q6 c+ M% u2 C- d, `: J
  52. #endif
    1 n2 F7 N/ h! W/ }7 K+ D7 e8 Y# H
  53. * R; H2 X0 U2 W$ R3 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' l1 \' ]: ^! B
  55. #define STATIC_SHIFT                3/ F0 z; z# q, E$ o: A/ Z* |
  56. #define TCINTEN_SHIFT               20
    - J* @9 F) V* z2 r
  57. #define ITCINTEN_SHIFT              21
    ! l! c+ t" X# P
  58. #define TCCHEN_SHIFT                22
    - n7 L% ]3 S& {3 D( |
  59. #define ITCCHEN_SHIFT               23+ o7 k& l# R& }9 i% @; U& @

  60. $ t/ u. A( J; Z0 a
  61. static volatile int irqraised1 = 0;
    . y1 k/ S& o7 M8 m, M
  62. static volatile int irqraised2 = 0;0 u% i5 R& k& c3 D' p) U! F

  63. 0 Q, R9 g2 O+ G3 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & k1 o! s; v8 }1 ]) p0 m. q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ?0 E5 [3 h" }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; v9 k7 @- G+ o% h6 P7 b/ l

  67. ' R- q1 r; f4 Y5 V
  68. dma_addr_t dmaphyssrc1 = 0;
    " v) S& q1 |/ ?* N# F
  69. dma_addr_t dmaphyssrc2 = 0;/ W5 O8 e4 A1 y7 N: ]
  70. dma_addr_t dmaphysdest1 = 0;. q* E; }% Y5 h# I3 y: @4 q' [
  71. dma_addr_t dmaphysdest2 = 0;
    2 M" n0 O; f7 {5 n4 U
  72. , b0 z& m$ V7 e' D. X7 U, @
  73. char *dmabufsrc1 = NULL;2 j( R' x/ z- i: t& H
  74. char *dmabufsrc2 = NULL;
    * T/ g; O. M$ G) P8 N
  75. char *dmabufdest1 = NULL;
    ; W4 C" o  P! e
  76. char *dmabufdest2 = NULL;8 m8 Z+ P0 U) I/ M. J

  77. ) x8 U5 }5 ?1 r" V% I: }
  78. static int acnt = 512;
    ( a% z8 v, h" |2 v5 [6 d1 N
  79. static int bcnt = 8;
    ; N; _- @' Z. ~: ^% t+ B
  80. static int ccnt = 8;
    ' @6 G! }0 z+ O& H
  81.   ~( R0 _. }8 O# N
  82. module_param(acnt, int, S_IRUGO);
    " ^- I' k# r: Z
  83. module_param(bcnt, int, S_IRUGO);) s3 K: M- S+ S$ p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  s; B: x1 f0 ^# \4 p2 r4 C/ a3 N  y0 ^* {- Q, w. n* C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 P/ r) _8 `8 Z& @0 N" F1 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& r! J3 |0 v: L% e& h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 x: k3 i+ [  i, ?' T
! ~* ]9 l( }2 T; k# Q5 t
9 f+ T# J4 p2 L) }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-20 05:51 , Processed in 0.047075 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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