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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, R" b1 U5 I7 |0 O$ _3 ?
  1. [code]EDMA sample test application
    0 n  h* j# M: B! ]6 @7 ^: J
  2. /*
    6 S/ Q9 B% B5 M
  3. * edma_test.c# K. ]7 I! ^8 S9 m) _$ S
  4. *
    ) ^& Y4 Q. v8 j; U( j* Q3 F
  5. * brief  EDMA3 Test Application; |0 P4 n! p' L2 r, {% ]1 o
  6. *
      X. W1 [2 i6 I% o9 R
  7. *   This file contains EDMA3 Test code.
    # C5 s$ c7 q' G# }" w
  8. *# |) ?# g# ^" W2 g8 O8 X, d( h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 f0 z' U  B; ?5 N* H# p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - o' V. K/ ]4 N4 Q
  11. *         TO CHANGE.
    6 a/ t6 `( E, F0 r( n
  12. *
    ' r1 c* Q" F0 B- a. C8 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% @$ b$ ~$ m; G. }, v/ q7 I* B! }
  14. *
    4 \( d3 ]" J& X. m! M- C
  15. * This program is free software; you can redistribute it and/or1 g3 T( _8 i% R' W; q
  16. * modify it under the terms of the GNU General Public License as
    " P+ R; W2 I$ ]6 A& \
  17. * published by the Free Software Foundation version 2.
    ; G# C, x2 e" m
  18. *; Z) `2 V9 ?  w% O: O# B- G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 A9 j: C/ \- q' f9 ^7 m
  20. * kind, whether express or implied; without even the implied warranty
    : j) }+ k6 h  B8 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 O+ q4 T/ X% |' e$ u  W& k
  22. * GNU General Public License for more details." f# @) n3 V- @! [- }2 e
  23. */6 _" K  A) ^6 H8 C

  24. 6 J/ C/ r7 q: G- z( W
  25. #include <linux/module.h>
      H7 Z% Z, X' J  n
  26. #include <linux/init.h>
    9 {1 p5 y4 q4 ^* z9 H* a! M
  27. #include <linux/errno.h>
    5 O% ~! M: `$ R5 k5 A' f
  28. #include <linux/types.h>
    * _7 c; }* ^& o" {7 h* k
  29. #include <linux/interrupt.h>2 ^4 J3 _* k* n) n% }* _0 z* J
  30. #include <asm/io.h>0 l4 ]4 Z. ~  g7 a0 t* G
  31. #include <linux/moduleparam.h>
    ) `# T/ }( V! K
  32. #include <linux/sysctl.h>
    8 n8 u! `3 E% i; H
  33. #include <linux/mm.h>
    & i5 ^2 D- u4 l" p3 ?$ t
  34. #include <linux/dma-mapping.h>/ q$ I- p; n1 O0 q- @3 N- {

  35. ( }; f* C) ~" O# Q* H; @' F5 @+ ]& t
  36. #include <mach/memory.h>
    2 ]: ]$ u! B6 B) z
  37. #include <mach/hardware.h>, T1 I9 J7 N3 u, `8 R
  38. #include <mach/irqs.h># x' s) e! c% l/ }+ s7 n
  39. #include <asm/hardware/edma.h>
    * f7 O4 U6 u6 }% E! i% a) ^

  40. - p0 }; d; i. A. O: M
  41. #undef EDMA3_DEBUG
    % S. S# M' P5 e
  42. /*#define EDMA3_DEBUG*/
    % F) i1 K' G* L9 r2 D

  43. * W0 d) ?' k7 Z/ ^7 ?1 \' f: s- {  q
  44. #ifdef EDMA3_DEBUG% n& M2 X: }2 V" C! u* q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ d' N' M% j2 L- Q0 v/ Y" W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 u6 _+ y. R6 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : J( i1 O7 D- k3 d
  48. #else4 m/ K  j# j4 a7 X3 v& L
  49. #define DMA_PRINTK( x... )8 Z- b3 O* M" z2 x; t' J
  50. #define DMA_FN_IN& o+ k4 R! O8 S3 o
  51. #define DMA_FN_OUT
    1 {1 @6 B7 A8 n3 U4 f
  52. #endif- `7 O* a( t4 K5 {
  53. 5 I2 X* L) r) t9 O# s6 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 H. X% I) w/ E! s* \2 U/ K; n
  55. #define STATIC_SHIFT                33 R& O$ e. J9 @/ r
  56. #define TCINTEN_SHIFT               20$ @; H0 [& g7 i0 `% g/ X
  57. #define ITCINTEN_SHIFT              21! `6 g  z3 a( K! f5 B
  58. #define TCCHEN_SHIFT                224 `# u0 m5 P) |0 H% R8 A$ D, `
  59. #define ITCCHEN_SHIFT               235 t, S' O2 r0 q* }9 M

  60. ! f- @9 p5 B# v% `1 U
  61. static volatile int irqraised1 = 0;
    ! j# ^" [& b. s) b0 x$ W
  62. static volatile int irqraised2 = 0;
    $ O; u$ f1 C' h; ]

  63. 1 H: a' G/ b" w& }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ n* S% a2 ~% L1 Z/ F5 L, [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . Y. C! w3 F+ x4 S& A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ?- w% z% [/ C3 @7 Z2 L" y

  67. , Z% j$ L% v' m
  68. dma_addr_t dmaphyssrc1 = 0;4 S1 D) D2 }4 c2 ?( J5 n3 p6 Y
  69. dma_addr_t dmaphyssrc2 = 0;
    7 G* P! @3 u# @
  70. dma_addr_t dmaphysdest1 = 0;
    % f( k6 p) k& q" ?
  71. dma_addr_t dmaphysdest2 = 0;% N& `2 T+ s" i9 T7 h
  72. 6 U/ ^0 C7 _& g$ h* E& l) \2 s
  73. char *dmabufsrc1 = NULL;" R0 d' F  |( F+ o6 p
  74. char *dmabufsrc2 = NULL;
    & X( j/ e8 B; r& p
  75. char *dmabufdest1 = NULL;, H& u% Y. ^7 ]/ B1 y+ D
  76. char *dmabufdest2 = NULL;% n) g: N2 t2 G* y. s# s

  77. " b- J5 F- H) `# N# n
  78. static int acnt = 512;
    & V% }! J' g* ?& f6 v3 @' Z% N
  79. static int bcnt = 8;$ ?5 W1 y3 p9 Q# ^! Z
  80. static int ccnt = 8;
    ; ?" Q$ \3 \4 j

  81. + J0 D: s% k: i7 I' o
  82. module_param(acnt, int, S_IRUGO);5 s- A+ _7 _# V
  83. module_param(bcnt, int, S_IRUGO);! s5 C  S& ?9 |6 Z: J, c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ ?3 K# M& E/ o6 T, ?6 W; g) C

0 D8 r" a6 y& i) g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! T' Z  C8 ]  m8 q4 Y4 T' B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ C- ~5 D, @/ _1 I( P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 S: g/ y0 S; {2 R: A5 g8 |
% O$ l) n1 j' u7 u& c4 h. E% D

( m# f  A* Z0 B6 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 13:42 , Processed in 0.038761 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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