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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! C* y- p, w( }( M# p( z0 `
  1. [code]EDMA sample test application
    ; N$ q7 j. x" w- ~& J/ D+ {
  2. /*$ [8 F1 z% ]+ r- R- C
  3. * edma_test.c% e+ D' K. l' i3 C6 ?9 M/ g# X0 Y
  4. *9 r% e( S. Z8 f; g7 u
  5. * brief  EDMA3 Test Application% Y( K+ V: H+ @+ I( e" p
  6. *9 p5 D9 P. V% `' M8 e1 h1 t
  7. *   This file contains EDMA3 Test code.: s3 o6 J4 [6 h8 o7 g& ~
  8. *# q% |) A4 O& ?7 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - D2 |' W% Q, ]; x5 M% K. o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. O* |' r9 q6 `
  11. *         TO CHANGE.5 [" J4 G- A+ v" n
  12. *+ q' W4 n9 ~5 O3 O0 O* U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' n3 R1 i( e5 ]* ]& q
  14. *3 Q# `  }  }2 H$ V1 K
  15. * This program is free software; you can redistribute it and/or3 M8 A# G# v; I  `) B. f. \
  16. * modify it under the terms of the GNU General Public License as
    1 L! P: D5 V' n& c1 Q1 {
  17. * published by the Free Software Foundation version 2.
    6 Z3 J% s- k4 ~6 A4 w# R
  18. *
    " i2 h( \% w5 |2 K* ~# G) t! {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ]/ h# k: ^4 k: ^" e0 P2 P1 V0 }, `- e; v
  20. * kind, whether express or implied; without even the implied warranty
    ) x$ l* F4 T  u+ W  |- P6 O1 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 I. b9 L' _4 T- r" f; w+ s, f
  22. * GNU General Public License for more details.
    % D9 E5 |4 @1 c4 p: r! N2 }
  23. */( h# \' t6 _$ Y5 d
  24. - ~4 G3 h+ m  a
  25. #include <linux/module.h>
    9 y# y/ M1 p+ W+ k4 r
  26. #include <linux/init.h>4 J' L$ F5 b+ \, |6 I* F/ A+ ]
  27. #include <linux/errno.h>2 r6 y* v' W. o" n/ w
  28. #include <linux/types.h>
    6 R& Z9 L$ j* ?- |, l+ D
  29. #include <linux/interrupt.h>9 {- Z7 q* X! }( f* Z1 V  c* ~
  30. #include <asm/io.h>5 ?$ ?) z4 j+ ^7 e
  31. #include <linux/moduleparam.h>  P- Y" ^, K2 h. M8 F) [! l) Z# o
  32. #include <linux/sysctl.h>
    & M: x' J' S$ {/ B+ c% x( m
  33. #include <linux/mm.h>
    + n' S" R6 J# V0 L6 b/ ]4 r
  34. #include <linux/dma-mapping.h>
    - i  c# i3 M  s
  35. - ~: x% m3 I. s* F1 u
  36. #include <mach/memory.h>
    ' R) m0 n8 |% o5 F% \+ e: ^
  37. #include <mach/hardware.h>. F( D. t6 q( K' x, H6 Y4 n1 }0 @
  38. #include <mach/irqs.h>2 o3 s# z, y6 N6 d* |! g
  39. #include <asm/hardware/edma.h>
    ; T* V5 u4 |+ h& y# }( }4 T8 ?

  40. % K5 ^  F$ V: L1 o9 w$ {
  41. #undef EDMA3_DEBUG' m* D' \- t- l6 D! P) E
  42. /*#define EDMA3_DEBUG*/, X- W; [4 A  l) H3 x- `

  43. ; K/ g+ }4 j/ i$ e; K; H$ \) r
  44. #ifdef EDMA3_DEBUG
    " Z% i5 q' Y7 B2 P( ~8 h& [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 S! r; D7 K. K! P9 R* w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! Y& F2 w& q: q2 V- g) B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) p. F4 p4 }* U* @' k8 t
  48. #else' R3 b# M* ]% w2 x  m% `
  49. #define DMA_PRINTK( x... )
    / l+ j0 E0 r5 ~9 u/ Q$ Y9 a8 `
  50. #define DMA_FN_IN
    / G  m5 V+ \. j, V' `# [- l. K, @/ q; t+ q
  51. #define DMA_FN_OUT
    6 j: Q+ ?8 k! P
  52. #endif
    . a4 B# ~* A6 {0 x% h% {

  53. 6 {: x" O: r0 ^% {7 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); X1 g1 y: S) P) r. N7 @
  55. #define STATIC_SHIFT                3
    # R1 i$ m& x' f3 Z6 S$ o$ q( }5 J
  56. #define TCINTEN_SHIFT               207 x! T; K+ W  m1 V/ ?7 X. d( N0 v
  57. #define ITCINTEN_SHIFT              21
      k5 _" Q0 \: A, o$ z+ f
  58. #define TCCHEN_SHIFT                22( f! _& B5 R7 @+ k# m7 }( l( N
  59. #define ITCCHEN_SHIFT               23
    / P2 }; i" n# {0 p( A, P
  60. 9 S5 R+ h! O' d+ I- j5 J4 I
  61. static volatile int irqraised1 = 0;
    ; f# J0 d* [8 s/ |4 d
  62. static volatile int irqraised2 = 0;
    7 B: Z, z6 X8 P
  63. . h" w* }3 Q$ f! c5 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 U4 X: e: Y/ E* e8 q4 p# l& B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - z. d3 Y: L& ]3 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 @' ~8 [* D+ ^& G- U
  67. 0 |1 m4 Z9 T+ {) w: U4 t
  68. dma_addr_t dmaphyssrc1 = 0;
    $ i) j0 z; ]7 Y5 |/ l
  69. dma_addr_t dmaphyssrc2 = 0;. ~+ }# A3 V9 }
  70. dma_addr_t dmaphysdest1 = 0;9 Y* e) ?9 q" l$ r/ k" W/ }( M2 v
  71. dma_addr_t dmaphysdest2 = 0;0 c0 @  v2 U' y. x7 S4 `8 s
  72. 1 L  q# U5 k0 M6 F3 T* B2 @
  73. char *dmabufsrc1 = NULL;3 T/ N4 u! j& I  }3 r2 i3 \- R+ I, X
  74. char *dmabufsrc2 = NULL;+ L5 W, T( K9 b3 H3 b) x/ d  S& B
  75. char *dmabufdest1 = NULL;2 @2 c8 g9 C4 i7 y3 ^, a* K; r+ }! s
  76. char *dmabufdest2 = NULL;! `' w8 Q- N: N$ B# X% @
  77. 5 q/ Z, a- M' X5 k& k
  78. static int acnt = 512;
    4 c6 @4 t% h6 b' l7 P: x- {
  79. static int bcnt = 8;% s# j5 s% |2 t- @# A( M" }
  80. static int ccnt = 8;
    9 I) d4 v" b7 I; M: A

  81. ) s! ^; m, ^& u" F+ J" w/ \
  82. module_param(acnt, int, S_IRUGO);; c, v3 t& d# t0 ~/ L  a2 ]+ V
  83. module_param(bcnt, int, S_IRUGO);# H, }' \' `% G% F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* g0 b! e& W8 G# o9 h% k

, J* W- l# c  c' M* w! J0 P  J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, C1 |$ j* G& M! t% _) }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) H  L+ P$ V9 j8 B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 t. ]6 g9 ]7 T# n- _) F7 y0 X0 E- B5 e- E

  Z' u* h( S% a' l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 17:26 , Processed in 0.037818 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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