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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 e* p5 B& A; g& }6 J5 f
  1. [code]EDMA sample test application
    0 U$ Q4 e1 G9 M$ I' Q. W
  2. /*
    $ J! G0 j1 b/ V
  3. * edma_test.c, T1 [" X/ Y! k& w  l* O
  4. *
    & n; {9 p2 P) y3 J
  5. * brief  EDMA3 Test Application
      Y$ D: S9 ^* q" B1 O/ |  e% P
  6. *
    " R8 a: r; g4 K
  7. *   This file contains EDMA3 Test code.
    8 B5 V9 I/ \* D% N7 W* {: F! c
  8. *( C. m" l8 ?7 T  x! z) X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : z8 K# l' G- F  Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . n+ {( X9 s. {' N7 z" Q8 ^
  11. *         TO CHANGE.; \. K8 R4 V1 W. D/ U, L* W
  12. *
    ( Z- m. N( j9 A3 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 l2 _* w' ^: |" ?+ J
  14. *
    ! Z9 @5 ~' L1 C) W9 W9 [$ i
  15. * This program is free software; you can redistribute it and/or+ ~, c/ C$ I2 R, w0 f
  16. * modify it under the terms of the GNU General Public License as$ D/ ^% c, _0 f7 E! Y% ^: h
  17. * published by the Free Software Foundation version 2.
    ' ?8 B6 Y) h/ r+ A
  18. *0 z- A/ ?5 @1 K( v* x2 J  o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 x) X% Z- I' `5 J$ a, o3 O
  20. * kind, whether express or implied; without even the implied warranty: d( F3 k1 @; j2 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 K. k: v8 q' k0 U' V/ E
  22. * GNU General Public License for more details.
    1 q' W  `9 `! K% ^7 Y: q4 Q  V
  23. *// s' F$ O5 k9 A! W1 O7 q; ?3 s

  24. % E& B+ H5 p: U6 Y: ~& m3 o, z
  25. #include <linux/module.h>  v1 U- C& }6 y1 \$ I+ G
  26. #include <linux/init.h>4 G* @* @* w5 P) v9 s7 k  W
  27. #include <linux/errno.h>
    0 ~$ y# D; p8 p: R+ f
  28. #include <linux/types.h>* O9 C+ t$ q/ z7 i
  29. #include <linux/interrupt.h>
    * l& N% i' a' @6 \
  30. #include <asm/io.h>
      D* \/ G. M4 |7 @9 j1 P2 h6 Y
  31. #include <linux/moduleparam.h>
    % h9 T/ d! j# u9 T' L1 \
  32. #include <linux/sysctl.h>
    ! ]( E& A+ \6 _. n/ N6 V' E
  33. #include <linux/mm.h>; n/ B5 C9 ]. V) Q
  34. #include <linux/dma-mapping.h>2 r8 _) d8 _& y+ Q; _& V4 \2 W
  35. , ~$ {0 r# Y0 |# N. z; X9 ?# [. J5 v
  36. #include <mach/memory.h>
    # s/ [5 o8 Y3 l9 g7 L
  37. #include <mach/hardware.h>  L; A# F3 ], g4 @
  38. #include <mach/irqs.h>& f. b. K* X: I( q6 W  m2 J
  39. #include <asm/hardware/edma.h>3 t4 E$ [) Q( N. N
  40. & ?; g3 I& P( ~3 Y+ c  e8 Q! M
  41. #undef EDMA3_DEBUG
    7 O6 \3 d' U7 L2 N% _5 M# s# `
  42. /*#define EDMA3_DEBUG*/
    + c8 ]) I4 G' s3 G* g+ `
  43. ) g/ \) v) f6 z' T
  44. #ifdef EDMA3_DEBUG0 L/ z2 ]- Q" J' a8 Y0 D0 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 x6 Y0 {! [4 [8 {: z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + J' t, ]$ h4 I; b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( I8 p2 i- B9 T* G! m
  48. #else
    + r5 h/ I% R3 p, u9 Y0 e; j% p! b
  49. #define DMA_PRINTK( x... )# o1 ~1 Y" L3 @
  50. #define DMA_FN_IN
    3 k! W6 `' z; w
  51. #define DMA_FN_OUT
    ! t/ S# N- [" p" f
  52. #endif
    * s& l2 r0 @' K

  53. : @5 C% h9 [7 Q9 c% Z# K# R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( i! u' j7 A9 h* |
  55. #define STATIC_SHIFT                3
    2 d7 }# S9 Q/ |( z7 N
  56. #define TCINTEN_SHIFT               20; e8 p8 i$ S( [3 n, k3 y& r! Y
  57. #define ITCINTEN_SHIFT              21
    6 s; V1 i! X- K' h; \7 l- i/ P
  58. #define TCCHEN_SHIFT                22
    ) L! ^- b3 h. A2 x" N% O
  59. #define ITCCHEN_SHIFT               23
    & b- ^: ^; ]/ t4 x/ l
  60. # Y& P- \" [+ d( P
  61. static volatile int irqraised1 = 0;/ H1 ^6 z' U) x2 o9 F+ G3 v
  62. static volatile int irqraised2 = 0;! U1 a6 v/ D1 r* Q1 q1 y' E

  63. ; N  B8 K" q) U7 `) E  b! x4 }3 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* M9 \; @( P  W6 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      c8 C: c$ n( l. I* t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 K$ b& X1 a0 U: K4 [8 @( I0 i

  67. * v- t( S, U' d6 K" W0 O3 w3 N
  68. dma_addr_t dmaphyssrc1 = 0;
    , w9 x& Z. `$ U( S, v
  69. dma_addr_t dmaphyssrc2 = 0;
    7 b! z4 H) }1 K9 N
  70. dma_addr_t dmaphysdest1 = 0;
    & Z3 @; i# g) w) M3 n0 f7 p2 k& z
  71. dma_addr_t dmaphysdest2 = 0;( |2 N3 E9 b  t( _! }) n+ ]) R

  72. 0 ]6 g; T7 _* w. A* {
  73. char *dmabufsrc1 = NULL;- @/ G7 F+ d+ o' o5 k; d, q
  74. char *dmabufsrc2 = NULL;( l" D8 R$ }$ \' V! S9 F
  75. char *dmabufdest1 = NULL;( P. T. c0 y9 |" S
  76. char *dmabufdest2 = NULL;
    0 q% S- _  G* Y1 N, \' O' P8 b

  77. 3 X- s' H' K* M( ], M$ I1 z
  78. static int acnt = 512;( Q: j% r3 M' ]: H
  79. static int bcnt = 8;
    ( u, W) f2 P4 `! i* V
  80. static int ccnt = 8;* Y( q$ Y8 _  Z

  81. 2 B; y0 a- k' A- v
  82. module_param(acnt, int, S_IRUGO);
    / Q8 h/ f# P4 Z1 h' Q# m
  83. module_param(bcnt, int, S_IRUGO);3 ^3 `0 _- R( A. u, O6 [: a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 Z* Y! [% u! ]/ s) K$ o1 v5 a0 t$ r5 L2 y* [3 A6 q# q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 T5 V- p4 _$ d* Q; |! rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. O7 C5 _. l' h0 O0 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, z  y% o- [" m" K0 M+ Z( I( a3 j9 S

3 F7 t2 _  U0 E" f* L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 20:12 , Processed in 0.037180 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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