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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 R7 ~4 [7 _( L+ G3 r# ]4 F
  1. [code]EDMA sample test application. i* O0 V) r* V) Y5 D# d5 {
  2. /*- a; o- y% P; @
  3. * edma_test.c
    / n+ {2 f& c- n3 a' m. e+ j% i
  4. *
    + Z. p) F: J9 a9 m8 \9 }
  5. * brief  EDMA3 Test Application  K) T  _" L- Q2 L7 P# n/ D
  6. *; X$ O) q- b8 m# H" R
  7. *   This file contains EDMA3 Test code.
    ( h5 ~- H; i$ V- o, N3 E
  8. *
    ( K6 ?* h! m% i2 P0 E4 E+ Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( U% ~( z' P3 F+ I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* ~: n: [6 _1 P$ N
  11. *         TO CHANGE.% }4 t# m# I7 A0 g5 j' ~6 K0 @
  12. *
    " |' l/ L2 c$ Q; p# q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 Y- Q3 ?! ?* m8 c
  14. *
    + G4 o9 r' X5 o' K3 x
  15. * This program is free software; you can redistribute it and/or
    : D5 y8 c2 \) O9 `7 [% @- Z, Z
  16. * modify it under the terms of the GNU General Public License as! a, i2 |. Z8 o  k. ^( u. Q
  17. * published by the Free Software Foundation version 2.2 n* W' S' }. e7 Z6 l5 k% ~
  18. *  K0 q2 J' M6 l% ^* {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 `: G5 h5 W. T% k
  20. * kind, whether express or implied; without even the implied warranty; j6 N# y* I8 V0 j) [. n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & P1 \% j: L# U& [. ]
  22. * GNU General Public License for more details.9 Z3 n7 h) k0 B5 Q
  23. */0 l! o( a% L: \; S+ U# I
  24. 4 T2 ~  ], e0 ], l) [$ v
  25. #include <linux/module.h>5 G$ A6 }* A( Z$ k* j5 ^4 P
  26. #include <linux/init.h># x" Y3 t/ U/ J+ ]
  27. #include <linux/errno.h>0 c0 v+ I1 L" j" p
  28. #include <linux/types.h>7 e5 w7 L3 v9 h* k: Z$ X5 m1 Q& W
  29. #include <linux/interrupt.h>
    ! x5 `! t8 F2 s3 J% }
  30. #include <asm/io.h>' _/ b' s- E7 d+ _1 a; W4 ]
  31. #include <linux/moduleparam.h>4 r( x0 y: b! r2 p2 B
  32. #include <linux/sysctl.h>9 v. z( X9 e; K5 t4 s
  33. #include <linux/mm.h>
    1 C# t4 w( i- U' {
  34. #include <linux/dma-mapping.h>  q) D' C; ~9 S1 _0 ~

  35. 1 u6 O/ t# J! d7 v
  36. #include <mach/memory.h>
    7 _/ L; R- B* Z$ j+ w, \- |
  37. #include <mach/hardware.h>2 d6 f( i4 m; l' d8 L1 M' K% d& X
  38. #include <mach/irqs.h>
    0 H3 G6 S" E1 ]9 T4 w/ h# f
  39. #include <asm/hardware/edma.h>
    4 m  _5 u1 @6 O7 m4 }7 K' `! d+ `

  40. , R  Y) _$ O; f% `: ^, M' G2 `0 b
  41. #undef EDMA3_DEBUG3 u+ R' y3 S  |$ ^- j, v* q
  42. /*#define EDMA3_DEBUG*/& r1 W) ?- S3 f5 R7 S% ^' h

  43. 7 ?( Z# w8 V, S- t" j% V$ s
  44. #ifdef EDMA3_DEBUG
    * y0 ~( G. {$ J( r* d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 N. ?6 ]& i) @8 ~4 ]5 @+ R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : I% @) T/ D. Y! S, T. ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ t+ _* D: Q. N8 D& S# J0 T: c
  48. #else
    ' A! X5 y" ?8 @
  49. #define DMA_PRINTK( x... )
      w. t! _, |3 f% o5 F& q
  50. #define DMA_FN_IN
    - u1 P0 L6 G/ V/ h3 e
  51. #define DMA_FN_OUT' V! W2 @3 U  R, |
  52. #endif
    * x; g+ ?2 V- ?" r
  53. / R5 |( A& L& a1 H- `2 }$ n/ |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # h2 C7 Y+ v1 }$ I
  55. #define STATIC_SHIFT                3, J6 e2 a' v2 y4 N8 }
  56. #define TCINTEN_SHIFT               20$ m) ^; E" J+ V9 U  Q( x
  57. #define ITCINTEN_SHIFT              21
    3 g0 s, N8 V; z
  58. #define TCCHEN_SHIFT                22
    ! V5 y' r) q, i
  59. #define ITCCHEN_SHIFT               23# @8 d1 ]2 P' D# `
  60. ) }5 }" Q4 ^6 P% S4 W: M5 m
  61. static volatile int irqraised1 = 0;. ?' Z2 [3 u- C- M
  62. static volatile int irqraised2 = 0;. q) q+ m. b  }6 f

  63. ( ^/ Z+ j! n5 l7 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . N) F2 O# B' G% A& |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* E: D1 ?- G% L% l  P4 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 u2 [, o" p& R& i/ M' ^8 E

  67. - }/ X7 l  T9 v+ y, r* M
  68. dma_addr_t dmaphyssrc1 = 0;
    ; T! {+ D  G2 v1 e
  69. dma_addr_t dmaphyssrc2 = 0;
    - T$ Y) D9 X7 x- S( ^
  70. dma_addr_t dmaphysdest1 = 0;
    / p1 ?/ i& u& e( p8 m/ \) J: y
  71. dma_addr_t dmaphysdest2 = 0;/ \. G- s1 u5 z% ~: K' S

  72. - M0 [3 I( G6 i$ B8 {$ q
  73. char *dmabufsrc1 = NULL;
    3 T# I6 N' n+ ^# |, q1 @, Z
  74. char *dmabufsrc2 = NULL;  {  n" g& X  ~- r- a
  75. char *dmabufdest1 = NULL;
    ( B7 _6 e' r! ^/ h  |' K- t
  76. char *dmabufdest2 = NULL;& w. H/ W" ]# ]' V7 M1 m" l
  77. $ |# t. ]+ C4 l% d  Y+ n
  78. static int acnt = 512;
    , w& z. q- ^& A! r" Z+ |3 g7 t
  79. static int bcnt = 8;
    " `3 n) ~. `, C$ {* ~  G5 m( w
  80. static int ccnt = 8;
    7 }  x* M) M! c) {

  81. " d( R& V' O5 O+ o5 r: O
  82. module_param(acnt, int, S_IRUGO);+ K' X" F3 ]% F
  83. module_param(bcnt, int, S_IRUGO);7 V# T' [  y" `) Z5 b% N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ T, p* |6 H3 g

; [* X0 ]2 |5 \- o7 r, I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ j# m( g* _3 ~3 r2 m" I* z2 E4 L, Xarm-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 ?/ t) \1 y' D! w9 _1 ]: |; c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ r* i: E* p  N$ Y' N& @5 j$ c
- Q2 ]% F0 x/ J# B4 G: ~( C

1 l+ M/ {/ `5 e+ D9 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 15:50 , Processed in 0.037042 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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