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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( j7 ~# k5 ]5 D& ]) e' q# V
  1. [code]EDMA sample test application7 t% a3 I$ v* H6 a7 y+ V
  2. /*
    * ~( j3 _& Q6 X3 L& _( ^2 L6 V
  3. * edma_test.c
    * ~8 N. p  V# {* c: [% g
  4. *
    & ^, l& ?( s( {
  5. * brief  EDMA3 Test Application
    ; w  e5 D% l& x2 K1 Q) y
  6. *
    ; w7 J7 |* w0 w; R4 h7 P
  7. *   This file contains EDMA3 Test code.; F; M5 Y  o' y( z. T
  8. *( K# b; Z/ \4 @' e9 }+ ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; E1 e5 m5 l2 @+ S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; J1 M4 X% |6 D6 x% O1 M: E  b
  11. *         TO CHANGE.
    # n% M# M! d0 v2 O/ W/ O, {; t
  12. *8 L3 U3 ~% P5 F* J3 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 ?& M! ^5 D- }5 {; m3 d0 H3 C
  14. *
    ' s7 ^4 {% H9 M$ r
  15. * This program is free software; you can redistribute it and/or) o5 @! V2 u# M, x+ _3 O# H/ x
  16. * modify it under the terms of the GNU General Public License as
    8 v$ l* j+ G+ v) d
  17. * published by the Free Software Foundation version 2.5 W/ n: Q3 N2 i' H- Z7 b
  18. *
    / B9 B/ n; U6 O" y& j6 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ h) i& Z0 }) k/ L3 L
  20. * kind, whether express or implied; without even the implied warranty; q& @' n! k  ^4 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. ?* |. `8 y9 R% `+ ^8 ?
  22. * GNU General Public License for more details.( i+ {  a  w0 p
  23. */
    4 Z" H* m* q: _! d3 H8 g4 {( ~9 ~

  24. ( d; \/ k% E. X$ k8 q1 r
  25. #include <linux/module.h>
    ; d8 x' w+ H' @: u
  26. #include <linux/init.h>
    4 p0 W+ H8 X6 Q& i' a
  27. #include <linux/errno.h>9 b9 D/ m! @8 t) v) [+ ^6 b# x2 g* ^0 n
  28. #include <linux/types.h>
    6 l+ u$ M% y/ x- O% t
  29. #include <linux/interrupt.h>
    ( }  K8 S- ~  k' `4 r9 e8 p3 a
  30. #include <asm/io.h>+ T5 I+ K  Z3 H! D# d1 w/ K. v% F2 `
  31. #include <linux/moduleparam.h>
    6 u: H# P# n5 ~" R
  32. #include <linux/sysctl.h>' m, R" A: z" n% L$ i: _7 i
  33. #include <linux/mm.h>
    . R6 X3 d% F* s; ~
  34. #include <linux/dma-mapping.h>; u7 H% Q# Z. B0 ~
  35. - r8 {) A6 Z$ |$ ^* o1 Y
  36. #include <mach/memory.h>
    ) h1 N1 m) O8 c  [
  37. #include <mach/hardware.h>
    % `8 y2 g7 c/ ~
  38. #include <mach/irqs.h>
    " a: k/ `. P* H% N5 L* ~4 ^
  39. #include <asm/hardware/edma.h>
    : w' F7 M+ w3 }& K3 f! ~5 X
  40. . [/ r9 S9 f" r  q
  41. #undef EDMA3_DEBUG
    ' P. {- y2 _4 K  k( n+ I4 g3 C
  42. /*#define EDMA3_DEBUG*/- ?& y& a% a" E4 @8 V

  43. & b/ G! W9 M7 K# \, D% S1 M
  44. #ifdef EDMA3_DEBUG
    8 n6 k2 j4 D; K% e) o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  g" R( `2 \( ^/ T0 A6 R  r+ K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" t8 \7 I2 k  c7 e2 p: c) h4 s  l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ~! F8 Z9 E- x( @8 p# _4 y( d
  48. #else6 K1 V, ]/ l; G: a" |( x
  49. #define DMA_PRINTK( x... )! Q6 ~9 A2 b" z4 j/ ?
  50. #define DMA_FN_IN! ^4 V0 g7 ~1 v8 E$ M4 }: q
  51. #define DMA_FN_OUT
    ! n* H, r- Q7 G# |# h  E
  52. #endif
    1 F; H$ n( x& h9 `0 [+ n; p

  53. 5 ~% [/ ?- k3 D6 I4 R4 O! H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 d3 H, j2 V9 n2 g% {6 P
  55. #define STATIC_SHIFT                3' q& m+ N" A; S# j# q: A
  56. #define TCINTEN_SHIFT               20
    ; _+ n2 b2 z/ k0 S/ L2 r! Y. `; p
  57. #define ITCINTEN_SHIFT              21% R: A6 R* _  X2 R( e: s
  58. #define TCCHEN_SHIFT                22
    6 Z# [* B3 i* V
  59. #define ITCCHEN_SHIFT               23
    " ^3 M! m2 [" l: f3 t

  60. % X; N4 H& B2 x+ X4 ]
  61. static volatile int irqraised1 = 0;
    9 N1 o, s' q- K; V. B
  62. static volatile int irqraised2 = 0;4 u/ ^3 `$ \' Z" i$ |; C

  63. * w8 R' S! V3 J. q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 H( u7 T: @% {6 n; [9 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 C% O. w6 M" H, Q" F7 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ?) S6 V# N3 A/ L$ {
  67. 9 C  w2 J; Y4 \0 n2 R) E
  68. dma_addr_t dmaphyssrc1 = 0;
    * ]7 X6 L" m& ?' p. ~8 E
  69. dma_addr_t dmaphyssrc2 = 0;
    9 K% m/ `) ^1 n
  70. dma_addr_t dmaphysdest1 = 0;
    . @( i! g. I6 F: q" V
  71. dma_addr_t dmaphysdest2 = 0;7 D( v/ O9 ~6 o

  72. " j5 e) X" l3 K" t3 ]9 K9 g& U: v
  73. char *dmabufsrc1 = NULL;7 F  ^6 r8 @8 V% @4 Y) @
  74. char *dmabufsrc2 = NULL;  y$ c) i! ~7 F
  75. char *dmabufdest1 = NULL;
    4 o6 E* v. ~- |6 L
  76. char *dmabufdest2 = NULL;
    $ g" T: W: Y9 p: \' h: n

  77. 8 b3 m. ]& d( R4 e# f
  78. static int acnt = 512;" s/ _7 _/ A8 [8 W' K
  79. static int bcnt = 8;
    " m1 h" o0 @9 a0 h( _2 h
  80. static int ccnt = 8;
    8 O, `: l4 O, S# [$ b

  81. 8 l: |0 F+ [* g9 U6 ]# v" }
  82. module_param(acnt, int, S_IRUGO);
    1 `" I! P' X2 @% g  n1 u
  83. module_param(bcnt, int, S_IRUGO);
    4 Y1 k8 V+ x4 w0 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% i/ n* Z# S1 [/ n% f
/ ]2 F7 q% X5 ^5 [7 E) S( e; w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) x1 @  L* v, B# c$ X, `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 }% D. O) V! u; R+ V/ m* n. o: V+ ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 v4 D' ~- `, r  d( s3 S. [; P
( y" s' x! a) @# O3 V# U
. e( N9 S2 }/ P. m3 S0 q0 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-5 08:09 , Processed in 0.039909 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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