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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- Y' N0 ^+ H( x$ S
  1. [code]EDMA sample test application* A$ n; Y9 a0 x3 ^2 @
  2. /*$ P, E: ^$ t' H( Q
  3. * edma_test.c4 X: [, o, A" P0 r' B
  4. *
    7 C: |# Q4 s, V# S: Y. I
  5. * brief  EDMA3 Test Application
    " z# P7 \2 Z1 p* ?
  6. *
    * J3 B+ o. i$ g/ |
  7. *   This file contains EDMA3 Test code.% M4 v/ ^) ]- A' P+ K' f4 B
  8. *
    2 A! m7 U# l8 V4 h- p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & W# {* ]9 [. a. v' z9 y5 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 I/ l& n7 K3 u- z
  11. *         TO CHANGE.* q( q  a' @/ Z( S! s. l  q
  12. *
    3 `7 t( {% r8 A0 z  h  N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! l# B3 C" s( k) j
  14. *
    1 x6 K2 `- J& t( F7 Y0 {0 w
  15. * This program is free software; you can redistribute it and/or
    . X: U4 T) K' O" Y& E6 r6 A
  16. * modify it under the terms of the GNU General Public License as- ?2 O. H: ^4 i5 l/ P( M% F5 b) g  c. ^
  17. * published by the Free Software Foundation version 2.1 L+ i1 D+ u$ R9 @! e
  18. *) M+ ?2 F# _, o" Y" a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 z: L, U. ?4 [% k2 q
  20. * kind, whether express or implied; without even the implied warranty
    . h! @+ w. ]" s& q/ [0 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 \" S2 T9 C' g. X8 o/ y: H; e
  22. * GNU General Public License for more details.. x; s- |5 D1 E: o# b; c- _
  23. */# O! b# F3 Q: [

  24. ' m2 w1 Z! B" [" b, h+ E7 ?
  25. #include <linux/module.h>
    8 B8 W, b2 ~9 i1 X; g. j
  26. #include <linux/init.h>" {( B0 m$ `; a- _, Q. b! u
  27. #include <linux/errno.h># D( J0 T. e( c
  28. #include <linux/types.h>" @) A0 A& B& G! Y2 O
  29. #include <linux/interrupt.h>  Q& i9 x" Y4 ^5 y  H
  30. #include <asm/io.h>
    / w$ M+ o$ {' t2 M' }- U4 N6 ?5 \( d
  31. #include <linux/moduleparam.h>& o, _4 H: W9 F+ m
  32. #include <linux/sysctl.h>
    3 z/ s( ?1 c# A6 V$ @3 B3 }/ |
  33. #include <linux/mm.h>
    ! \2 e+ g  E) L& r1 Z
  34. #include <linux/dma-mapping.h>
    7 Q9 V  k, v" E+ _

  35. - v$ U; O4 o  s6 L: k
  36. #include <mach/memory.h>- {  u& @3 S0 ^& K! \' @- a
  37. #include <mach/hardware.h>( q) g5 H* c7 C# j3 X% {
  38. #include <mach/irqs.h>
    ( W- t' g. R  w  F7 u; k
  39. #include <asm/hardware/edma.h>& F  Z5 A! ^7 g5 g5 _8 h$ q5 [
  40. 5 V5 F) X) ~% @' ~' _
  41. #undef EDMA3_DEBUG. `, ^6 m# B+ {* ^' }3 g; t
  42. /*#define EDMA3_DEBUG*/2 v9 Y+ J9 n  G' u; x; Q

  43. + ]2 O3 B1 Q7 v; c
  44. #ifdef EDMA3_DEBUG1 p' L1 O: W. Q/ r* D% J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . \: j1 a4 K! n. v& J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& ~! S: ?* M6 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( W, A  ]6 Z* T9 k
  48. #else
    7 @: k, \# b  J8 F
  49. #define DMA_PRINTK( x... )
    0 n; J) ^5 d4 R' u/ J* L
  50. #define DMA_FN_IN! {6 ?  o. o( V1 G$ S, S
  51. #define DMA_FN_OUT. L# x" A" d& F4 ~# W9 q
  52. #endif$ }! {6 M( D8 I' N5 w
  53. % _+ d/ ?, x+ l& I8 f0 {/ U: {8 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  x2 e* u5 m; w, H+ P
  55. #define STATIC_SHIFT                3/ R! P3 x+ `# K2 c5 B2 ~
  56. #define TCINTEN_SHIFT               20
    + o" p* c# X7 r' w! n; Z6 G  r  N
  57. #define ITCINTEN_SHIFT              21# B/ d" t1 X2 r' Z! c( w$ ~3 b
  58. #define TCCHEN_SHIFT                22" o: C1 H! h) @: ?9 @
  59. #define ITCCHEN_SHIFT               237 F, Z; H; `; x4 S4 H
  60. $ J1 S5 p; d, |) H3 F6 v7 x+ J
  61. static volatile int irqraised1 = 0;
    + C! o- E0 J; ?/ Y: ^; A
  62. static volatile int irqraised2 = 0;
    ! j8 ~- Z3 W* U# i
  63. * t* M7 Z# |$ Q$ ]3 ^/ Z+ V7 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & b6 Z5 a( T9 c- K9 P- r: `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 I  h$ \# f" {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 T* Q1 j% L5 J" l! }) y

  67. 4 R; [7 b# e  `  I
  68. dma_addr_t dmaphyssrc1 = 0;: h) T; s' t/ @* H" H
  69. dma_addr_t dmaphyssrc2 = 0;
    " K; D5 G+ r  X/ `) m
  70. dma_addr_t dmaphysdest1 = 0;8 u! C. E  |0 R6 |. Y
  71. dma_addr_t dmaphysdest2 = 0;
    6 |# C! Y9 ?9 {" K" Z

  72. 7 j, R8 I7 I3 o. K) c
  73. char *dmabufsrc1 = NULL;+ v( C' h/ l  x4 l6 R7 A- X, C
  74. char *dmabufsrc2 = NULL;: g+ u, t4 I, [, _6 w+ @) k
  75. char *dmabufdest1 = NULL;' X9 N" Y2 p$ _; D7 S. K
  76. char *dmabufdest2 = NULL;# J7 e) \! h7 I+ `

  77. ' p* s" o) V! A
  78. static int acnt = 512;0 r, C/ y  Q! y7 a
  79. static int bcnt = 8;2 P$ U) Y: Q8 G0 w3 t# X
  80. static int ccnt = 8;$ l7 B, Z/ ?3 a) ^. b6 V- N

  81. + o' I" e' j1 U4 Y% \4 Q* s1 K
  82. module_param(acnt, int, S_IRUGO);$ F3 @2 Y: P0 q+ s1 L
  83. module_param(bcnt, int, S_IRUGO);
    % Z6 r' |/ F' Y1 `* ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# V% ~/ a& i" Z$ B; O! s, D$ N% ^4 ^+ {  x; ~3 H: U& U9 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ [0 C1 _. D4 Uarm-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* X" Q2 Z+ `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 M4 e) r4 e+ ?1 W! {% Y: o5 c# @' C0 h; r
: l4 V+ U. b5 H4 l. C" m! a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 13:59 , Processed in 0.039065 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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