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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) |* x9 J& r% U0 l; _- z
  1. [code]EDMA sample test application, o0 O& A4 P/ [  V" |2 N! X
  2. /*, c+ [6 F. V# p2 _) Z" {. Q
  3. * edma_test.c
    $ T; e( f3 e: H# a4 M  v
  4. *+ ?% z5 u! W8 O4 T' D  y8 m
  5. * brief  EDMA3 Test Application
    / N* p) v/ v. o, N& c
  6. */ L- ]% e/ \$ [* N/ U- z$ i3 A
  7. *   This file contains EDMA3 Test code.5 h) v1 Z3 U% _+ E' l
  8. *' b6 p( {! O* R# W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) m3 C7 P& G4 C# A4 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) b: _9 k  [0 r# y" T
  11. *         TO CHANGE.
    ( L5 |  A: z! O  C
  12. *
    0 q) P4 X' u7 e& F+ a7 I7 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! I2 @7 [4 M( O
  14. *1 |# W1 a  x6 ~8 K, i; j$ e. ~4 t
  15. * This program is free software; you can redistribute it and/or$ u* K- J. o4 n
  16. * modify it under the terms of the GNU General Public License as
    : c4 z. S6 J$ \
  17. * published by the Free Software Foundation version 2.7 `8 e' G) d$ n8 C2 E! m
  18. ** K  E3 A  f3 G, r9 `" c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ y9 h3 }& c- e- Y% p
  20. * kind, whether express or implied; without even the implied warranty- l6 H0 I9 }% Y$ }  [9 R2 I% x" M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 }0 m1 Y. ?- \! B
  22. * GNU General Public License for more details.
    ' R, Z( X2 W& A+ u) j/ A! S" T
  23. */
    1 W2 A. }: d6 H1 |  O% C
  24. 1 ]0 K, _  j/ `, F
  25. #include <linux/module.h>
    3 B1 t. ~9 I; [5 g, b- c1 Q
  26. #include <linux/init.h>
    & O$ w, l# x' |+ k( y
  27. #include <linux/errno.h>
    / F5 D7 N* g0 s8 C
  28. #include <linux/types.h>9 }: h2 q8 R( ?: V
  29. #include <linux/interrupt.h>
    6 T, J( H( G) t
  30. #include <asm/io.h>0 S7 Z6 ]4 Q, s& U# n$ l& C9 ^
  31. #include <linux/moduleparam.h>
    9 n1 o( ]! a" R
  32. #include <linux/sysctl.h>& F- h7 F& o7 U. r0 @6 c9 }: r: s
  33. #include <linux/mm.h>
    . g- `$ ]. T, C
  34. #include <linux/dma-mapping.h>
    : w2 B+ z* _& K7 s1 @) O4 K% s+ {
  35.   a3 s9 d8 {! ~8 r& s  s% s& `
  36. #include <mach/memory.h>
    / p& s; y. J0 q
  37. #include <mach/hardware.h>$ Z! O9 a( `- b) b; o
  38. #include <mach/irqs.h>9 |! M  }! V1 l# q. ~
  39. #include <asm/hardware/edma.h>8 Y$ F/ o6 a! S
  40. # N* C' o* Q! Y/ s
  41. #undef EDMA3_DEBUG" T) _) [: L, @
  42. /*#define EDMA3_DEBUG*/
    0 n# y6 h! v! r( o

  43. 2 o& R' V$ c& O8 k% v
  44. #ifdef EDMA3_DEBUG
    ' z! V. f0 ?0 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 |% b7 Q. w4 v+ t4 w* I0 \+ H4 S$ c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), I  n3 ?$ b! U, ~$ t4 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : a$ {" S* q6 H
  48. #else# E0 L1 L. _1 s% x
  49. #define DMA_PRINTK( x... )
    5 E' Z# w& g. D2 N
  50. #define DMA_FN_IN
    & ?+ v( k- w8 ]! t  r) v  q; O7 q
  51. #define DMA_FN_OUT" J2 y1 l. K9 G% a& t( y9 v1 b: z  F
  52. #endif$ {; P+ H6 {+ J* H+ F- F7 @

  53. 0 c. _5 ]- z' E+ I& X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 d+ M! M; _8 T# t5 b: r% g1 b  i5 H
  55. #define STATIC_SHIFT                3
    . |4 N  q% a1 Q9 o6 }' a1 ?
  56. #define TCINTEN_SHIFT               20
    & I. s* O* j6 T  c7 p
  57. #define ITCINTEN_SHIFT              212 `, u" N" S+ k9 ^5 o3 m  a% E( M
  58. #define TCCHEN_SHIFT                22) L+ n6 Y3 J( Q* p
  59. #define ITCCHEN_SHIFT               238 M! b* }, K* \  P
  60. * X- X9 k( g# O& {5 j
  61. static volatile int irqraised1 = 0;4 b9 J' r" l4 [. Z6 x+ ^+ J" n
  62. static volatile int irqraised2 = 0;1 W+ k. o3 G0 y0 ~+ h2 L

  63. . {- Y' T. }2 E" H# P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ^* p! h- J: n. M  v/ i* G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \1 ]& Y6 {; q+ |1 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 Y6 P9 }) B) ~7 E' q$ v9 ~

  67. & K& N: B. X. U4 ?9 ]! ]
  68. dma_addr_t dmaphyssrc1 = 0;; W6 Z1 Y( ~; n; B" g  W( J) C3 I5 R' b
  69. dma_addr_t dmaphyssrc2 = 0;7 O) q9 [, R+ r  i( r4 K! D: @1 @5 ^
  70. dma_addr_t dmaphysdest1 = 0;7 T! l9 x4 S* `5 G8 r# v" m
  71. dma_addr_t dmaphysdest2 = 0;
    ; J0 S; I* ^& l  n9 ?+ N0 i4 V" `
  72. 5 q% c/ U$ C: @" w
  73. char *dmabufsrc1 = NULL;
    0 c  [' b" y6 b* k
  74. char *dmabufsrc2 = NULL;: o* _- V# ~* c4 F  }- q5 f: Z
  75. char *dmabufdest1 = NULL;4 |9 n) V7 Y7 t- y
  76. char *dmabufdest2 = NULL;
    4 P: [5 G* a8 K- U# H) P/ d2 ]) \
  77. ; y2 i5 J7 n. @: N3 L9 x8 c7 S6 o
  78. static int acnt = 512;
    . |) B6 r$ \. D8 Q$ W' `
  79. static int bcnt = 8;- I6 C: q1 B$ O& T& @' P
  80. static int ccnt = 8;
    , p1 K% L$ V# ]; X+ r, d  B& Z6 k

  81. ) q8 P  n  |, j
  82. module_param(acnt, int, S_IRUGO);
    0 p9 E" j$ P) H  M# j
  83. module_param(bcnt, int, S_IRUGO);! `$ `' k( c- S  m) x3 `/ F) T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ @+ O6 p; l) g# J+ C; t3 L

4 {6 M& f3 B7 D% B- D' t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- y2 Q6 `# p9 z; ]' y3 J- harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ p. q# w" _6 v* z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 T) V/ t0 Q% E
2 r/ O8 U8 g, a% r

* R% v5 u% _& \6 l5 J  x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 14:23 , Processed in 0.039775 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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