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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* E  m  ]7 K! H9 S( h3 @
  1. [code]EDMA sample test application0 B: D: a, l7 |* {8 i2 `
  2. /*6 y/ A. `5 d: N! ]1 v( x- a6 @; ~& ]1 U
  3. * edma_test.c* S9 a8 P- g$ Y4 w1 b# o* k
  4. *
    . S& @8 N* W* b# B6 A, _: t  p
  5. * brief  EDMA3 Test Application
    5 K, v& E3 g) I/ K7 ]4 U$ _
  6. *( u9 ?( |5 P( ]/ ^
  7. *   This file contains EDMA3 Test code.; E# Q) @( E9 g" L0 n
  8. *
    $ \- c, S1 [/ K7 V; B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * I8 ~  s- |. V4 J% T5 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# B- Z& A/ F; l( f0 B# p' K, n  J
  11. *         TO CHANGE.
    7 v3 ~: Q- v8 p
  12. *9 M' m* \$ K* c' Z1 O( a# m' K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , w8 d; r5 J3 t2 M) d8 t
  14. *# \& D7 _9 b: L6 q
  15. * This program is free software; you can redistribute it and/or  M0 u( z2 k8 a  n0 d
  16. * modify it under the terms of the GNU General Public License as
    * t6 u5 [4 Y9 o
  17. * published by the Free Software Foundation version 2.( H) q9 T( ^% X( K! X0 W
  18. *
    3 m0 x- f" h& }/ f, Y" {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - c% V% F6 \/ q
  20. * kind, whether express or implied; without even the implied warranty" H, X* U/ i" z" h! x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; K9 t4 q3 r9 N' t% o0 {
  22. * GNU General Public License for more details.
    3 h2 i8 r6 G0 \5 |3 l# d) A' h
  23. */: I  x  k  V# J5 z/ t9 `
  24. 3 ]6 O. L: j/ G( J6 w
  25. #include <linux/module.h>
    7 x, |* c( Z3 b8 Y
  26. #include <linux/init.h>% j4 u3 S3 R$ ~0 Y
  27. #include <linux/errno.h>5 M( K8 N1 Q4 \  O6 h
  28. #include <linux/types.h>/ L" E/ ?4 N3 ]7 g5 Q
  29. #include <linux/interrupt.h>
    # A7 @5 |* p1 z! C
  30. #include <asm/io.h>. t+ @3 B* P) j. y9 Y
  31. #include <linux/moduleparam.h>
    5 N+ J9 g+ ]: n/ T4 n" V
  32. #include <linux/sysctl.h>& Y, k& [8 @" H5 V& c5 [. S; v) `6 N5 t
  33. #include <linux/mm.h>
    ' t, @3 ?$ U$ `9 e6 W* m  P
  34. #include <linux/dma-mapping.h>
    . f  {1 D& x' l) }$ Z# }2 O  D

  35. 8 E. p4 S: o$ K* |% }" Q* Q) S
  36. #include <mach/memory.h>; O5 b2 N$ \2 y% `
  37. #include <mach/hardware.h>
    2 [% |4 D! j0 S: \" I/ C9 m
  38. #include <mach/irqs.h>5 k8 ]1 q+ ?  `0 m: a' G
  39. #include <asm/hardware/edma.h>! N; l# L' T/ U0 ]; S5 }
  40. ! F- [/ i% d+ T( `3 w/ S
  41. #undef EDMA3_DEBUG' d6 u2 @; b5 T* W9 u
  42. /*#define EDMA3_DEBUG*/
    * i6 U/ `: o- j0 i/ o+ @& Q3 t2 B' w
  43. " e5 r% A9 b* g& e( O% z. d
  44. #ifdef EDMA3_DEBUG% e$ M/ K6 ^1 s: w+ ^) ^9 D9 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); X; ]# z7 H* @" e& U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) A. i; G0 v, }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( O% s, W# C* R6 A
  48. #else4 O; E. L9 ]% ]$ l5 g" }- K
  49. #define DMA_PRINTK( x... )+ l; v+ t: [% e, T: C' V' Z% ~2 \
  50. #define DMA_FN_IN/ L3 |) f3 Z0 O" r) X
  51. #define DMA_FN_OUT; z# @4 ~% Y- I3 L
  52. #endif. O/ G- O- l6 r- g, w4 E& b

  53. ! o! @8 z! r! a' N( l3 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : Z" M5 p* s: z4 I5 O6 R( e
  55. #define STATIC_SHIFT                3& h2 u  E2 ?5 l" h+ S2 U  @6 R$ f
  56. #define TCINTEN_SHIFT               20
      n/ \; e! h1 s- A  g
  57. #define ITCINTEN_SHIFT              21/ C/ S" f6 e% s( Z7 u4 Y! N* S
  58. #define TCCHEN_SHIFT                22
    - }- g, ^( _* y
  59. #define ITCCHEN_SHIFT               23
    * r+ M& Q/ R# I

  60. 4 Q; D) k3 |1 |" v4 j/ l2 V
  61. static volatile int irqraised1 = 0;
    * r# w1 L) ]4 e  h( }, q4 w; X& U
  62. static volatile int irqraised2 = 0;% F* p: P" O$ L# v
  63. " _7 e/ F: G$ `* h# V# y! Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' `7 _- F# U) D& R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + M7 f( |( f5 c3 s+ W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / D' T* D# p- H8 H+ X& d

  67. # |, K1 f4 t: \* C, O$ x5 U
  68. dma_addr_t dmaphyssrc1 = 0;
    ! O" V$ {" w/ L6 \
  69. dma_addr_t dmaphyssrc2 = 0;
    $ F' M" M- R* W6 K1 Z% V  d* S
  70. dma_addr_t dmaphysdest1 = 0;
    ( w) I: Z% e: O7 o6 K$ C3 M2 e: M
  71. dma_addr_t dmaphysdest2 = 0;9 \$ V. X: \2 n( L2 k; a2 ^

  72.   M  ?5 L. t: U; d4 Q$ _8 }
  73. char *dmabufsrc1 = NULL;
    9 C, l( `9 B( p/ t
  74. char *dmabufsrc2 = NULL;# H0 D- @4 ^6 y0 _
  75. char *dmabufdest1 = NULL;5 ~- l' j; y) x) S' m, N
  76. char *dmabufdest2 = NULL;
    - G5 g9 \* M) F# \  D! ~
  77. 8 {' G/ _1 d6 N* ^+ L) T3 R: G. G2 g9 ?
  78. static int acnt = 512;
    - L/ C. V- o0 s, \# m4 s2 g6 r- N
  79. static int bcnt = 8;
    ; O1 g5 V1 N' `/ N- s# a+ \" E" r
  80. static int ccnt = 8;
    * L, @5 X( u0 s" X. Y* I: }+ S. v- r

  81. + p% ^) f' Z# h, g( a
  82. module_param(acnt, int, S_IRUGO);( N" O' F! G/ q" H0 d. Y- {$ N, s
  83. module_param(bcnt, int, S_IRUGO);9 u9 i- n& E$ o4 Q  @" ]+ p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 q! o' S$ V  J
" q0 @( d3 z; o8 {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ k6 k. ^3 ^! L  s4 j, g1 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 q, c9 k+ t/ v2 i3 S% M- O# C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' S' d8 ?$ U0 i( a
1 f6 G; m6 D' Y/ O5 M
* G* [9 b: X! d( @2 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 13:56 , Processed in 0.041558 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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