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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; {4 k# q# ~# M. m4 P8 I( U4 y
  1. [code]EDMA sample test application
    $ z$ x& P; V" t5 H
  2. /*. ~7 A, c+ ^% |. f# R! o
  3. * edma_test.c( K5 K! _+ W4 T, _( a7 x/ D6 A& `! \
  4. *
    ; n" O" v% K1 r% l- O2 O
  5. * brief  EDMA3 Test Application
    % e* g( k  n8 t# G
  6. *
    1 E+ G8 R% H( D: Y
  7. *   This file contains EDMA3 Test code.
    , D3 f7 c0 _; ]  j4 R4 r' \
  8. *
    : Q* D  I% ]5 J! e$ \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 c# N  Z/ s) X  z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # q/ \! \. J; {7 _* X
  11. *         TO CHANGE.
    5 n  A/ w' w: M0 ^0 q3 n
  12. *7 v: u2 a5 i# d  o6 K+ z; i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " v' k: ]# e0 M& \: c/ Q
  14. *
    8 }: T! v9 l/ K$ l# B
  15. * This program is free software; you can redistribute it and/or5 x0 q& V+ e/ j% [! g" D
  16. * modify it under the terms of the GNU General Public License as
    8 B: r8 G7 f' W' N3 M
  17. * published by the Free Software Foundation version 2.* _" J! f1 |" H% n1 b$ k' j
  18. *9 N- [& R# I/ ]; y" \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . H% [, e6 a- s7 {
  20. * kind, whether express or implied; without even the implied warranty
    $ v# R$ ~$ O9 r! ]5 S* a) D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 V# M# l; L8 E- u5 v5 j. @
  22. * GNU General Public License for more details.
    0 [( l) T' G$ D9 r; e
  23. */9 V# }- @1 F" M1 T, I: j- D# c

  24. 2 H5 N: z2 d4 v% C( }' ]
  25. #include <linux/module.h>" ~: i# M& w9 Y. n; N
  26. #include <linux/init.h>
    ; Q0 ]/ w7 N, W
  27. #include <linux/errno.h>
    ! i% v8 [! O! ^
  28. #include <linux/types.h>3 r* s9 P1 U) R  c: O; k
  29. #include <linux/interrupt.h>
    5 P5 q. Y8 D  f- ^0 Z. Y
  30. #include <asm/io.h>0 I2 ]: a& K; \9 v# W( C# q
  31. #include <linux/moduleparam.h>/ L8 N9 y  N' y2 O  o
  32. #include <linux/sysctl.h>) X( n' ]" V7 m' V+ H6 q
  33. #include <linux/mm.h>
    3 [7 {& ], C( V, A& T
  34. #include <linux/dma-mapping.h>
    / `4 ~! R; }2 s9 b( _: c& I

  35. ' P" D& f) T0 O/ y5 s1 A
  36. #include <mach/memory.h>
    7 n1 M+ |, V- _; o9 v8 k
  37. #include <mach/hardware.h>
    , S) V/ u% k3 u2 p
  38. #include <mach/irqs.h>/ n+ g3 @+ |  K3 n  s
  39. #include <asm/hardware/edma.h>
    ' E. @, y& c+ Y% F/ @* R

  40. 1 Y. I. z, Y3 t; s: ]6 t
  41. #undef EDMA3_DEBUG" t" s5 \6 E! m' Q0 V8 q, e
  42. /*#define EDMA3_DEBUG*/! c& ]- \$ U# ^5 R( u( v: ^  k

  43. 9 a" ?. _! C! B/ ]. d" ]4 {
  44. #ifdef EDMA3_DEBUG: z) i' ]* N9 t' \( t2 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + ~9 _7 T  I* n0 P, u6 e9 u; Z! |$ C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % W8 v. M0 ~; k0 x( r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ x  E% K5 W; T( r) r
  48. #else
    " v1 J0 f3 G) J5 F( B3 `$ S
  49. #define DMA_PRINTK( x... ): e$ O3 |/ j3 t0 ~
  50. #define DMA_FN_IN" r, Z- b# F- \/ j
  51. #define DMA_FN_OUT3 R5 e) Y' `9 C9 [
  52. #endif4 `- l+ v" {7 U; @

  53. * ?  t0 H( q7 n$ }; `; o% u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 `: F% U; L: [* g2 p5 x
  55. #define STATIC_SHIFT                3" U. I/ m+ S( C( S8 a( _
  56. #define TCINTEN_SHIFT               20; }8 Q) e9 E; r
  57. #define ITCINTEN_SHIFT              210 D# o/ \2 ^$ |( E. b( c
  58. #define TCCHEN_SHIFT                22, f6 P8 O/ p+ |2 I2 ^& x7 ?
  59. #define ITCCHEN_SHIFT               23
    + F6 J! T* X& b5 ^; X: l

  60. ' ^9 @" y" K0 Z9 r/ J
  61. static volatile int irqraised1 = 0;) ?+ ^0 T3 Y2 L
  62. static volatile int irqraised2 = 0;
    0 g/ E7 I( @! J/ h! ?0 I
  63. ; t$ ]. i- {) p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + y: Y9 _6 ?1 p: ~$ Q0 Q% C- n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ?) D6 D5 \' C- @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      S2 p  w4 j- I9 }
  67. 6 W& `' W9 s" ~' V; g- A
  68. dma_addr_t dmaphyssrc1 = 0;
    4 V" f6 M/ y+ A6 l) I3 r6 B- j0 x
  69. dma_addr_t dmaphyssrc2 = 0;, h9 |0 r( B' S2 ]$ v
  70. dma_addr_t dmaphysdest1 = 0;: q* y* V- E+ E4 a* E: s5 S  q% A
  71. dma_addr_t dmaphysdest2 = 0;
    ) {' O7 E; r; ~! X( h9 n
  72. . y9 Z, f+ Z6 y3 ^- Q
  73. char *dmabufsrc1 = NULL;
    2 ]  z7 K7 W( P) O- M6 ]5 d
  74. char *dmabufsrc2 = NULL;) j2 M: k. @: \4 ^& y; z# ?
  75. char *dmabufdest1 = NULL;% O" H+ T: d% `( P
  76. char *dmabufdest2 = NULL;
    ; }+ p" V2 C) k6 u% ~
  77. - H" e- {' O- |4 K$ w% ~( `& c. Z
  78. static int acnt = 512;
    $ y5 R; ?$ l" i  i
  79. static int bcnt = 8;; D9 W& ~7 a. L/ s) v0 `$ B9 Y0 e
  80. static int ccnt = 8;
    - M' o, l9 t4 j' X
  81. % c4 M/ [0 P4 \# S7 G" P  S
  82. module_param(acnt, int, S_IRUGO);
    4 t# {7 p$ o& F! l# \
  83. module_param(bcnt, int, S_IRUGO);
    ) t6 B5 P' ~, ?& D5 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ n) ~' E$ L' a. Y. j7 g5 v- d
! F9 H( G  H7 o/ @/ G6 f! Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. x) J9 V6 Y( v: L, P) e1 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ U6 d( X$ I! i% i# D' m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( f6 S; s# m2 f
, o# _  a7 Y* f7 t' l# _# f
7 R; a( W8 d: q  c/ i1 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 12:40 , Processed in 0.039043 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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