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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! |3 P* T- c- R
  1. [code]EDMA sample test application
    ) d& }' G3 }( F3 P+ G+ a$ z& F6 @
  2. /*
      L) Q1 E: `8 v- X. ~9 I7 Z% [% c3 S% q
  3. * edma_test.c
    7 f+ E, y3 r0 ?
  4. *: R( K, y# K4 T, h! ^1 `' S
  5. * brief  EDMA3 Test Application
    4 C8 J0 t; l7 b: c- K2 \: K
  6. *6 J  T$ x4 q0 }- J
  7. *   This file contains EDMA3 Test code., Z, X' w7 \3 s
  8. *
    ' C$ p/ V" Z9 m% H7 X' C. v7 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- K2 m5 z3 h% U/ g# ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. v( ~/ _$ A8 s0 D8 r' r+ r
  11. *         TO CHANGE.. P4 Z$ I! r- O: Z
  12. *
    ! |, F* t( f+ m2 L! t; A8 Q0 ?  I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 ~5 ^- `3 r. Q+ O+ O  M5 B
  14. *
    $ i0 ^, M' d" t0 W4 @, o
  15. * This program is free software; you can redistribute it and/or
    & k: W/ k/ k3 r! v* `, W: L( g
  16. * modify it under the terms of the GNU General Public License as
    - ?' B4 Q& w* p' Z4 u, G& S) O& O
  17. * published by the Free Software Foundation version 2.+ e* z9 O# X! L' N
  18. *9 q- N- K5 K: }2 v. `& g0 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 J0 V, e$ o' u7 F# A( m
  20. * kind, whether express or implied; without even the implied warranty! {. |! ~9 [" `: V4 O0 T$ U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! j7 x$ u; i/ J2 R( M0 n
  22. * GNU General Public License for more details.
    ( j) M1 N: J+ ~/ C5 v
  23. */3 q% `/ E6 z5 n: M
  24. & l' n) b& w$ w) m0 O
  25. #include <linux/module.h>
    : ~  g% K* ]" C
  26. #include <linux/init.h>
    $ ?1 v' g+ {  T) T0 ~6 K
  27. #include <linux/errno.h>& \$ m/ D: Y6 L$ i; t
  28. #include <linux/types.h>. j4 s  @0 ?( I# g! f. X- I
  29. #include <linux/interrupt.h>. ^$ f1 [' ^: l/ q! y1 A
  30. #include <asm/io.h>0 E; y7 j+ L3 @5 Y/ [
  31. #include <linux/moduleparam.h>
    ( P$ X( j0 M, s, O# w4 m
  32. #include <linux/sysctl.h>
    1 K3 L, ]2 T# Q1 q9 h
  33. #include <linux/mm.h>
    # u; y: n' x1 A  s
  34. #include <linux/dma-mapping.h>
      D; C; h* {5 U9 r. {
  35. ) o5 l7 ]9 p0 l0 K+ e- b1 V
  36. #include <mach/memory.h>
    ) j4 O; \. Q! V2 |( N$ N: k
  37. #include <mach/hardware.h>  {8 [/ ~8 `: C
  38. #include <mach/irqs.h>6 l" d4 l6 m3 q% s
  39. #include <asm/hardware/edma.h>
    " y; w( |" q9 r) W, H" y% ~' y

  40. 3 _! i* X4 t( b: g- f# }
  41. #undef EDMA3_DEBUG, R% d: i: r$ _: K: {4 U/ l
  42. /*#define EDMA3_DEBUG*/1 O6 {4 j+ e8 T  b2 c: n

  43. ! B/ i1 W# v! e' M0 R3 J
  44. #ifdef EDMA3_DEBUG
    5 e  d' {: [. O& l$ B2 h/ n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 p. Q: V8 J+ y5 Y2 f2 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 p1 B, q' f& ~, n( s3 w! {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 J. L7 m# S3 p
  48. #else3 z9 ~! B. U% `7 o0 M" U3 ]% [$ |
  49. #define DMA_PRINTK( x... )
    6 x3 O  ?1 V9 B5 _
  50. #define DMA_FN_IN1 H3 [. B! G5 [( V, F" `
  51. #define DMA_FN_OUT
    % g6 s3 j! B# _& P' ^5 N% T# F
  52. #endif: o# e! F( E& ?1 D# c; y
  53. ) }: z" E$ H& B) q% Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , U2 k" d( w/ d1 S; @5 I0 n6 u
  55. #define STATIC_SHIFT                3
    8 ?) ~5 s0 ^& J
  56. #define TCINTEN_SHIFT               20# R) q9 y9 G/ j8 [+ s
  57. #define ITCINTEN_SHIFT              21- [' V3 n2 W$ D! U5 H
  58. #define TCCHEN_SHIFT                223 g! K. J1 o7 v- t
  59. #define ITCCHEN_SHIFT               23
    0 z# b/ T! M3 B; U$ @+ D! c. W; f

  60. . c0 l* Q* ?) [* U. D9 }" D( F
  61. static volatile int irqraised1 = 0;' u/ B% q9 j0 N' b6 j% s
  62. static volatile int irqraised2 = 0;
    + {. h1 o' ?. e3 h" O6 y1 b9 z

  63. 5 s3 z, o! n6 Q' m) A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 I: t9 i& s5 x' I+ `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 R0 q2 C, k9 [: |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ Y) g" ^' R  ]4 B6 q9 {( B1 g
  67. ' c% m, o2 P7 h5 D! k1 v
  68. dma_addr_t dmaphyssrc1 = 0;6 x; @7 G5 o( m/ D
  69. dma_addr_t dmaphyssrc2 = 0;
    2 K. m: a& N' I! T: i
  70. dma_addr_t dmaphysdest1 = 0;% U' X, ~6 e+ ^. i6 S
  71. dma_addr_t dmaphysdest2 = 0;2 I* r2 F# v. H/ o2 g4 g
  72. ( e/ U2 B  H' x2 }0 Y/ ?8 B
  73. char *dmabufsrc1 = NULL;
      L9 f; e) k& G0 c  s
  74. char *dmabufsrc2 = NULL;
    2 u6 Y3 \  N% H- u
  75. char *dmabufdest1 = NULL;6 G1 z9 U; ^" u6 B) m8 m, ?' i, C
  76. char *dmabufdest2 = NULL;
    . _( c( C  G" A# e( Y

  77. 5 a( h9 g5 b4 n; c/ i
  78. static int acnt = 512;
    ) I0 L* P+ e( q+ ]# C+ t
  79. static int bcnt = 8;" k/ l' [" ]5 n. C7 s/ g
  80. static int ccnt = 8;
    ! f0 c) r/ w; P: U% H9 y
  81. 6 ]3 x! L6 U* ?1 x
  82. module_param(acnt, int, S_IRUGO);
    + L, k; v; W3 A$ u$ Y
  83. module_param(bcnt, int, S_IRUGO);
    ' t0 l( A& E4 m0 y+ _- d% h' h5 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, X* l  a/ F5 N- y0 z
  g% K- r7 w9 m. R# h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ]* }: [9 l  m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% d2 u* R, D. m9 S& M) k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- t' p! Z8 K+ V

- W/ o6 g' W$ i3 z! C; ]: O
2 m( ^+ v% `% F5 e# J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 07:39 , Processed in 0.038409 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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