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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ q1 z# T3 \7 c$ ]: Q
  1. [code]EDMA sample test application1 m7 ?) y0 s' _9 s" E6 W
  2. /*) o8 D, d3 {3 z8 ]2 U3 t
  3. * edma_test.c
    ) A, E, q. L* C+ \" ?7 ]# I. V$ f
  4. *0 z+ B) V  d) K* e
  5. * brief  EDMA3 Test Application  h* I- |8 j# V7 c9 a# ^7 W) \
  6. *: u& I0 r. i7 \! z' }& Y
  7. *   This file contains EDMA3 Test code.
    0 n# U2 y5 h1 S0 Y, g  R; D
  8. *! x7 @% Y9 @% {2 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : b2 B) x% d4 m( n% \, d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  C: Y: G( s& S3 B  e
  11. *         TO CHANGE.
    2 e$ q- W  n4 v3 ]9 i
  12. *
    / S8 ~6 D; j1 {! i6 e& V; s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 v5 t, G, v6 c& b: Y
  14. *6 G: f$ x- k( o" Z9 Z! t
  15. * This program is free software; you can redistribute it and/or4 t! g2 R5 W; Y! d
  16. * modify it under the terms of the GNU General Public License as- Y* F! j: u! M( Y& ?- R4 l
  17. * published by the Free Software Foundation version 2.: l% p, ]: z. I" C
  18. *" k" g3 G; k% d; V, d$ M1 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ~, Z+ C: h! Z
  20. * kind, whether express or implied; without even the implied warranty- }/ B* B& o4 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! {  I  @, l% J
  22. * GNU General Public License for more details.& }7 v$ x! Z1 k, j2 `" E+ D
  23. */
    ! g+ D/ y) L3 K* t: _  Q
  24. 0 L; m, w! f* q3 U1 j
  25. #include <linux/module.h>9 g7 v" \& K. d2 D
  26. #include <linux/init.h>4 N' D' N! U% K0 r
  27. #include <linux/errno.h>
    4 n6 W1 W- C( D" ?1 c& l8 O+ c
  28. #include <linux/types.h>
    5 [* p! q0 C4 C5 u
  29. #include <linux/interrupt.h>, A6 }! p( K' R
  30. #include <asm/io.h>
    ' Z5 k& p5 o4 E1 o
  31. #include <linux/moduleparam.h>
    ' p% d+ [" c8 v4 ^( b
  32. #include <linux/sysctl.h>
    + X& L6 t. M( \7 i& @
  33. #include <linux/mm.h>( C0 y0 F0 E* Y
  34. #include <linux/dma-mapping.h>5 a# b: ]9 x$ e; R+ G8 W
  35. " C& X. |1 E+ A- r9 m) A2 C( Q
  36. #include <mach/memory.h>$ ^/ i6 G6 [0 {* Y( H! o7 l
  37. #include <mach/hardware.h>
    0 ~( E& D2 V5 c1 w  ]2 k; t
  38. #include <mach/irqs.h>. h% o3 z! t6 O: i+ y4 \- m! H
  39. #include <asm/hardware/edma.h>; P- q  X$ [" l" U. w/ Z, Q
  40. 9 {) B; I3 D( f- b' L- s* V. W
  41. #undef EDMA3_DEBUG
    : V  f; @1 |) ^7 P2 X  O( ~9 ]$ Q
  42. /*#define EDMA3_DEBUG*/
      H+ ?$ v7 m: b% _/ n) e1 ^

  43. ! i4 o6 R! P$ n; `: o
  44. #ifdef EDMA3_DEBUG
    ) c3 O. g3 H/ a7 I8 w0 ?1 d, i; c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # i% Z9 h: `  U) x( L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & F# n) n: R' N- `3 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * P* r) l9 k( l
  48. #else
    * }; f3 `% v% g7 n
  49. #define DMA_PRINTK( x... )$ ~1 ?) R- O% D* ]% L! N/ G
  50. #define DMA_FN_IN% F; m( i1 D3 x* y
  51. #define DMA_FN_OUT
    % O  L7 t# h( ^2 A" |
  52. #endif! o9 m; b, n8 y' y

  53. " B+ K8 Q; B/ o" c% R- E% {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 B' B$ C( K6 }2 b; ~) I! i  s+ ?
  55. #define STATIC_SHIFT                3
    + h* w5 G- a/ h' W4 ?  Y
  56. #define TCINTEN_SHIFT               20. R) w! h- }% J: n
  57. #define ITCINTEN_SHIFT              218 x" L( ]1 K- w- N& k( v1 A
  58. #define TCCHEN_SHIFT                22. A% ^# m& F% W% O7 p8 ^
  59. #define ITCCHEN_SHIFT               23) V% J* m3 o& L3 |) v$ n7 z4 `

  60. 0 J0 {6 ?3 o5 y# J4 ~- d  {
  61. static volatile int irqraised1 = 0;, m' t, d. @; f& }
  62. static volatile int irqraised2 = 0;+ e/ A2 s; P) M$ A1 }' f
  63. : a- ]2 S9 e' |/ O9 ?8 R1 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 J6 e" Q5 ^$ m$ s* j6 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) F$ P8 f" y1 @# w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , V1 r* M# `& I  y

  67. 3 @  n" s$ l7 e
  68. dma_addr_t dmaphyssrc1 = 0;( u  i4 X' c0 g1 ^5 y" u
  69. dma_addr_t dmaphyssrc2 = 0;5 Q. T( t8 S: r0 I
  70. dma_addr_t dmaphysdest1 = 0;# d$ S. s( ?' g) I: V
  71. dma_addr_t dmaphysdest2 = 0;
    ; f! l" [$ ^$ v# Q" {+ J

  72. ( n+ t8 i+ B2 J% O9 `, S
  73. char *dmabufsrc1 = NULL;
      ]/ _0 @# p% R: H% ?2 d
  74. char *dmabufsrc2 = NULL;
    ' }9 ~) @) S) B& W/ b5 c+ H
  75. char *dmabufdest1 = NULL;
    4 A+ ~( W  h9 s) L! D
  76. char *dmabufdest2 = NULL;8 [. P% T3 y, r5 ?* K
  77. : e. v8 `0 ^! @1 Z. t# g
  78. static int acnt = 512;' j2 v+ d6 p8 _& Y4 M. Q6 L: U
  79. static int bcnt = 8;
    , z9 G; U' y# \( g+ v  E
  80. static int ccnt = 8;
    9 [3 j0 s0 \9 M* _" d4 z# h
  81. 8 m: Y! R1 U( H2 R1 q8 v
  82. module_param(acnt, int, S_IRUGO);
    % N. d) Y9 c  s0 }% F) {
  83. module_param(bcnt, int, S_IRUGO);5 E: a+ A" F2 {2 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. B/ q3 P6 n& `, n7 |0 `: y* ^8 V, X+ U6 {* C* k/ Y" d  R9 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" Z1 ^* h0 ~3 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 L% _0 ?9 ?4 \; `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 j  S* e( m& S, g2 x" L' q3 Q' w2 J* w6 j6 }( W

' c& F; E* m5 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 18:58 , Processed in 0.038072 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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