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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 {* T: P5 _# [( M% ]; t5 X5 X; o
  1. [code]EDMA sample test application
      f; k6 p6 B( C6 v% z3 m6 @0 W
  2. /*
    $ t+ k$ \, U' f( B) ?1 Q
  3. * edma_test.c+ y4 v& f* Q; n+ U; I' `
  4. *
    3 Y" D2 s5 e( I' E. u, u
  5. * brief  EDMA3 Test Application& \. g, J% v% E5 }- \6 q! g
  6. *
    0 m& [* T# y  ^$ J* q
  7. *   This file contains EDMA3 Test code.
    0 j7 O& V/ U; v! I1 `; M
  8. *
    ! V$ K( |) s7 h0 o' Q6 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! |$ b1 f; w2 @* B7 ^- \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! _/ y0 T7 J; w" u
  11. *         TO CHANGE.
    # H! o9 E3 o. y
  12. *9 y$ J4 h* C& f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 w" i2 _. o5 R* L1 ~" ?
  14. *
    6 K; D6 [0 V8 m& w, g
  15. * This program is free software; you can redistribute it and/or7 R4 h' `. W7 [: b
  16. * modify it under the terms of the GNU General Public License as
    ) y# I7 h( ?  {& W
  17. * published by the Free Software Foundation version 2.1 R7 u( Z! N" V  K1 P8 F7 [- [  s
  18. */ E: v6 p& j3 _3 \/ i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , [+ j' P3 p; ~( F. O( l, H& q
  20. * kind, whether express or implied; without even the implied warranty
    6 O7 M$ n9 J: V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . e6 F/ Y4 u, p3 m+ N+ o( j9 D1 M! c
  22. * GNU General Public License for more details./ {: a; b( q0 a$ G( K% R
  23. */
    / `" V- `+ j% ^' _' M4 `# }

  24. 3 u) k! w! f% W- o" Y/ @' E; A
  25. #include <linux/module.h># a7 u2 x. `3 v& g9 ^( i
  26. #include <linux/init.h>! g, O8 R  X  j" q
  27. #include <linux/errno.h>
    8 [, j2 w& X! f1 U2 W3 U& C
  28. #include <linux/types.h>; M/ P  S% C: C3 H  k( k- K9 G2 W
  29. #include <linux/interrupt.h>
    : @0 g2 @: z4 S0 U
  30. #include <asm/io.h>/ f9 D5 v+ J1 u- }
  31. #include <linux/moduleparam.h>! x/ a6 I0 S  S( j
  32. #include <linux/sysctl.h>! v2 L! v. b' b5 A( s' Y; N
  33. #include <linux/mm.h>& h! |# t6 F& N3 g
  34. #include <linux/dma-mapping.h>- |; H$ T* @* r* M1 A5 Q& j( j
  35. 0 J9 y: Z* g6 k2 H
  36. #include <mach/memory.h>
    ( ?' x6 o0 V. V
  37. #include <mach/hardware.h>1 c- S, [; Y' B, `# B, q# _
  38. #include <mach/irqs.h>, I: K# K* l2 }) ^7 G
  39. #include <asm/hardware/edma.h>
    6 b& l! v" Q" E$ c) d3 t
  40. / k$ \' [' T- z- I6 Q' U
  41. #undef EDMA3_DEBUG
      R: G3 H1 Z: x& A  u1 J- S
  42. /*#define EDMA3_DEBUG*/
    1 |/ A! V+ z9 ]) m/ R' M% S9 g- [0 j
  43. . [/ w  j* I' _: ?1 V
  44. #ifdef EDMA3_DEBUG
    + N4 g8 `1 R3 G5 I4 [2 C9 d9 P8 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 A  e, {0 @. r. J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& y  _0 P# L: x$ L5 ]4 a( \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! X* d; `( X1 V2 R+ f6 h
  48. #else8 o! u/ _' q9 K2 O8 k! G; o# d
  49. #define DMA_PRINTK( x... )
    0 z+ F& K3 \9 k9 j
  50. #define DMA_FN_IN: Q' k- `6 j+ I/ o- n( X
  51. #define DMA_FN_OUT
    ! i& f  p! b0 W4 z
  52. #endif
    7 P; ~" T; b/ T! e' A' [
  53. : Y1 k$ M% d# F: {; h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * ]/ ?5 ]5 S* |; o1 ^. @( f( P
  55. #define STATIC_SHIFT                3  h4 D. \" y6 v+ A
  56. #define TCINTEN_SHIFT               20
    - L2 F" `" ?8 L! G5 g- P- G6 h
  57. #define ITCINTEN_SHIFT              21) C# Z# R& n* K8 _; P3 l) P8 V
  58. #define TCCHEN_SHIFT                22
    5 W* k  ]1 C7 m1 w5 Q* m8 g( L
  59. #define ITCCHEN_SHIFT               230 L2 P- o& d  m" k- g
  60. ( T. w* J/ r0 R
  61. static volatile int irqraised1 = 0;
    3 N+ H3 g. w) ?8 ^4 F) g8 f; l
  62. static volatile int irqraised2 = 0;  T* Z6 S4 V- E8 |. W1 s

  63. 6 O3 g. y& L# X( @1 d/ {7 I7 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 b; `$ B: k6 L2 h$ D  u7 N9 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + }# a# e! F! i. S7 T  w8 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & o* ]! v/ v% r; r7 {

  67. 9 Q  N4 P9 D  j. V8 {+ h
  68. dma_addr_t dmaphyssrc1 = 0;6 B) G6 Z% c/ M9 t8 X% }/ \/ B& p5 t
  69. dma_addr_t dmaphyssrc2 = 0;
    & s- t. f. ~$ u5 b+ S
  70. dma_addr_t dmaphysdest1 = 0;! E+ m) ^  \0 h+ {# E8 N2 e
  71. dma_addr_t dmaphysdest2 = 0;
    7 S- i% v0 k! `3 c8 P& ?
  72. ! Q3 G0 J( R0 n, i- k9 U4 y
  73. char *dmabufsrc1 = NULL;3 @& R) o% L8 |' I! R0 f5 z' r
  74. char *dmabufsrc2 = NULL;/ O5 p3 ^1 z: b  m4 V. d8 j
  75. char *dmabufdest1 = NULL;* m# \( s% N7 t! y5 Z9 p
  76. char *dmabufdest2 = NULL;% h2 n8 `* F3 e% e4 m) ]; z/ q
  77. ! Z" ~* B/ h0 u! o9 O
  78. static int acnt = 512;
    0 b/ n) F  [% J7 w1 K
  79. static int bcnt = 8;
    2 S# }% U' Y2 a# G) L# x
  80. static int ccnt = 8;% S; N& h$ c+ m
  81. 7 t$ V5 F/ L, b( v
  82. module_param(acnt, int, S_IRUGO);7 p' _, D6 e  M) B, X. i- [7 K1 k1 y9 n
  83. module_param(bcnt, int, S_IRUGO);
    % m" w+ S1 S5 D; X' s7 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. @5 o3 t8 F. ^$ J7 t/ ]

3 e9 ?6 }3 K% r$ D9 |7 N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 K9 i6 f: {7 v" F) Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 H# M# x) [$ S' ^% B& Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 C1 X( c- q9 o! g9 Q
* ?0 c4 g' n& ?, [& n' i

- B% _* r+ t# d3 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-21 02:34 , Processed in 0.036209 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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