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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( G2 ^0 W( H5 N: z
  1. [code]EDMA sample test application
      ]3 ^; S+ I! v+ X7 T5 b
  2. /*
    4 k) v+ `1 W1 z  a
  3. * edma_test.c9 M: ^6 `. W8 n! f- \2 Y% E% @1 p
  4. *
    ( n9 j/ ~5 p0 ?: w: }
  5. * brief  EDMA3 Test Application" F8 w& r& T( W9 L9 X: d
  6. *  u$ [: w% R1 f1 w! X4 c
  7. *   This file contains EDMA3 Test code.
    ( `: }0 @) e% [# q+ u4 f5 b
  8. *) c" J# D  P% ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" C2 W5 j7 {% A9 P! i: k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) O4 F2 C  X* h% A8 w7 K* K
  11. *         TO CHANGE.: Y9 W) |: R7 j" L
  12. *$ F/ V2 b) u! L! m& T, [, m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: Z" O3 [7 h3 G9 I- e
  14. *; ^( w% i- A. D/ M' N4 I
  15. * This program is free software; you can redistribute it and/or
    / J( J4 I: g# _, `0 A. T1 A! C
  16. * modify it under the terms of the GNU General Public License as) }' N* ^7 q1 b2 }$ w6 x+ |
  17. * published by the Free Software Foundation version 2.
    7 a0 f4 Z8 p9 r  M
  18. *
    5 B8 N3 x( k$ c$ \+ n* k2 D( Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) d, L8 d$ i5 S+ d
  20. * kind, whether express or implied; without even the implied warranty
    9 d2 |1 ^% j/ _! m, [) q( M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 f8 m2 v3 h4 @! t& T
  22. * GNU General Public License for more details.
    : J8 w* v* `( v
  23. */) |+ L* o+ {2 K; N% t% H0 ~

  24. / o- d1 U) U0 N! {" t3 i. ]
  25. #include <linux/module.h>: {) L7 @- D+ Z
  26. #include <linux/init.h>7 w# Y4 C+ j' c4 w3 }* i3 k/ K' Y2 Z' v
  27. #include <linux/errno.h>  T" q  n& a/ {: _, h+ ~
  28. #include <linux/types.h>( N& v7 e9 b& v/ {: B! n
  29. #include <linux/interrupt.h>+ m0 b6 S8 Z! l3 s8 B, W
  30. #include <asm/io.h>
    ; h3 L! U& e6 ^2 A" |# w6 E
  31. #include <linux/moduleparam.h>
    # }5 M& F5 ~0 m: f  p
  32. #include <linux/sysctl.h>
      Z) B0 Z4 u* [
  33. #include <linux/mm.h>
    ; Y: b) k/ {) S
  34. #include <linux/dma-mapping.h>, Q' \$ e/ ?* t- ?
  35. ; T9 s- v% j* e5 {( ^
  36. #include <mach/memory.h>: g8 t- N7 R+ R% ^$ L6 E
  37. #include <mach/hardware.h>8 N4 G- e: s- n8 B& T" s$ Z
  38. #include <mach/irqs.h>
    ; S+ r3 ~7 A3 y, r# z
  39. #include <asm/hardware/edma.h>
    - Q, d: r. X- m7 x
  40. * j  R6 Z6 x3 |, v% F  D
  41. #undef EDMA3_DEBUG
    : j* w8 L. ?( D6 W. {
  42. /*#define EDMA3_DEBUG*/
    4 t* ~( K- q) A6 A' K8 [
  43. ' N3 V8 M3 |$ g2 `! Y, z
  44. #ifdef EDMA3_DEBUG# `, e% k6 m1 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' n$ s0 V5 U" t( q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 @' c6 J! P9 M" F+ _# [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; d) U1 E3 k+ V+ d' l" u5 p
  48. #else. t3 u5 S# [; B: u
  49. #define DMA_PRINTK( x... )
    : |6 b$ |8 f: T9 P; J1 V
  50. #define DMA_FN_IN7 W# s% \/ c, }2 Z
  51. #define DMA_FN_OUT1 ~# ^& d8 R9 n& M5 ?8 `
  52. #endif
    " z' y4 u* r6 X4 f4 l7 l) G

  53. * y. ^1 K( U0 Q. Z. z# M* c0 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): q( h+ ^* X# b! @
  55. #define STATIC_SHIFT                3
    . |! Y4 z: n6 S. R& w
  56. #define TCINTEN_SHIFT               20
    8 G# z- ?5 a5 u0 e' g. P3 L, @
  57. #define ITCINTEN_SHIFT              21
    2 @2 P5 Z; K5 N4 ^$ g  T3 R
  58. #define TCCHEN_SHIFT                225 u6 Z9 ~& o! Q4 M! h
  59. #define ITCCHEN_SHIFT               23* ]6 M* r* Y; |  T

  60. $ c4 F! s+ E& B) }4 R$ b, z
  61. static volatile int irqraised1 = 0;( o; x  H" }, _
  62. static volatile int irqraised2 = 0;% r% x8 T! e6 y# n: m( }* L

  63. " L1 d% x4 f0 U) L9 q  N, Q4 G: C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / G3 @: u/ X9 K( ?8 m/ j9 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + N" t$ }  J. Q* |$ M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : h7 A1 [9 V5 x6 Q# f1 v7 H
  67. " L( {4 ?1 u* k( U1 V0 A
  68. dma_addr_t dmaphyssrc1 = 0;
    - Y$ g8 f. W' o2 p: P
  69. dma_addr_t dmaphyssrc2 = 0;5 Y" x8 k1 L( H+ q" s- Y
  70. dma_addr_t dmaphysdest1 = 0;
    4 i. w0 r2 l- m  Z6 c3 P' G) `& j
  71. dma_addr_t dmaphysdest2 = 0;. Y8 O* i; @9 [  E' Q7 I; u  n
  72. ( i: M& R1 {) U# h' t% s' f
  73. char *dmabufsrc1 = NULL;
    6 x& D/ J$ K% X0 i# B5 i+ N9 Q
  74. char *dmabufsrc2 = NULL;( X4 @4 v0 v, {0 z
  75. char *dmabufdest1 = NULL;6 I6 i0 V# ~, {! M
  76. char *dmabufdest2 = NULL;! c) B  o! V$ j6 @  T0 E

  77. + T3 u" U1 h( L
  78. static int acnt = 512;
    / A7 K5 }4 w2 P* @& l
  79. static int bcnt = 8;
    ' D3 O4 o+ \1 M+ u+ ?
  80. static int ccnt = 8;
    & F2 O% V; i9 ]" c! T

  81. 9 D  c; O9 c0 K2 G6 F1 C% s
  82. module_param(acnt, int, S_IRUGO);
    5 l( `3 i1 E' @5 k4 R3 M# S
  83. module_param(bcnt, int, S_IRUGO);/ W; B( h4 E4 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# z# \8 ^, T* I' f, n

# R9 T) W! I% V6 [) w! s- N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 q' G3 X" K4 b5 f( e5 s/ _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 M2 i9 d9 q7 i) \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 i, C3 R% c9 b8 W: j5 `0 Y$ i( f  B5 x  q2 F) `( r
/ m/ r# f  u: P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 03:34 , Processed in 0.041368 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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