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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ^" I2 Q  {) F4 h
  1. [code]EDMA sample test application
    * A3 e' S/ m  v7 N2 S( E. d5 A
  2. /*
    4 a' S) T. V: @
  3. * edma_test.c1 p" ?4 j1 \2 p# w
  4. *$ k# m. R0 _! H+ d9 U6 b
  5. * brief  EDMA3 Test Application: d) Z! p3 p1 G% K- I( e8 A
  6. ** y, ~: Z% l" F+ S4 P2 Q
  7. *   This file contains EDMA3 Test code.
    9 z6 y+ Z, \( `7 {" r
  8. *5 n  @9 Z& `+ D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 E$ z+ s$ }! w( |0 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ L8 S8 L$ ^; N9 S! F4 e! O
  11. *         TO CHANGE.
    / \3 |0 X3 i! S8 R3 o2 ~6 s8 f
  12. *
    0 z( ?0 D0 D) N; ~# Q* X- l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ o% C0 z9 B7 T5 J2 n' d
  14. *$ g; |) M1 \( B
  15. * This program is free software; you can redistribute it and/or' @" d; }* A; h
  16. * modify it under the terms of the GNU General Public License as7 N5 h3 o9 g' N# ]$ n  ^
  17. * published by the Free Software Foundation version 2.8 P# n0 k* s; C% k
  18. *7 X% e$ C3 d# n/ z5 i$ }2 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( K" G) n8 a. Z  u" A
  20. * kind, whether express or implied; without even the implied warranty
    . G5 ^# c* n1 p# t% ^) ^) j9 k6 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 k/ w0 [7 c8 g8 b) H
  22. * GNU General Public License for more details.
    ! N3 k+ L1 _6 C4 S
  23. */  t: A1 R" W( H
  24. , z7 n, R! ?1 p# Z: {
  25. #include <linux/module.h>
    4 @. u# p6 u& g8 K$ u' W  ]% A5 |
  26. #include <linux/init.h>6 d  d- Q; e+ m$ E9 ]. {
  27. #include <linux/errno.h>
    / V# y  v  z( h; E" B, c. L
  28. #include <linux/types.h>
    # n$ M9 r2 c4 ^; x) v) B( ~& C
  29. #include <linux/interrupt.h>; `. M0 |( H& J4 Q
  30. #include <asm/io.h>$ ~, e; M3 ~2 I  g5 L
  31. #include <linux/moduleparam.h>) l* z2 ^  r- P' R1 w1 g" K
  32. #include <linux/sysctl.h>) t( O' C' s2 K9 g8 j' s% B* M0 M
  33. #include <linux/mm.h>1 k1 C* I# m: }! f" K6 n
  34. #include <linux/dma-mapping.h>
    / K2 K  o* g' A& ~+ R# \6 V
  35. 3 U, y8 L* P/ \$ A! J8 s1 o8 i
  36. #include <mach/memory.h>, T% u0 @/ Q; Q0 o
  37. #include <mach/hardware.h>2 [( c4 f: h! X# G0 W
  38. #include <mach/irqs.h>2 q2 Y+ x. H, G; {* i/ ]3 w. [
  39. #include <asm/hardware/edma.h>
    5 b( v+ Y! F% D. X# _5 D* W

  40. / A- {4 X" F' H) o$ h% c
  41. #undef EDMA3_DEBUG
    " r2 j6 P5 N6 z/ M
  42. /*#define EDMA3_DEBUG*/; c! V8 a6 ?+ j5 G& P

  43. 1 }+ [2 b& ^8 K( Q. d6 A3 ?
  44. #ifdef EDMA3_DEBUG  m1 O1 f4 `# M2 X# e/ B& `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( e; G3 |9 l1 L5 y' [+ c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' M; X2 {! i/ I7 K# _/ m  c3 m) R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 `5 P7 m: Q5 u8 M! D# _4 A  W
  48. #else
    4 z. t/ `9 e* n% ^; i
  49. #define DMA_PRINTK( x... )+ O6 Q3 T2 K" _. }9 M" z0 S) Z- m& {
  50. #define DMA_FN_IN" l* s4 ~' D* s* n# y' X/ d
  51. #define DMA_FN_OUT& b7 @/ Z3 S) g! M7 R$ M/ K
  52. #endif6 l( d2 |' J, f+ @; ^
  53. * V2 F* O: x! z, ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 J: u( A$ a. p2 w7 f' z9 J# g
  55. #define STATIC_SHIFT                3
    7 P, A* D; C, P" ?2 l( N  e- u
  56. #define TCINTEN_SHIFT               20. X2 @/ f  d% k( q4 c3 w7 f
  57. #define ITCINTEN_SHIFT              21! Z- _& X# d. n4 }
  58. #define TCCHEN_SHIFT                220 e6 S0 ^6 ~: z3 P7 S- r- s) t6 A
  59. #define ITCCHEN_SHIFT               23
    * p* h+ U' x9 A. r. C6 [$ A
  60. , k9 q+ [5 D! v* Q
  61. static volatile int irqraised1 = 0;# X* [3 t+ h. {: u
  62. static volatile int irqraised2 = 0;$ j% p/ A( H; f9 {3 n1 [2 \. K( w
  63. / V7 c& l4 d7 `4 U% q# N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- [& A4 W  r$ F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! K/ E: K# R  e, e2 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % M: {; R7 q0 X( o$ ]

  67. : k: n7 Y7 Z! J8 ^/ F
  68. dma_addr_t dmaphyssrc1 = 0;0 M: V. T/ {. C2 o
  69. dma_addr_t dmaphyssrc2 = 0;* F; E! m2 I! S/ Z0 i: t
  70. dma_addr_t dmaphysdest1 = 0;; y: \) Z( J$ f1 |7 P
  71. dma_addr_t dmaphysdest2 = 0;
    # \4 N: d, ?( a$ }4 P4 ^1 Z
  72. 7 k9 H- f0 d6 A
  73. char *dmabufsrc1 = NULL;
    ' n/ c; b. p& l0 e
  74. char *dmabufsrc2 = NULL;* z$ {) I7 U  s8 T  y; T
  75. char *dmabufdest1 = NULL;
    * G+ {% \, d" \9 T) ]* X
  76. char *dmabufdest2 = NULL;
    * ^1 \4 P# d( r0 O9 U) g' e6 P3 s

  77. ; Y" [  ]0 x1 c$ |
  78. static int acnt = 512;
      d9 t' @& n$ ~
  79. static int bcnt = 8;
    2 {6 z: t" H8 f/ H1 n: \
  80. static int ccnt = 8;9 }7 B7 z* N0 X

  81. 6 l9 b3 K" A. n  t: M9 p: t6 T
  82. module_param(acnt, int, S_IRUGO);
    7 _: d6 |! o! M* B4 }7 Y8 e' F
  83. module_param(bcnt, int, S_IRUGO);* Z, C/ p7 w$ g% L. i0 ^( A- V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; D4 W/ r; X$ Z" q
& {1 R* c0 h0 N: H( j6 G3 c1 A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; N8 Z6 u  G5 G% narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! A  n; D  t& E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ k( N) k( `# D) A
+ U* ?+ d2 y/ L# I. g
% ^1 A4 {6 P' ^) M/ l& q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 10:08 , Processed in 1.512224 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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