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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; [/ j3 n, K: E7 t
  1. [code]EDMA sample test application
    , t% L3 ~3 }+ Y( {
  2. /*& i& L: O* j' Z9 b7 n
  3. * edma_test.c2 N: a! F% U; I" k
  4. *1 z5 Q/ ?/ ~, q4 o$ ]4 s7 k' x( e
  5. * brief  EDMA3 Test Application* t' e' h% U3 F+ w
  6. *
    5 Q7 m1 Q' T4 ^- U$ N8 F* h& W6 z
  7. *   This file contains EDMA3 Test code.
    , E4 J( ~' m1 B6 B2 i8 n7 G
  8. *# P: K" v, X0 [4 z! D5 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 _( Y" j/ G) M' L' c1 ?( t4 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* G6 g- g- G( O: \) m' ~
  11. *         TO CHANGE.
    % F( n, N. F) Q0 n+ F% Q. K2 H
  12. *
    ( S3 G- d; ~0 ?- ^- O" F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) }8 h4 Z' l. m' g7 l* B
  14. */ n/ |+ E+ @# ^
  15. * This program is free software; you can redistribute it and/or6 p$ Q3 `: q4 k- s1 k- D1 E
  16. * modify it under the terms of the GNU General Public License as% [, f3 M* G  R  `; h+ E
  17. * published by the Free Software Foundation version 2.! d) g. q' {7 U3 D8 ^
  18. *
    2 O6 w% I4 f$ [8 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 k" c" `( h: v
  20. * kind, whether express or implied; without even the implied warranty
    0 D% @6 t9 ~* O% W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - M* [9 q, r/ F( E8 h6 e
  22. * GNU General Public License for more details.
    ! i0 w+ p% k. n7 E7 E2 c. t
  23. */6 @0 c. L' |, @' p6 |

  24. 3 P) K5 R4 e, G; p
  25. #include <linux/module.h>5 Z. M3 G& s" M# S% w; a% s3 z
  26. #include <linux/init.h>1 `1 z6 l- b- d$ `+ v
  27. #include <linux/errno.h>3 R2 ~2 z8 I8 U. ~
  28. #include <linux/types.h>4 w2 \! _# b' [9 }8 i
  29. #include <linux/interrupt.h>
    ; `7 N9 q. f+ k2 z
  30. #include <asm/io.h>8 k; K2 d" m3 k7 V
  31. #include <linux/moduleparam.h>
    1 |8 I: o3 M* Z' L& U$ `- U/ _! A
  32. #include <linux/sysctl.h>% `+ S6 V/ |$ q
  33. #include <linux/mm.h>
    $ L8 S7 g  C  C+ O' @# u" X+ p
  34. #include <linux/dma-mapping.h>
    . O; l& b+ B+ j$ W) e
  35. # ]# s0 Y, a2 n7 R$ i1 N
  36. #include <mach/memory.h>
    ( f8 o9 a6 ]6 D) T2 ^3 W6 K
  37. #include <mach/hardware.h>" [! a! e9 G% M: b
  38. #include <mach/irqs.h>
    9 D3 f$ ]; G' D7 f5 |
  39. #include <asm/hardware/edma.h>' h( B9 V. E) K9 g! l

  40. 4 q: Q- _4 `* n9 }1 e
  41. #undef EDMA3_DEBUG$ I% S6 ^; H0 j( ?1 [5 q/ ?$ S6 N. A
  42. /*#define EDMA3_DEBUG*/
      j+ J+ j  Z' P& y" Y% M

  43. 0 O+ _' ~9 V. l3 f% ?0 U% W2 |
  44. #ifdef EDMA3_DEBUG/ }, i  C0 g- Z' W, F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( z; k$ o$ q; s: c" o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 E. o( k3 j- X& n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . `% C0 N$ n# G. _2 k
  48. #else
    1 y/ n  S6 u3 G0 j( B
  49. #define DMA_PRINTK( x... )' `& B# p2 R0 B9 I6 k+ `
  50. #define DMA_FN_IN
    : K$ P! n% W: G; M/ U
  51. #define DMA_FN_OUT
    4 {* V; z; _7 G( V! ?; [8 S
  52. #endif/ V* r! X8 ~6 Y

  53. # Y9 y9 H4 o) Y3 r3 E! d1 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% w5 |+ R7 k1 h2 h: E1 O" g
  55. #define STATIC_SHIFT                3
    8 M+ G) Z/ \% @; z
  56. #define TCINTEN_SHIFT               20
    2 \+ j9 c' T( {- N# l& k/ U
  57. #define ITCINTEN_SHIFT              21
    $ @  w6 }  J' }% V# k. ^
  58. #define TCCHEN_SHIFT                22  x0 {' Q7 B) g0 x
  59. #define ITCCHEN_SHIFT               23
    + Z0 f$ S# @) Y7 j
  60. ! Y+ v9 Z3 B6 b9 @
  61. static volatile int irqraised1 = 0;
    7 z! A( [! M9 H" U
  62. static volatile int irqraised2 = 0;
    - w$ H; A, ^. p5 [* |+ G8 u  J
  63. $ h% c+ I$ Q5 z; {* j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! o. d# i; a0 a) T( Q9 z. l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e# I( @/ W' O: s6 k  g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 x6 V1 H! ?& c. \
  67. 1 v; a( |. k& B  D/ m* ^6 W6 F
  68. dma_addr_t dmaphyssrc1 = 0;
    2 H$ U0 y+ c3 M! O2 W- [
  69. dma_addr_t dmaphyssrc2 = 0;% ~6 }! Z  k4 ~) \, Q  h
  70. dma_addr_t dmaphysdest1 = 0;" p3 o; y$ z) V. j
  71. dma_addr_t dmaphysdest2 = 0;2 ^- s; |- N% E. L

  72. 2 t* v+ h  V0 _' V* H
  73. char *dmabufsrc1 = NULL;
    % \' n% M* q6 A: X
  74. char *dmabufsrc2 = NULL;
    3 p. c* \( y& K- Z
  75. char *dmabufdest1 = NULL;' y6 W) `9 V  x3 P" n! }# U+ @1 h' H! F( M
  76. char *dmabufdest2 = NULL;: B6 B. ^4 M1 q) Z9 E7 T$ n

  77. $ z% K( }" c/ t7 C) R  Y5 O
  78. static int acnt = 512;
    / U1 q7 c, V2 R# N6 X' k! q+ ^, V
  79. static int bcnt = 8;
    2 a& B- L  F+ y% ^3 G
  80. static int ccnt = 8;, [( K  V7 _2 h* k( o6 {
  81. # J" B6 e7 j6 G! P  T
  82. module_param(acnt, int, S_IRUGO);
    # q8 w- Z: ^; E$ l, u  q
  83. module_param(bcnt, int, S_IRUGO);# T9 e: w; [! L7 J0 _2 ~! w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, o5 f1 R) t) }5 y+ i  S7 M

& j3 |* ^, g) X0 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. X/ P$ Y+ }. @! B+ Y, J- E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ t- a% Z* e) E% C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 N6 F: V% ?3 t
" @* ?1 k. a1 y8 `: K

6 B8 A5 I8 ]/ A/ u& U) \. ^2 x9 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 08:29 , Processed in 0.037693 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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