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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ P3 T! B( I1 m3 w5 A5 {4 O7 n
  1. [code]EDMA sample test application, G! r) U' _+ H  N$ n4 @
  2. /*- Y- G* h3 J1 A. @! c: h
  3. * edma_test.c
    7 H0 I  w& V! ]9 g! p; n+ O
  4. *
    8 Y8 Y: H- M" A. Q1 x( W
  5. * brief  EDMA3 Test Application
      }7 \* O; R) h. Q6 u& {# P6 p
  6. *. y% I8 [! l: E7 A  q. W+ c
  7. *   This file contains EDMA3 Test code./ Z3 `# N7 _* _: h% ~: _: b
  8. *
    : B8 r6 O; R8 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, e2 G3 j* b! D' Q8 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 X" }+ O  {9 w, n5 ?9 }+ i
  11. *         TO CHANGE.( H1 L3 d9 w) ?% |# @1 j
  12. *: f" N, Q1 F9 X& v$ s: p8 Z8 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " G& w- f! ]" ^6 D0 Y. x
  14. *
    ) n' D9 W8 u$ A* o& g
  15. * This program is free software; you can redistribute it and/or
    . q; W- U- U* @5 _) `1 X, Z2 @
  16. * modify it under the terms of the GNU General Public License as
    & ^0 L9 |3 h4 \5 q) O8 [$ j+ ?
  17. * published by the Free Software Foundation version 2.
    4 E. j' ?$ `% |4 A
  18. *0 _- J4 r$ F( y! W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! G% f- n9 i( E  ?: [' ?
  20. * kind, whether express or implied; without even the implied warranty6 @; S! m( \7 V. d; A' U# a% L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; F/ s% C+ s  |# a
  22. * GNU General Public License for more details.
    1 p$ [0 O6 ~/ ~8 j: r
  23. */
    # c) S8 V6 o; P+ [$ g
  24. , t! \; J# z2 V9 O! W6 i' d" z* a
  25. #include <linux/module.h>
    + |+ w; @+ z% s2 M  h9 C  q
  26. #include <linux/init.h>
    4 Y5 |, K( B+ F
  27. #include <linux/errno.h>9 ?2 ~0 d( ?/ R* A' `0 }: s
  28. #include <linux/types.h>8 [6 M0 ^* U  s9 ~& c  ]) B
  29. #include <linux/interrupt.h>6 ?# m' W, l/ T9 D8 z9 g' |$ z; g
  30. #include <asm/io.h>. L7 u# j* ~3 r
  31. #include <linux/moduleparam.h>
    * l9 ]( {: f" q7 o- M
  32. #include <linux/sysctl.h>* ~" }9 e; B8 m: e- v
  33. #include <linux/mm.h>' j  O$ ?4 V; N- y  G
  34. #include <linux/dma-mapping.h># O$ z! e3 U6 I4 S& [: e
  35. 0 Z8 l) e2 K. @( _( u! u
  36. #include <mach/memory.h>9 w( K3 d! j+ \6 v+ c
  37. #include <mach/hardware.h>
    0 L7 d3 v) f6 a
  38. #include <mach/irqs.h>2 h, j8 y7 |7 y5 M% J) R
  39. #include <asm/hardware/edma.h>
    0 z3 q- Y& [/ ?& f- f
  40. . }; D( g) s$ a$ l- f( J  k; E
  41. #undef EDMA3_DEBUG7 g) U* m2 K& {+ Q) Z9 g
  42. /*#define EDMA3_DEBUG*/& p, T2 l3 L" h1 i# E
  43. 6 o/ }, r, ^/ y& P2 {2 w, I
  44. #ifdef EDMA3_DEBUG  h8 C4 h8 A0 b* M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 L% u6 R) y+ \$ J$ X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 l0 m0 V, P- P! X2 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 \. A3 G6 k; n
  48. #else+ r" ]- I, L7 o2 q* e4 Z
  49. #define DMA_PRINTK( x... )
    " g7 l" u: \8 J  Q* L
  50. #define DMA_FN_IN
    2 H' F; N& t5 \, T
  51. #define DMA_FN_OUT4 m9 e9 A: C! l3 U" ?
  52. #endif' z: u! X; p; w' t8 B, E

  53. ( f; o. ^& U: i- ]/ h0 g4 _& \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - V+ K0 c$ a# r4 ]' J! `
  55. #define STATIC_SHIFT                3
    # v1 I% v! {: {2 n, U
  56. #define TCINTEN_SHIFT               203 R" h9 R% W. r4 G; Q5 w- \
  57. #define ITCINTEN_SHIFT              21* Z! b4 {' t8 a1 Q. i
  58. #define TCCHEN_SHIFT                221 t5 D- i) @* x1 i8 [' q
  59. #define ITCCHEN_SHIFT               236 A: Z" @% Z* e! K% ]1 ]
  60. # _( V- l: N; I" B" ^6 T
  61. static volatile int irqraised1 = 0;/ K$ m( u! R9 {6 l. x8 T6 o( j
  62. static volatile int irqraised2 = 0;
    & u! e2 Z+ V5 J8 X
  63. " ^  ]! {$ ~9 K! U; b/ C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 \' g5 L7 a" ~3 I9 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! e# A7 l: |6 s" @' @  ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & X: o1 {' n. h2 c

  67. / T8 h+ z+ H; ]
  68. dma_addr_t dmaphyssrc1 = 0;# P4 _3 n6 p+ m3 |0 ^
  69. dma_addr_t dmaphyssrc2 = 0;
    2 q+ _9 Y( O2 V% _# F
  70. dma_addr_t dmaphysdest1 = 0;5 h3 O' p" B2 q8 C/ [( o7 Z
  71. dma_addr_t dmaphysdest2 = 0;0 K5 E( E  R: H

  72. 0 c! `. `7 A3 c- U, v
  73. char *dmabufsrc1 = NULL;& T+ J+ T4 j. @, ~
  74. char *dmabufsrc2 = NULL;
    , O& Z9 y8 d6 m
  75. char *dmabufdest1 = NULL;
    & A" d  D5 }* D
  76. char *dmabufdest2 = NULL;
    5 X7 D1 s0 K( M3 V7 H5 d2 l% I

  77. 2 [- n$ Q' X+ x6 {0 B# s6 L
  78. static int acnt = 512;3 o' H7 h1 Y4 T$ e/ K! n
  79. static int bcnt = 8;
    # q/ N* B& Q5 {3 s" h% e- R
  80. static int ccnt = 8;/ B  k; q0 f# X5 g

  81. ' r4 U/ @7 P9 _, y
  82. module_param(acnt, int, S_IRUGO);
    ( I! k0 U3 }  W" v1 e0 Y
  83. module_param(bcnt, int, S_IRUGO);
    * R, c& P8 \+ i; g0 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) |0 e/ h; N& z  u
3 A. d% M* S" J& H. V: W. [1 k/ ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 }- Q* j3 {. \) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" [. M; B# U# Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. P& `  o* N) b+ Z
" [" `; ]; R* d8 e4 p3 M
. }+ @8 N$ J/ T6 B  }# l3 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 22:22 , Processed in 0.039277 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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