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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 J; S4 @: M0 ^7 ?
  1. [code]EDMA sample test application
      f' w1 m, ]- a! G% [- a6 Z9 }
  2. /*
    % o9 e1 h' M6 `8 w
  3. * edma_test.c4 o: J) S; |3 u3 h
  4. *
    $ G2 g0 ?& I3 M6 Y: _- F- Z4 l
  5. * brief  EDMA3 Test Application1 n! @$ E1 d) y9 @: b0 j
  6. *
    8 y8 ~9 d! j' R" m/ Z+ A( t$ ~
  7. *   This file contains EDMA3 Test code.
    8 ]% `# E. g( o0 z9 C
  8. *
    % o8 J" P4 I1 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. l2 o" t2 f! u8 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & n2 [* V0 U( P" a( U% l% c7 d  x
  11. *         TO CHANGE.+ {# T. b+ Q5 ?9 y/ z& S5 U7 U
  12. *0 p( k4 E& j/ S& e; t4 H8 P  R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# g. l& H$ k7 e  C/ H2 c
  14. *
    $ D6 n5 e- m: Q
  15. * This program is free software; you can redistribute it and/or4 A' L- k* l# y* E2 E+ X1 G
  16. * modify it under the terms of the GNU General Public License as, L$ ]1 Y2 ?3 j
  17. * published by the Free Software Foundation version 2.
    ) d3 u- _/ S/ Z# R2 ?# W& }
  18. *
    4 z8 m3 S9 q5 M# D5 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 x  q( U5 \* T- U+ h
  20. * kind, whether express or implied; without even the implied warranty6 k( x* x! Y9 r  x& g. X! `" c+ g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & I; e6 x# W3 A& W: [
  22. * GNU General Public License for more details.
    0 D1 e5 ^! A0 y" U2 e
  23. */# u) z7 f& {, C

  24. 4 |0 a: ^/ r; X; p6 C, G
  25. #include <linux/module.h>
    ) `1 |9 J0 }( v' J
  26. #include <linux/init.h>9 B) B7 W9 {/ y9 @% Q$ Y" I# b2 }
  27. #include <linux/errno.h>5 M$ p3 h9 {: Y8 p  n9 h' G
  28. #include <linux/types.h>& z; L8 d1 x/ @& n, ]9 s* o
  29. #include <linux/interrupt.h>
    6 q" \( E" G0 `* q9 {* Z
  30. #include <asm/io.h>
    , J/ H& Q) S, j  I' v5 j
  31. #include <linux/moduleparam.h>4 K8 N# i3 g6 m% Y
  32. #include <linux/sysctl.h>3 U0 ~) d# z- \2 b' G5 t
  33. #include <linux/mm.h>: F5 T2 ~9 L. C
  34. #include <linux/dma-mapping.h>8 v9 C1 n  f, ^1 n

  35. 3 S5 j7 _" G) K! @4 f1 g8 y: K
  36. #include <mach/memory.h>
    0 C9 z. a3 M) f$ g3 W3 U! E
  37. #include <mach/hardware.h>
    ' _( J, O$ W$ v5 d
  38. #include <mach/irqs.h>; B, c; {3 J% y
  39. #include <asm/hardware/edma.h>
    / J- P- n+ a$ w2 |: i

  40. - f; T& L7 }3 n/ r
  41. #undef EDMA3_DEBUG5 ~4 ]& a. S5 o9 ^
  42. /*#define EDMA3_DEBUG*/4 [$ E7 j4 O$ o( Y

  43. + M& J. H: F4 `+ G( M0 l7 w* ]) \
  44. #ifdef EDMA3_DEBUG
    # g) o  j4 b, t! B: ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , X' y0 T1 F: Q' H4 H/ i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 R1 ?4 s- H4 P% B/ y* {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( S7 {- L6 G# w2 x5 ~$ J: M. R
  48. #else
    ) N. F. j6 y. W# Z
  49. #define DMA_PRINTK( x... )9 f9 `1 Z9 ]) ~; t1 s  X: e& \- {5 T
  50. #define DMA_FN_IN
    # E+ i. ^& L& M. p
  51. #define DMA_FN_OUT# u. [$ L& v; U' c; Z
  52. #endif
    + h: S+ x; s* ?* Y% m; M

  53.   K8 B9 R. ^6 _* b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), z; K( ~5 y# M6 |: I
  55. #define STATIC_SHIFT                31 t: ]1 N" B8 q* n( ]6 p
  56. #define TCINTEN_SHIFT               20
    - F* ?9 S/ @2 A" ]  F- r7 M
  57. #define ITCINTEN_SHIFT              21
    : v. u! ]0 f2 _8 F3 W+ s
  58. #define TCCHEN_SHIFT                22$ h8 h: Z) b6 m5 r, i5 g
  59. #define ITCCHEN_SHIFT               23
    ; m1 T' L* I3 h' }# d
  60. 8 R1 z0 P- ?" A0 h
  61. static volatile int irqraised1 = 0;
    . e/ J; E9 V1 B( j2 M# U
  62. static volatile int irqraised2 = 0;) U9 V$ c' ^; ~2 S0 m5 z. c! V
  63. ) Q8 l  D' O. H5 P, R, |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o8 C: e. E4 Y4 b$ H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a7 r9 K9 e  M! M# x- E' [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) W5 e/ K$ h$ O' c
  67.   G- H" s! m0 W& g9 j
  68. dma_addr_t dmaphyssrc1 = 0;  c) k# k& e% P: l
  69. dma_addr_t dmaphyssrc2 = 0;
      R' ~% e; E0 H( Q8 s
  70. dma_addr_t dmaphysdest1 = 0;. w, P2 m  W: `: @8 M
  71. dma_addr_t dmaphysdest2 = 0;
      @5 `* A% _) z3 V) I/ a

  72. - f. Z  K4 x, ^" H! n! H6 C7 t
  73. char *dmabufsrc1 = NULL;2 \* w7 U- h; h1 e5 {% f; u
  74. char *dmabufsrc2 = NULL;- |, n6 H/ l4 h8 x( v, s
  75. char *dmabufdest1 = NULL;  r6 _4 a% Y1 ?+ m9 V: W
  76. char *dmabufdest2 = NULL;1 m2 d. {" I  o

  77. : U! Z9 E; v# B0 R& u9 h
  78. static int acnt = 512;
    1 B' ^/ Q, o6 h0 R# L
  79. static int bcnt = 8;# t9 l& i. J$ T; j$ k5 t
  80. static int ccnt = 8;
    - ^  y' m$ E# v
  81. # M" q6 b6 L; q; ~  D
  82. module_param(acnt, int, S_IRUGO);, Y# g- O$ {8 @' a
  83. module_param(bcnt, int, S_IRUGO);/ D) l7 W4 M+ L# S, A! w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' G6 R$ U6 J) h6 I. Y
1 ^1 w( \# l1 D2 j! Q' ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 s# u* p8 s! V$ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( x+ A- [, f/ [0 D) ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% s$ {" ~0 }: j" _% @- a) ?. T( s; A, ]) j( z7 O! s& t; D

% i. Q1 |- m1 g* i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 07:55 , Processed in 0.031836 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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