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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) w6 W% R5 V( N( S$ z
  1. [code]EDMA sample test application
    * [6 t9 G, D2 p! r! \
  2. /*8 N  R) R9 N/ c
  3. * edma_test.c' o& r+ }: Z+ L' C
  4. *
    , C6 [3 L' A3 U! i) V, \
  5. * brief  EDMA3 Test Application
    0 @0 H3 s1 _" t6 T0 r3 f
  6. *7 c: \+ _1 l8 b8 Z1 n
  7. *   This file contains EDMA3 Test code.% t; a' S8 p( H- g. t( q9 G6 \, Y
  8. *
    # K/ q* s/ T1 ^0 N9 @9 v+ D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ u* m. u0 ~& f7 A! s+ i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 b) U$ V, d% ]5 T9 z; z3 I
  11. *         TO CHANGE.; k& p9 A4 x) ?
  12. *
    ! u- p$ t: H, `8 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + ?" p' Q1 H; w: d, s$ |1 T% k
  14. *
    - {1 c; h, w6 i# x2 }9 g
  15. * This program is free software; you can redistribute it and/or% c  p# j9 S; {; {+ o! r
  16. * modify it under the terms of the GNU General Public License as- V" i5 v' b7 {9 e) y3 Y
  17. * published by the Free Software Foundation version 2.
    8 J5 v; A; x# ]. `/ h& m) {+ ]
  18. *" }/ n( T7 A2 _- ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' f4 V/ M& t2 W" B% l4 o; H
  20. * kind, whether express or implied; without even the implied warranty- r9 G: X7 d: E& ]8 ]+ E6 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 \+ X% ?' }2 J2 `% x' B
  22. * GNU General Public License for more details.
    8 t( n: q3 ?1 G) P+ }/ \, q
  23. */9 P0 h; _' C3 ?
  24. / R, u5 U5 ]7 g
  25. #include <linux/module.h>
    0 Q- I# q* q, p6 M
  26. #include <linux/init.h>
    " c' [( Q5 d9 e. [" M( k
  27. #include <linux/errno.h>! }- L, s2 u9 h9 p! D5 g
  28. #include <linux/types.h>
    2 v1 p' q% Z5 W% C4 H$ k
  29. #include <linux/interrupt.h>
      k2 Q5 Y% b2 C) E, n9 I- L
  30. #include <asm/io.h>" o3 @( D: D5 L, s# ~8 |
  31. #include <linux/moduleparam.h>
    7 [4 K7 v/ M( i% V
  32. #include <linux/sysctl.h>( q' r: c. Z* B/ N$ K  {, H
  33. #include <linux/mm.h>
    1 G, _$ U# ], h3 e3 m+ X$ k
  34. #include <linux/dma-mapping.h>
    / c. \' ?; ~0 t3 b5 ]

  35. & @0 A% a9 y) X" T. S# h' z7 A
  36. #include <mach/memory.h>- ~8 J3 z* o; ?+ S) Y: T
  37. #include <mach/hardware.h>
    8 }+ \5 p" ~, `. k8 I, C7 ~+ a
  38. #include <mach/irqs.h>
    9 F+ ]! q0 n8 z" q) n/ W
  39. #include <asm/hardware/edma.h>& a. {+ I, Q. y$ r& V

  40. ! s5 z% S/ C: ~- c9 i; W6 G2 e, z
  41. #undef EDMA3_DEBUG
    9 g- y5 q6 f) Z
  42. /*#define EDMA3_DEBUG*/+ V7 k2 {( A' ]! i' @2 Q& f
  43. : f" P/ A* H- p$ l8 k% C
  44. #ifdef EDMA3_DEBUG
    # B9 Y0 }' k' j2 X& Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 \* {( i8 w  ]1 B; m* e* q# O# x) d, K! y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' e$ c2 z2 T* G9 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* i$ s' |" P$ \) _" }3 p5 ^
  48. #else
      s8 R. X( \8 Q" a; Q
  49. #define DMA_PRINTK( x... )
    / A+ {( U/ s& H: {% g" `; k
  50. #define DMA_FN_IN
    9 h- |% S! D) }# o' |. z4 `
  51. #define DMA_FN_OUT
    ' t- h6 I# s' Z
  52. #endif: @9 M5 p4 h; c, }
  53. 7 J! m9 w' O/ b  p5 y# U0 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . k3 G3 l' H, M. S$ |: E$ r
  55. #define STATIC_SHIFT                3
    & e* x% _# n- c0 T; y  @) T8 T% U
  56. #define TCINTEN_SHIFT               20
    ( r* K/ L' }3 w6 V1 l
  57. #define ITCINTEN_SHIFT              21
    . o4 w2 J3 n3 f* Z% S+ f0 M* |
  58. #define TCCHEN_SHIFT                22
    " @* m  H, g/ U4 N" b
  59. #define ITCCHEN_SHIFT               231 x5 S2 m" M7 b; O3 S
  60. % g( Z& w- Q2 z
  61. static volatile int irqraised1 = 0;% m' [! t! `2 I
  62. static volatile int irqraised2 = 0;5 I' k' S# f+ I3 {

  63. ( e# {& ^( W9 m3 b/ B" E( r  T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  I  K9 A7 M, i0 H* r& n9 v9 ?1 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ~- Y, [% S/ f/ i$ D+ g" v" @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 d1 ]2 q1 X" D! Q5 O5 l9 o
  67. ! y0 S7 o8 c+ B) M" a
  68. dma_addr_t dmaphyssrc1 = 0;
    ( M/ X/ T5 V& M. K+ g2 ~! D
  69. dma_addr_t dmaphyssrc2 = 0;" P% L6 @' w' G! m4 T
  70. dma_addr_t dmaphysdest1 = 0;. J% L8 c$ v- R4 o* R- o
  71. dma_addr_t dmaphysdest2 = 0;
    . e# s. V) i  q( f2 y: s4 o

  72. 0 ^8 ]+ \* k0 _
  73. char *dmabufsrc1 = NULL;
    : C- U/ I. L0 _9 `
  74. char *dmabufsrc2 = NULL;" W: l6 @+ X9 K! P# N1 G+ O) ?
  75. char *dmabufdest1 = NULL;, @8 _, X$ q' S9 ?" ]' w
  76. char *dmabufdest2 = NULL;
    . [# k+ K/ ]* H: A3 {2 N
  77. - w( c, g; l! o0 h
  78. static int acnt = 512;5 u* d  Z8 H7 Z9 o! k
  79. static int bcnt = 8;
    9 r& M) k& p1 y! q, C
  80. static int ccnt = 8;
    $ Z, b/ \3 P) U
  81. # o% F1 ^0 E# T" R" k6 |/ R; x
  82. module_param(acnt, int, S_IRUGO);
    . \  O" b1 n/ q7 z
  83. module_param(bcnt, int, S_IRUGO);1 \$ H( ^- N$ I. F, h4 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 Z% ~4 {' g- R, {: f9 Q, n
7 e& ?& X2 m) Y/ y- ?' \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `9 l3 v. W5 m0 {/ q( Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' `$ Y+ \: A% J7 @* R: x* `2 a$ h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" l# V6 p  ~2 {5 t# n4 ^

7 W- x+ B. a' M3 H6 |! L, r% X* g
# c/ e5 @4 H6 f& |0 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 03:20 , Processed in 0.037529 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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