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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 Z1 Z! e. }; d8 v8 H) b
  1. [code]EDMA sample test application
    # N7 S, S4 G8 D  f7 [. D8 z
  2. /*
    * q  O1 B+ S! k. T( a7 F
  3. * edma_test.c
    ' S. U. ^  }. Y# ^3 Y5 K: i; Z
  4. ** b7 _6 M2 _5 P8 E5 d; ]# f
  5. * brief  EDMA3 Test Application8 A) k( b& {6 v2 R$ x( f2 B
  6. *$ M: E: y. h+ T; U; u
  7. *   This file contains EDMA3 Test code.
    0 a5 g5 V2 y  y, z/ F3 e  V
  8. */ f3 p, G9 U; J4 c! {  z! `% C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; i/ Q0 l# z0 @+ v- {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * c2 D" \4 P) M8 z
  11. *         TO CHANGE.! I& |4 U) ?6 S
  12. *
    & J0 v* V) w, u- e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. Q- d) i3 _  i$ K. E( y' h8 U. P
  14. *6 [& q) U2 c4 p1 W* d" B
  15. * This program is free software; you can redistribute it and/or) h2 j6 j5 d+ c0 p
  16. * modify it under the terms of the GNU General Public License as
    8 _) H( h# A  u4 t+ _
  17. * published by the Free Software Foundation version 2.
    5 P3 K$ E3 e0 N, U+ y3 V: E
  18. *3 `" E, x" l; q* R& F+ I! Z9 }/ K! A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. U0 C% E0 o9 _8 Q5 c% h: X
  20. * kind, whether express or implied; without even the implied warranty
    % l* I1 _' j# c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  L' _: ?8 C" w! I  o
  22. * GNU General Public License for more details.4 Z: ]7 L2 U0 a
  23. */
    * g) q/ H$ ]9 Z0 V7 A4 I( j% I3 {
  24. 5 @" O/ f/ A& }: i/ s: }$ M; g
  25. #include <linux/module.h>
    2 ~5 P5 j5 H9 m3 d& j
  26. #include <linux/init.h>
    ' ?! M$ ~+ h( v/ o
  27. #include <linux/errno.h>
    3 H1 s1 T: N7 {, q
  28. #include <linux/types.h>
    3 m+ s7 q4 j0 u8 L+ \1 p3 ?
  29. #include <linux/interrupt.h>. J% v5 h( t; r6 t1 L
  30. #include <asm/io.h>, b  x' _  u) A7 n& ^
  31. #include <linux/moduleparam.h>
    ; e. i" j2 P9 ^4 \
  32. #include <linux/sysctl.h>
    . B+ e9 p, @4 T9 R4 p! f3 z
  33. #include <linux/mm.h>
    4 E9 n( R3 o2 r
  34. #include <linux/dma-mapping.h>
    3 s$ E5 |! S, V$ }/ n
  35. + P" B& E$ m3 D3 [* H' u1 B/ \3 B
  36. #include <mach/memory.h>
    - \! }3 e* w; x1 k9 q' ?& I
  37. #include <mach/hardware.h>" e5 G8 Q  T( Y6 g
  38. #include <mach/irqs.h>  R! W' y; H6 y: c: C# `( x1 n$ J
  39. #include <asm/hardware/edma.h>
    4 C! ]( ?5 f- V1 d& ^
  40. : Q: P- @# E( I2 \( h( ?2 y
  41. #undef EDMA3_DEBUG
    ( }& `' `$ ~6 L  s" W+ ~( Q
  42. /*#define EDMA3_DEBUG*/) o9 b* S4 [- `% X- @' B
  43. % M; ^# k4 q; g) [6 @/ q( [  V( g
  44. #ifdef EDMA3_DEBUG9 c! x, B; w+ G( C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # o5 m! i! A* \7 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; [0 L! c6 S7 D' B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 l* P3 S' I3 T8 z& k
  48. #else" j# O; D1 A  W- v: A
  49. #define DMA_PRINTK( x... )) d" x# Z9 J7 t+ {. q2 K
  50. #define DMA_FN_IN% y8 ?0 p  o7 G3 |9 @1 h9 K7 j
  51. #define DMA_FN_OUT
    8 l0 V4 L! f3 v! L% w, a
  52. #endif! e+ U* z& O6 e  ]( b
  53. # ~! B' p4 n. U* e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); _  F' y0 N; {/ O) a5 ~
  55. #define STATIC_SHIFT                30 u, Q& S2 m! U0 L% [; b
  56. #define TCINTEN_SHIFT               20) t* ^' Y- |6 C" `
  57. #define ITCINTEN_SHIFT              21
    ' z: \3 a6 o  A/ W) r; `
  58. #define TCCHEN_SHIFT                22; }4 Y+ h% m, |; ^- C$ f) }
  59. #define ITCCHEN_SHIFT               23
    ; |, U+ b5 P. {* ?' U! t

  60. $ r' l$ e9 h9 b- u
  61. static volatile int irqraised1 = 0;
    5 S9 M7 J5 ^' I" R* X4 M1 \
  62. static volatile int irqraised2 = 0;
    ; d9 |4 C8 R- i8 N
  63. ' G, N# b" Y0 e2 T9 K+ L, z1 r, n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' c0 p, c5 f. ^% v5 D& V1 \7 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & {( G$ ^+ X* u& [3 k  e' a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ j2 ~+ t! ?6 P$ T) i2 Z2 N+ M

  67. 5 u7 M- ?- _, w" q- k! g
  68. dma_addr_t dmaphyssrc1 = 0;+ g8 G& G$ K4 X; g: B
  69. dma_addr_t dmaphyssrc2 = 0;
    ; Y  Q% U# `  M, H% e6 m5 ?! B9 d5 s
  70. dma_addr_t dmaphysdest1 = 0;. c/ T5 O2 ~( B! \& |
  71. dma_addr_t dmaphysdest2 = 0;1 A, s2 H7 ?0 S3 m$ e

  72. - H) N& P4 P% @
  73. char *dmabufsrc1 = NULL;; K4 {8 B' |* @2 V) S0 j; ^" v
  74. char *dmabufsrc2 = NULL;5 E1 \+ f. g& g/ e" [: G
  75. char *dmabufdest1 = NULL;
    % B$ c0 ~0 J9 \; V! C# I4 h
  76. char *dmabufdest2 = NULL;
    & Y. D2 T- n' `0 q- w& a
  77. ; J0 S& D( ^& o  @
  78. static int acnt = 512;
    ) D! t2 F  n& H: g1 \$ V
  79. static int bcnt = 8;7 |% F6 g0 i$ _% n. U4 t  R% A
  80. static int ccnt = 8;" T$ {* u5 b& e# P* H- R

  81. % Z5 W; A- }3 n6 B4 ]9 n- h: }
  82. module_param(acnt, int, S_IRUGO);
      O# E# Z0 ?" }8 z/ L
  83. module_param(bcnt, int, S_IRUGO);5 z) ~" d& J  t" i& x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! r' m2 z: h! Q) i
5 D4 [+ h( B* f8 G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. |( c% e: S: I$ O. L7 p1 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; C- m1 g  g3 }- t/ q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ v5 x$ B7 E. C0 P/ a  {7 F) ^# t8 ~. v: {
: V6 L% Y- Y5 a. f! m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 02:31 , Processed in 0.040152 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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