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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - e$ {! `( }" v! @6 r6 I( w
  1. [code]EDMA sample test application+ x# I# n8 R4 R& L( E
  2. /*
      J6 r, r- O& r, ~
  3. * edma_test.c4 @9 J; |! @; g" G7 ?+ H
  4. *
    , x+ z3 V8 i3 Q* M7 Z
  5. * brief  EDMA3 Test Application
    4 o8 N3 s  _9 w0 T# Q+ a
  6. *
    1 @% f! A2 Q2 t' y, U
  7. *   This file contains EDMA3 Test code.+ f3 [$ @4 t& S6 j+ E
  8. *6 h4 l0 U% R  ?- k$ V( J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - x6 s1 J! P) K# R& Y9 t* t( `# |. C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . ^$ Y; ]) H: c% ]9 }# g
  11. *         TO CHANGE.
    : E- U9 V2 B1 w# L; @1 e
  12. *
    / Z% N5 S# F, o" \! \, C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 _1 p* F5 R/ K2 g
  14. *5 _9 L( z# m/ G) z
  15. * This program is free software; you can redistribute it and/or1 d* s5 B8 t: z
  16. * modify it under the terms of the GNU General Public License as" E: ~+ s; k& S; @* H8 A' H
  17. * published by the Free Software Foundation version 2.  H7 X5 |, ^8 `& k
  18. *2 N% E- A, `8 o/ j, A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# x" w5 |4 Z# T
  20. * kind, whether express or implied; without even the implied warranty
    % \' ^' f6 E* y, s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + i+ W! y  B+ P. j; V8 R7 O
  22. * GNU General Public License for more details.
    2 k3 M0 n' `1 w8 f; A0 G. O0 B
  23. */" V1 ^% s) m" Z5 ^

  24. " {4 x' `/ f+ l, H+ r# j9 d- w
  25. #include <linux/module.h>* F4 h( W4 `3 |
  26. #include <linux/init.h>
    " c  {* P% H1 R
  27. #include <linux/errno.h>8 [9 ~& d# y8 A' w# {; L1 p! Z
  28. #include <linux/types.h>
    ' K6 E# Y: ?) |5 k) p3 m
  29. #include <linux/interrupt.h>
      z' S  r8 ]$ c" b9 |3 m6 Z
  30. #include <asm/io.h>
    ; c  _8 k6 Z8 _
  31. #include <linux/moduleparam.h>0 E% v9 v, g# E& g! S
  32. #include <linux/sysctl.h>
    - W& n& H- R6 C' a/ r
  33. #include <linux/mm.h>
    ! s" f6 M2 p. g  U
  34. #include <linux/dma-mapping.h>
    0 W- Q# B4 H1 h; h9 F' A
  35. 6 d' [: p7 b0 J; n' Q' Z3 |
  36. #include <mach/memory.h>8 b; Z: y; B2 `6 N5 t. S7 [. [! f
  37. #include <mach/hardware.h>. G6 V. t$ k2 B4 J
  38. #include <mach/irqs.h>/ w7 [1 H' @- {$ W
  39. #include <asm/hardware/edma.h>
    $ h' ~7 z9 t# p! v/ D8 v

  40. ; e* k* t# z+ ]# v
  41. #undef EDMA3_DEBUG) ]  i  U2 G+ s, c+ C6 e8 `
  42. /*#define EDMA3_DEBUG*/
    9 M) s% q) C1 o
  43. 3 v/ w/ l% H" p0 p, |1 h
  44. #ifdef EDMA3_DEBUG& I/ R9 ?6 r* N9 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ A: A7 _  q" y' b, \2 G6 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ ]7 k& S6 U; v; O& V# M. a5 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 [/ p7 O2 `4 h$ n4 Y6 h
  48. #else
    ) G: }# j5 J3 f- j5 \
  49. #define DMA_PRINTK( x... )- L' b% t- q  |4 R
  50. #define DMA_FN_IN3 {. j% I; c$ v/ v9 A
  51. #define DMA_FN_OUT- y7 q3 L( q) |
  52. #endif
    3 K: X# f' M3 B, }6 |- o( c

  53. ( u- z! g; c. L- k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): H3 z8 W7 T+ ~, S
  55. #define STATIC_SHIFT                3
    + n$ y! T  w7 k, r
  56. #define TCINTEN_SHIFT               20( p8 Z$ |0 }  l- t0 ?3 I
  57. #define ITCINTEN_SHIFT              21% n4 z+ O; ~$ L7 L
  58. #define TCCHEN_SHIFT                222 B2 x& d# T, D; T: ~& R3 x
  59. #define ITCCHEN_SHIFT               23( N5 V  s3 o4 s& n7 w8 |" q9 Q
  60.   C% y$ T! g" n' s" f% o+ u
  61. static volatile int irqraised1 = 0;" E7 e0 g# F$ y, F) @: F8 @
  62. static volatile int irqraised2 = 0;' J4 u; g# N' `# v; W* T
  63. 4 m" X$ T: K& ^- ]( W- c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ Y1 U( ]- F  E! v/ w0 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 _% H. D# W0 X- n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ {, Q9 G6 s& @/ A- k
  67. - F3 k$ a' @  J* p) _# V/ G" W
  68. dma_addr_t dmaphyssrc1 = 0;
    5 Q" s* M5 e3 P" |4 q4 u: l4 u
  69. dma_addr_t dmaphyssrc2 = 0;
    " N+ x4 w& p; M; u* @9 P
  70. dma_addr_t dmaphysdest1 = 0;
    - A% ^# B% {- ?& n' `% J, f- E
  71. dma_addr_t dmaphysdest2 = 0;+ C& s5 I9 Q( @5 o2 L

  72. 5 F* s3 b" I' ~) w. a# Y6 z! U
  73. char *dmabufsrc1 = NULL;
    ' l3 ^; P" O3 b: P5 K% _+ {+ d: `
  74. char *dmabufsrc2 = NULL;
    3 E/ C( g! l  `$ D
  75. char *dmabufdest1 = NULL;
    3 p1 C0 a( s: i/ s8 p  y
  76. char *dmabufdest2 = NULL;! {* g2 d4 p- L9 t0 j2 ~- E$ c
  77. # o0 z4 v$ X- {7 }# o! r0 Y1 n, F
  78. static int acnt = 512;/ J9 s. d& Q4 T5 j
  79. static int bcnt = 8;
    9 ]% w1 Z$ J2 i
  80. static int ccnt = 8;+ x1 c3 x' v) i7 f+ ^& V

  81. 1 D$ }0 q' O, Y# v& C
  82. module_param(acnt, int, S_IRUGO);- e# r# Z. Q+ Z' S# d' f! Z' ?( [( J
  83. module_param(bcnt, int, S_IRUGO);
    % v9 c4 H7 t* j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ m, u; H* a: b! T" c6 v( n( K, k& ~  M6 {" y1 ~3 ?  y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 h$ e: U0 s8 U- uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% u' f1 \& ?3 V- u% s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* S* i0 F( Q9 r' J8 |. [/ m+ T; ^8 n9 }- _( V) D: K

: m( V- a3 t# P+ I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-31 09:32 , Processed in 0.042424 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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