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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   J% Q. {8 B( w! j
  1. [code]EDMA sample test application5 J- Z: D1 x, }, @
  2. /*
    $ _& L3 A" Z1 v8 G+ T- v
  3. * edma_test.c( U4 \3 ~  {* _  X# R
  4. *
    $ K' F$ h7 r1 S8 F7 c
  5. * brief  EDMA3 Test Application& K9 K( ^3 t3 H5 W1 P
  6. *
    ( b, [4 d# k7 C$ ?4 a
  7. *   This file contains EDMA3 Test code.; e9 i7 ^- V; N0 L
  8. *
    $ b5 T* o! c3 u) O9 F# g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 V" K, }  K' L+ O" g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ u; W4 l) ~" f3 ^6 ]
  11. *         TO CHANGE.- z* p- g6 q; i( H$ t
  12. *( k. T6 n) e2 z, g9 P$ i6 t1 Y% N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. ]1 {% M( u/ A
  14. *6 {* h0 \& j5 i3 E
  15. * This program is free software; you can redistribute it and/or
    9 T. O3 c. w& @7 \. K; d
  16. * modify it under the terms of the GNU General Public License as
    & J6 J2 r: |$ u7 g/ X
  17. * published by the Free Software Foundation version 2.: I/ i( r% C$ v4 P0 u7 Z, g
  18. ** p! p/ m0 X. M* B) Y4 k  d% w# }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 f$ n- [, H: f. c  z' o3 {
  20. * kind, whether express or implied; without even the implied warranty
    2 n& [  Y0 J$ t) v  f1 X0 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 Y. n& F$ L+ _- k3 r( C" x
  22. * GNU General Public License for more details.6 W1 S& u( I* X) b0 G
  23. */
    ' j! R  |3 r; x/ S+ I/ {! m6 h7 A; [

  24. & S1 [; Z, t( A% S
  25. #include <linux/module.h>; P9 S/ z& X1 f# W  P7 [. b
  26. #include <linux/init.h>2 d- D5 H: S4 r
  27. #include <linux/errno.h>
    4 s' g/ e( Z! s- l6 ~. E
  28. #include <linux/types.h>* r, D/ `+ P/ {8 j, s
  29. #include <linux/interrupt.h>' e$ _, |1 ]+ R% n6 }
  30. #include <asm/io.h>7 A, `+ ?, g6 g. ~, ]  h! ^
  31. #include <linux/moduleparam.h>
    * P  J& }' ~. d3 b# {2 l( p9 O
  32. #include <linux/sysctl.h>7 v8 O% h! R0 F8 y4 h% r
  33. #include <linux/mm.h>
    9 o+ X, {; I: F( B% r1 J
  34. #include <linux/dma-mapping.h>
    % u, \7 r7 a2 D3 R  f

  35. 9 `# E* }$ t3 l6 O$ l
  36. #include <mach/memory.h>) t2 b4 ]  m  d: M. o& ]
  37. #include <mach/hardware.h>) y4 [  g9 c) F  Y8 W) a* ]
  38. #include <mach/irqs.h>
    - u; R% ?5 ^) A  d3 X4 c% A
  39. #include <asm/hardware/edma.h>
    ) |; _7 K- D( d# [( \

  40. $ N. E1 C' Z: z4 @) h. [$ }0 y6 a( ?$ n
  41. #undef EDMA3_DEBUG
    6 O- M! w' K6 l
  42. /*#define EDMA3_DEBUG*/
    ! _# x# W& e3 U8 G* G2 U9 V* n
  43. , Y! b# Q/ C9 ^4 q3 E% P
  44. #ifdef EDMA3_DEBUG9 r2 b$ |: @' s1 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 q1 _5 J; f! e/ Y- n" {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); K1 _8 }0 o( f) E! _+ p+ {/ y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 u  L4 _1 [$ S0 f
  48. #else: u- d2 s5 ^+ l, @8 T2 m7 t
  49. #define DMA_PRINTK( x... )
    $ J( {( M; M. ]# K
  50. #define DMA_FN_IN
    3 `$ A0 J% H- x8 \$ w
  51. #define DMA_FN_OUT* P+ A3 _2 S' D* _" l& T; \; c' X
  52. #endif
    + l* l. Q' H; z$ _6 J8 \
  53. ! L) @7 _7 ]' L* h# J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- E' {3 |0 V& \
  55. #define STATIC_SHIFT                3: @% t  v4 o" W2 B; B6 D* G0 c: h
  56. #define TCINTEN_SHIFT               203 Q, G+ L; T, f' F; G0 V* B) x; a1 L
  57. #define ITCINTEN_SHIFT              218 b. ?& ~3 u  A
  58. #define TCCHEN_SHIFT                226 N& {% r2 S, l; w' {
  59. #define ITCCHEN_SHIFT               23+ \2 [" [3 J& y3 Q* [: d! g5 B
  60. " E2 ?8 n) N: _9 \) ~5 `8 J
  61. static volatile int irqraised1 = 0;) M: `# n; C6 z) a# d
  62. static volatile int irqraised2 = 0;
    ' h9 m3 [8 l& i! ^# _% B, A0 s
  63. ! h& x3 B  l" P) u0 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 O0 z+ p) g2 @# x- D8 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 Y/ U' E) A- p% b9 y# G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % T( z6 `5 u; G5 g, w, K8 W

  67. % f  Y. X) B2 r1 m
  68. dma_addr_t dmaphyssrc1 = 0;
    $ E* \  y2 F4 R3 t, t" @
  69. dma_addr_t dmaphyssrc2 = 0;
    . O# @; k! @' Q( n+ y
  70. dma_addr_t dmaphysdest1 = 0;  i  }" W& {' r" i5 `
  71. dma_addr_t dmaphysdest2 = 0;
    $ K! [3 P  \% o* {

  72. # I( ?  @( v( c) V2 n  g8 H0 j
  73. char *dmabufsrc1 = NULL;
    0 a$ a* o7 G4 c5 U9 o
  74. char *dmabufsrc2 = NULL;
    . U/ x! k  ^9 M& i; A# b7 \  t# b
  75. char *dmabufdest1 = NULL;
      [: Z8 F+ Y' Z  n2 v! M) n
  76. char *dmabufdest2 = NULL;
    + U: P2 w; B: G4 ~
  77. + {! Z9 I1 [5 ^7 ~9 d  w
  78. static int acnt = 512;8 P0 F" a3 R6 N/ f* ]
  79. static int bcnt = 8;9 u! K9 q+ C$ }. T
  80. static int ccnt = 8;
    3 O! U2 _7 E& Y) I. v* l3 W
  81. , m# C+ [0 _4 }+ X1 y
  82. module_param(acnt, int, S_IRUGO);, Z& Z# R# Z& c4 K3 k! S3 F
  83. module_param(bcnt, int, S_IRUGO);
    # V6 q/ }( q1 r8 G' O9 B, Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* T+ w7 C3 z: |& Q. j; M9 l
; I" f, ~" k7 }4 m0 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, K8 t; Q# E2 ^# d9 O3 S( y& darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  ], j6 k. R% p% @" K7 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- j# a: j- ~& q  g  \; k" a1 H' y% i" g# |
" F. e  r1 o" [+ x$ i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 03:49 , Processed in 0.038759 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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