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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ z3 E( I" z+ y2 }; h
  1. [code]EDMA sample test application
    / c/ P6 x( q9 p0 e" {0 o" B5 U
  2. /*
    ) c, l  g! r5 s9 X  V2 I
  3. * edma_test.c& e# E( V, x4 _& @- g( b8 Y+ r
  4. ** ^# H) t7 }5 f0 n
  5. * brief  EDMA3 Test Application
    " `7 `5 U$ J- Z  i3 w* q0 f' `3 d
  6. *7 G* c! v+ M  b% ?( d/ u
  7. *   This file contains EDMA3 Test code.
    . v% e% Q7 b- e, ?
  8. *
    0 h  ]* N( k3 L$ J0 q0 I! ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : {  Y9 j- J6 j$ n3 j, U4 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " v) X3 s% S' Z+ H" b' G1 U! f
  11. *         TO CHANGE.
    ' o; }3 T: s# X2 t9 u* j# s6 c
  12. *
    0 V& C1 n) P% o  [2 E5 t% |/ C" N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// t% f7 g/ ~9 p8 A
  14. *- ^5 M" `) v9 y. @; _) S
  15. * This program is free software; you can redistribute it and/or
    7 z4 ?2 g6 Z% e7 o, g; r' y3 N( X, n
  16. * modify it under the terms of the GNU General Public License as* i# ~% |# ]5 j8 I3 w4 H/ g
  17. * published by the Free Software Foundation version 2.
    + A" u! @7 e% W9 ~/ L6 V
  18. *- [4 H% V: k' T! M5 A9 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' X9 q, e( a4 a' ]7 j
  20. * kind, whether express or implied; without even the implied warranty
    7 T. g2 F- X0 b6 z- h0 ]4 n: v$ W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 f7 ]4 P1 w; X5 [" d% j2 Y; |7 y
  22. * GNU General Public License for more details.
    8 c8 l4 u# J  W- t
  23. */
    8 e" t# V* D' f$ T/ N( r
  24. . |  p. b" P+ E! A
  25. #include <linux/module.h>" B6 a4 ], T  p$ s# r; r! _
  26. #include <linux/init.h>
    ! d5 T: [: C# o( ?. n8 R- y6 S) ]' f( c+ F, e
  27. #include <linux/errno.h>
    0 ^$ n( a5 P  H* w$ x# ^0 F
  28. #include <linux/types.h>
    , @' @4 {; p1 N5 C6 \, ~" M
  29. #include <linux/interrupt.h>3 b0 V- n6 W# u6 x( H( B2 r
  30. #include <asm/io.h>
    2 R' l: Z- ?: O
  31. #include <linux/moduleparam.h>
    6 ^0 H; e7 w) E; D) S, K
  32. #include <linux/sysctl.h>
    * l- P' P& t5 i
  33. #include <linux/mm.h>  {, [) ^* X& S- I
  34. #include <linux/dma-mapping.h>  e' f# h0 }% v) T. K/ K) A5 E7 P

  35. ) `) m2 v! p# h' c- |% L8 \% a
  36. #include <mach/memory.h>
    7 H4 {$ U1 c% n- c$ i- _1 X
  37. #include <mach/hardware.h>, b8 k5 _% z! f* A" d
  38. #include <mach/irqs.h>4 o* x2 i0 ]/ v# h1 W* N
  39. #include <asm/hardware/edma.h>
    8 g: ~- N& t+ e' r2 V5 Q
  40. + u+ ~# |5 m, {9 {  B
  41. #undef EDMA3_DEBUG- ~' _9 l" \8 y$ A
  42. /*#define EDMA3_DEBUG*/
    ! w# E+ H+ T$ O, H5 h0 [( s4 q, G, j

  43. , n7 b! [, _1 w3 z) L5 S
  44. #ifdef EDMA3_DEBUG/ i3 I, n2 z; E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 _) }. U: Z2 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) l, ^7 Q2 ^9 i1 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ U1 ?# g! k" L/ W! K8 k! |% @- c
  48. #else
    . g  R- \6 r. B
  49. #define DMA_PRINTK( x... )
    / a4 m: _8 `# ^+ w) S
  50. #define DMA_FN_IN
    % ]5 |* W  w" N( ~8 t
  51. #define DMA_FN_OUT
    2 `4 z  N  n# t& l6 @* N; F# [
  52. #endif* D( l: ]7 n' }; R! k

  53. # [2 P0 d+ G+ ~* D1 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  {% T! j/ k% w6 i, k
  55. #define STATIC_SHIFT                3$ V6 K% D! t, }% O7 m
  56. #define TCINTEN_SHIFT               20' f0 ~; D: V1 S- w8 K, P& T: x! E
  57. #define ITCINTEN_SHIFT              214 f  j! u% Y7 H" Q) }+ V9 I% ]
  58. #define TCCHEN_SHIFT                22
    . y0 x' W9 U, h
  59. #define ITCCHEN_SHIFT               23
    . ?4 n% U7 w8 x/ {6 f: S/ p

  60. ' D! ?( `8 E+ q) F4 _) ^7 m( G; |
  61. static volatile int irqraised1 = 0;6 u( j. b% d# B- L7 y7 W
  62. static volatile int irqraised2 = 0;& d' T( [; u0 p5 P; N
  63. ( m# R' a' B- B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 R3 L: s/ F+ i; M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ?* O* g& }5 \5 G/ R6 w9 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 ^+ h  h& P# \, T7 a" X8 m
  67. 2 @9 f# c- C& ~1 X- Y1 `
  68. dma_addr_t dmaphyssrc1 = 0;
    ) ~4 w5 K+ g7 w7 [- ~, z
  69. dma_addr_t dmaphyssrc2 = 0;
    4 I- |9 g# @1 r9 W
  70. dma_addr_t dmaphysdest1 = 0;' u# B& c- |, M+ T% N
  71. dma_addr_t dmaphysdest2 = 0;
    $ ^8 t3 z6 w+ d2 C
  72. * t1 V# F! K" ^7 t
  73. char *dmabufsrc1 = NULL;% |9 i9 ~$ P/ b% l1 d* Z% {
  74. char *dmabufsrc2 = NULL;
    " B9 Z+ D! Z; b$ L7 [6 R: z. W
  75. char *dmabufdest1 = NULL;
    , I/ f/ H$ x: ~5 n& Z
  76. char *dmabufdest2 = NULL;
    9 ]/ G2 u* f9 Q: Q. D  z

  77. $ l% R: s# h; e* C' o& q6 e5 V
  78. static int acnt = 512;$ x) K5 l2 `7 O9 ]; a% }+ Q
  79. static int bcnt = 8;
    # V" ^1 m# u( r# h# P* D' l8 M
  80. static int ccnt = 8;
    0 c9 ?; `- f( L, @

  81. 4 T& `1 i: K: P1 ~7 O
  82. module_param(acnt, int, S_IRUGO);  T2 c* `! `7 ~( S& t. N
  83. module_param(bcnt, int, S_IRUGO);
      U# e0 ?3 ?+ r2 i  O4 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  E1 ~6 H: |6 q9 V/ e) s

, N% P" @( v* E, l8 {$ W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 x4 E  N1 O9 r& H8 ?# A9 S, T( n: _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, F6 [7 X/ \6 t- a* m' M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 b' Y% t1 v) i; r2 X- [! K" q
% b5 j2 X. }1 Y( f; K/ Q3 e; D& {; r) A* f' }4 o% J/ K$ J5 u7 W) c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 16:21 , Processed in 0.038512 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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