OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( L; K# O/ Y7 x! L4 F# e1 I
  1. [code]EDMA sample test application
    - b/ B& ], f0 j, ~
  2. /*
    # u% V& Z9 i; O' n3 y, i9 D+ Z+ M
  3. * edma_test.c% z+ V6 }1 g4 Z8 E- d& G9 @4 Y0 ]
  4. *
    7 \0 N2 N5 c3 T$ c& }  J
  5. * brief  EDMA3 Test Application
    5 D' q2 T, S! ?* e& e4 N) {
  6. *: B1 o( a4 B" S3 C4 L7 s. q
  7. *   This file contains EDMA3 Test code.
      S" U, b. U  J  f! Q* r9 F& F- j
  8. *
    ) _' p4 Z4 w8 {' ]) ^, A0 j+ t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# g$ |0 k7 D* b) t" h9 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & M% |( s2 l& i- w0 M4 d% c
  11. *         TO CHANGE.4 q! Z  C+ e+ X  f1 f& [4 R8 e8 F! T
  12. *3 M5 d. H! R" w: C& W  C) [1 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 [* M7 d1 X8 x- e6 s1 g7 r0 g5 e3 M
  14. *  L( R3 f# ]7 ^* V
  15. * This program is free software; you can redistribute it and/or
    - b) B8 v" ^1 Z# M" z" {! t7 O
  16. * modify it under the terms of the GNU General Public License as
    ! U, j- H$ P: ~1 [) v
  17. * published by the Free Software Foundation version 2.
    * u" m) i  p  s5 i6 N/ T/ p
  18. *
    5 g# M/ S0 S6 M+ _  |+ y! |( [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 U  O% z$ y; c, v2 \% J8 t8 s" ^
  20. * kind, whether express or implied; without even the implied warranty
    - ^1 ~" M' r$ ]1 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / _' Y' b- R9 w" g" d% G
  22. * GNU General Public License for more details.
    : r0 l5 ~9 H( S3 K9 y1 W8 r  l
  23. */) e7 p( i# P9 X0 N! `
  24. 7 X' _4 @& l/ B; j7 S
  25. #include <linux/module.h>
    % i6 R5 o% H2 N
  26. #include <linux/init.h>. |+ a$ d% Z3 O1 U" h( g; R+ w6 S
  27. #include <linux/errno.h>
    2 A8 Y! u" X6 f1 C6 R
  28. #include <linux/types.h>
    0 z2 J7 c2 `8 W- H, \) X
  29. #include <linux/interrupt.h>$ r! r6 W7 \+ m- ^3 b4 r
  30. #include <asm/io.h>
      L% [( G/ p0 f
  31. #include <linux/moduleparam.h>
    3 G* c2 F5 y' O
  32. #include <linux/sysctl.h>
    - r  r$ v, A  y
  33. #include <linux/mm.h>
    6 O* I0 D" B5 q* G  Y; X
  34. #include <linux/dma-mapping.h>
    1 Z$ `7 f3 ^  ]& k$ r
  35. - E+ P+ D7 S. t
  36. #include <mach/memory.h>* q6 T, a! _3 |3 C, _) t% Z
  37. #include <mach/hardware.h>
    . \8 v: e4 n4 i2 Z; U
  38. #include <mach/irqs.h>
    7 U4 V0 y9 i# D  U3 f# j' s# G5 ?$ I
  39. #include <asm/hardware/edma.h>% i. P2 K# ]7 z
  40. ; ]& [# v- I" v
  41. #undef EDMA3_DEBUG
    / V/ K- h8 L0 |! e% P1 J  M
  42. /*#define EDMA3_DEBUG*/
    ! A: Y7 ~& Y- _* I& k. Q9 t$ f
  43. * D/ o7 b" _* b! D, @9 M  Y
  44. #ifdef EDMA3_DEBUG
    $ e: E, p5 U9 {$ A& }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 U4 x5 f! X6 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ?$ G9 @1 n  W7 e  k. m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ \. Z+ R  z2 m) J
  48. #else
    - B. P5 X0 r# n7 x0 p
  49. #define DMA_PRINTK( x... )6 o% s+ M2 L# {* V9 J  u, h
  50. #define DMA_FN_IN
    ( U: k8 |  k3 Q3 d4 Z3 v/ I4 F7 N" \
  51. #define DMA_FN_OUT  z3 S7 L6 L# ?, }* M! {# E
  52. #endif
    ) ^( {3 z8 s9 Y
  53. 5 D9 X8 D' j! P+ }/ @' e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- C6 f  z" V, W2 y; q7 @
  55. #define STATIC_SHIFT                3
    : O7 G1 |/ V# o' a7 y/ U( ~+ E* s+ Y
  56. #define TCINTEN_SHIFT               20
    8 m' j: P' N/ Z) S- Q
  57. #define ITCINTEN_SHIFT              21
    / n: j6 s+ P9 t) T7 n' c0 F" m# Q
  58. #define TCCHEN_SHIFT                22! z* k; ]7 S2 ^9 s+ B- K( F
  59. #define ITCCHEN_SHIFT               23
    ! x4 K  }* O6 }( d: @+ {5 V3 T

  60. 3 e) R8 d5 }: o- x6 j- b( q9 G
  61. static volatile int irqraised1 = 0;
    + O" q" j% [( P" X. t/ m- W" t- _
  62. static volatile int irqraised2 = 0;6 K1 }$ H! I6 T

  63. " v. a  \% a0 _6 t+ q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 p) E$ ?6 c8 @. t1 p$ @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Q/ q6 D4 p: y. n3 Z( r9 t, i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ~! Z0 K; h9 r8 w  s& E; {( e

  67. " z! S  b* q( U# _' A
  68. dma_addr_t dmaphyssrc1 = 0;
    . [% t& f2 G: `" n+ C  h
  69. dma_addr_t dmaphyssrc2 = 0;
    ' l% F, {4 V7 Y) n2 Y8 e
  70. dma_addr_t dmaphysdest1 = 0;
    1 \9 b# I, q1 L5 J+ H4 t8 r
  71. dma_addr_t dmaphysdest2 = 0;
      W4 @* P8 L: d- m, X1 Y: n& q

  72. ; m2 [& J+ Q/ @  @) _- x& Y
  73. char *dmabufsrc1 = NULL;
    4 e7 r, H; s3 J; e; H1 G8 H5 g" q5 h
  74. char *dmabufsrc2 = NULL;1 x7 C8 Y8 w/ }  d
  75. char *dmabufdest1 = NULL;
    8 O6 b$ x9 s4 F' G: x$ V7 o5 H
  76. char *dmabufdest2 = NULL;
    & N* O) e; M" U

  77. 3 [6 G) H7 W: q/ l4 F8 K. H# h0 Z
  78. static int acnt = 512;
    1 F/ H% B/ t! R& |6 Q& x& }. y
  79. static int bcnt = 8;% M( g$ j. D& J0 Q; \
  80. static int ccnt = 8;
    , Y* y' Z! Z  T# k* U% q, N8 s& P, R

  81. / l& w0 {6 t4 b- I  q
  82. module_param(acnt, int, S_IRUGO);* M6 j* [' j2 y3 R9 i; ^
  83. module_param(bcnt, int, S_IRUGO);
    ; E3 H1 t) q  u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! h/ a+ d; n. ]
) K" q- N% P0 b1 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% W  X4 E' B8 n) a/ |8 b4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 L/ r' K8 @4 G6 N- ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ?7 z6 F# B# S6 A+ j! M' W

5 p+ @. N0 b  N& B1 b9 h
% H* l, z: u8 }7 c/ c4 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-21 14:06 , Processed in 0.038734 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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