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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 ~8 H! b. v$ ]1 ~( _% s
  1. [code]EDMA sample test application) d8 j* n4 w7 l$ i" X' q
  2. /*
    + v" _% `* a$ P1 }/ J
  3. * edma_test.c
    5 c* A4 N7 F* w3 I" S
  4. *' i2 U9 g; e: }0 |
  5. * brief  EDMA3 Test Application
    3 U8 A0 e& b4 V2 f' r" x: X
  6. *
    / b  {# M6 z/ I$ J( }/ S1 M
  7. *   This file contains EDMA3 Test code.
    " Z/ O7 Z) t: e0 w3 ?( ~
  8. *) S0 Y  F/ _2 y( e; K; `4 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( G( h- k, c9 I/ h3 j' Q5 }7 x; s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 p. L9 V6 S" a# Z
  11. *         TO CHANGE.
    , h, N9 H. j. Z2 r9 R1 f" o4 n2 ^
  12. *
    3 E% Y) @$ b" h0 T; r3 g( N$ C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! e6 Z% R+ G& ~9 D6 _- n
  14. *" P% o6 P9 N( ^3 {& l
  15. * This program is free software; you can redistribute it and/or
    0 ~5 L& n5 h' K- C
  16. * modify it under the terms of the GNU General Public License as' J3 I) |; F3 V1 E' a* `0 [' }
  17. * published by the Free Software Foundation version 2.
    4 b8 M" {# a" u( G5 B
  18. *
    $ K1 c3 N: ]! n) }4 t! W" ?/ w! ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% m. Q3 B% J5 d, p; m7 C: n$ T
  20. * kind, whether express or implied; without even the implied warranty
    ) m2 g6 X: O; g3 H" i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 A% x3 Z6 r1 l2 U! g8 D
  22. * GNU General Public License for more details.. l8 |) j7 R; m" H' [" e
  23. */$ O9 E' j8 b( k! j6 t: y) q

  24. ) [# T! c% ]  L
  25. #include <linux/module.h>
    6 i8 p( A0 v; h) F
  26. #include <linux/init.h>
    # s: h4 S  I, W& I
  27. #include <linux/errno.h>
    ( a" B4 s$ ^' i3 I! O, y1 Z
  28. #include <linux/types.h>, @- @- Z; p8 W! \
  29. #include <linux/interrupt.h>7 Y, c, G- ^6 N5 _, T  x) L7 T! G
  30. #include <asm/io.h>. [# n5 N+ _3 ]( S6 V( c7 S4 N! b
  31. #include <linux/moduleparam.h>" Z/ o. [1 m3 [: N- p" i, h; t) `, ^
  32. #include <linux/sysctl.h>
      W; I/ X9 I, e# G8 S
  33. #include <linux/mm.h>9 l! G, x! J2 ]" T# ^
  34. #include <linux/dma-mapping.h>
    ! D2 }4 E3 e8 x' V. y2 ~
  35. ; V, C2 `. l, Z
  36. #include <mach/memory.h>
    ( W) N4 L% y$ n7 v0 S# F" v
  37. #include <mach/hardware.h>  K0 q1 N" ~( v' o% d: a( U& ~8 |. Y
  38. #include <mach/irqs.h>! g7 F1 g6 L2 [' u- b( a
  39. #include <asm/hardware/edma.h>- i* B# W' }/ G1 T2 J7 V
  40. : H* g1 E( U7 ~, g1 c, f# ], I
  41. #undef EDMA3_DEBUG: E0 m- J1 O! G" p+ r2 J
  42. /*#define EDMA3_DEBUG*/
    ; U/ ]7 ~* [$ d5 R5 R. b6 x

  43. . X- ]5 ]% t! V; O
  44. #ifdef EDMA3_DEBUG2 ]5 I" ?9 m9 a! M% N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + u( q  L/ s! {1 ]8 T9 v; {  {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 ]% B. H9 ?1 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . [) c/ B( Q( E1 X& P
  48. #else
    3 n4 @) r/ Y3 d4 v$ ?( G
  49. #define DMA_PRINTK( x... ). d0 ]! C- L: m" Y6 u2 @3 b" i/ b
  50. #define DMA_FN_IN2 S% K& x' Z# s! E
  51. #define DMA_FN_OUT
    1 |+ N$ i5 W: n1 |; c
  52. #endif
    0 J: k8 D7 t, s9 P% o

  53. ( v8 _! z0 p/ s  N' \; u* c0 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& \8 s1 O. m' f/ m$ D
  55. #define STATIC_SHIFT                3
    ; E5 b% ~$ E; D1 d, v9 Z
  56. #define TCINTEN_SHIFT               20: A0 w* w8 Y" Y$ P
  57. #define ITCINTEN_SHIFT              21
    ' [  y" _8 Q" O* p1 }7 n1 n
  58. #define TCCHEN_SHIFT                22
    # o0 J" A' U$ L. B" N& q) o
  59. #define ITCCHEN_SHIFT               23( `; Z$ q" i/ v; ?. Z! y

  60. ' n5 k* C8 B/ l/ \# Y+ O
  61. static volatile int irqraised1 = 0;
    6 z# v$ m% P3 {* H: D- [1 ^
  62. static volatile int irqraised2 = 0;; D, G: |  E! i, H# M& l
  63. ; A4 p9 l6 f# x; x1 l' u& b! r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Y* ?0 R' v/ A3 ~; p4 [+ Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! s  I2 ]# I$ I: x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ {# S& n* ]( V* y3 m
  67. % F5 M+ O$ j' S2 [5 v! X3 F
  68. dma_addr_t dmaphyssrc1 = 0;' J7 J* G( y/ i- B
  69. dma_addr_t dmaphyssrc2 = 0;! X& ?* Y# C6 Q8 H' T6 g
  70. dma_addr_t dmaphysdest1 = 0;
    ; C5 ~. M5 P9 x4 O# k+ l
  71. dma_addr_t dmaphysdest2 = 0;
    # z" C0 M# g$ k+ k' @% ~8 ~
  72. 3 k. _- L; ]( }' v( ~" A
  73. char *dmabufsrc1 = NULL;9 P7 [8 s1 ?# Y$ g8 E
  74. char *dmabufsrc2 = NULL;) v" C3 s- [7 f# I
  75. char *dmabufdest1 = NULL;' b. M5 {" U8 Y: X0 Y
  76. char *dmabufdest2 = NULL;
    $ t. R: e0 F2 Q" N- F1 E

  77. 4 a$ q- ^1 P' i7 U/ Z
  78. static int acnt = 512;
    ' r: {, E6 W+ |) z7 u, {
  79. static int bcnt = 8;) Q4 ]$ N( g) @7 h. F: z" j7 D
  80. static int ccnt = 8;+ V2 ^5 N# ^: A% a2 e" J

  81. ; @- g; Z3 O7 M0 o* \( Q; l
  82. module_param(acnt, int, S_IRUGO);
    9 {) u( T4 s3 ]2 z
  83. module_param(bcnt, int, S_IRUGO);
    : H& f. g4 [) ]: h5 l. g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# `4 l" W4 v) A2 c8 [) e

7 [: n& @- |' t4 [: V( J7 ?7 w" ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 C) ?' c; Z3 m0 `0 i2 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 E$ ?& y* O9 `/ ?  M9 p3 `3 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 ^  c# ?5 k& M# m6 g$ j$ G& K

# R( |& E2 a* ]5 n" I$ _% i& P- b/ K  S) D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 01:22 , Processed in 0.038459 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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