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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( n( n8 e. a+ x! s# S
  1. [code]EDMA sample test application
    ! t5 }- Y( P% _& q* e# _
  2. /*% g+ F: q5 l( n2 ^9 z2 I
  3. * edma_test.c
    $ b. b( K' L- `: q0 P3 {4 {
  4. *4 H, I  M! T1 `
  5. * brief  EDMA3 Test Application# E5 [/ w2 d5 M0 A2 U
  6. *. @  R3 D: [  w/ _  k/ X% C9 O( f+ N
  7. *   This file contains EDMA3 Test code.$ Z+ O# S7 T% Y- B
  8. *  T8 I- P5 e5 _; r. V: M- N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 L1 r7 X" J$ ?5 q. A' V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * K6 o4 V% M( V7 T' b0 \
  11. *         TO CHANGE.
    1 n7 ]; o, @' F4 P. R. I8 D% R1 a
  12. *
    7 D8 n, ?- \  [3 @' A) ]$ b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % Y. B6 a$ {  ~8 M5 }+ _) ?
  14. *
    $ l& t$ ^& Z- B% B4 }9 d3 A
  15. * This program is free software; you can redistribute it and/or+ a4 r8 g6 g7 k) d# b
  16. * modify it under the terms of the GNU General Public License as
    3 u3 Z/ ^" \) T& F
  17. * published by the Free Software Foundation version 2.5 _) g/ h' q0 Q1 W6 }
  18. *
    : k5 w" l2 ^0 i$ y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 Z# n5 P! S; D2 k" ]4 d% M
  20. * kind, whether express or implied; without even the implied warranty
    ! K( n( z& Z0 B$ ~4 i# V$ z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . p2 o2 a$ O/ P# P' C8 S
  22. * GNU General Public License for more details.+ }4 Y; B* ~  L* n
  23. */
    8 z: Z/ t$ F/ v0 o, m% ?% i( f
  24. 0 @7 H; j" u( r8 p
  25. #include <linux/module.h>
    8 v" {, y) @! f$ k
  26. #include <linux/init.h>
    4 P# r. u- h% Z& C
  27. #include <linux/errno.h>
    , f2 M9 Y8 s2 L1 B4 K: ]
  28. #include <linux/types.h>
    5 ]& T$ T& Y" S: U/ {3 h; i4 `
  29. #include <linux/interrupt.h>
    6 H3 C& x) V5 ^  K% D; K% B+ O
  30. #include <asm/io.h>1 c+ I" ?! K8 }: ]; q* a# ^
  31. #include <linux/moduleparam.h>
    , a) n: ^4 M: z4 v
  32. #include <linux/sysctl.h>
    ; D3 q3 x" P, w
  33. #include <linux/mm.h>8 U. K5 \: G; ^! o1 J" c
  34. #include <linux/dma-mapping.h>
    0 K9 l2 ~9 G7 F4 O
  35. 2 R# ~$ P1 d) e  @
  36. #include <mach/memory.h>
    4 z1 }' ^/ m( E
  37. #include <mach/hardware.h>5 d; ~$ o0 S) d2 R
  38. #include <mach/irqs.h>
    5 W0 B# ?2 L$ B) k# ?8 N9 k
  39. #include <asm/hardware/edma.h>) [3 Q' @* {; ]/ N: [
  40. ( x7 c/ C4 @& d: G
  41. #undef EDMA3_DEBUG/ P# }) m* E( h# O9 P. U! N
  42. /*#define EDMA3_DEBUG*/6 R: D* M3 V! X
  43. 1 g, D* F: y* m: Z
  44. #ifdef EDMA3_DEBUG  D5 k/ y* ?* z0 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 b" F% H6 N3 c0 Z! s- [  F5 |0 B* V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% o8 Q# K  H4 r7 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! ]" q* a* Z+ S; e/ O
  48. #else" P2 b5 g2 V0 K- ^
  49. #define DMA_PRINTK( x... )
    3 L9 X0 Q6 i) ^( ?$ Y" Q* h$ O
  50. #define DMA_FN_IN$ Q, R0 M$ j9 ]+ Y5 ?2 p
  51. #define DMA_FN_OUT
    2 c4 i* ?0 w) j. l9 e# [
  52. #endif, T% q& Q( g% M! r8 }& w( k

  53. : T1 `' o7 i% j$ R: `2 r5 \, q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 ^# I& ]# s8 p: C0 g( `3 u. L. K
  55. #define STATIC_SHIFT                3
    # k$ c. @2 @( e2 J3 h/ T# H5 j6 w
  56. #define TCINTEN_SHIFT               20
    ( p1 m3 D# ~% ?' S6 W( E! ]
  57. #define ITCINTEN_SHIFT              21
    1 W9 ~$ }- q) g& H; p9 ?4 H( Q7 k" {
  58. #define TCCHEN_SHIFT                22  i9 h) {' K% O
  59. #define ITCCHEN_SHIFT               237 p8 D7 R8 ?! @4 I
  60. + s% F' E& r1 X0 r$ |2 k
  61. static volatile int irqraised1 = 0;
    . N6 l+ b6 {- F, w2 k5 v
  62. static volatile int irqraised2 = 0;
    - Z/ I% u* q! h' v$ ?! I

  63. # ~9 e/ M* V" ]& \" ?. g+ C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ x6 b6 t6 b6 C% S9 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & k# p! u$ J8 e/ T3 F6 A; U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % D# p, y( O7 K7 t, {, z4 V. n

  67. * S( ]! D  t$ B9 X
  68. dma_addr_t dmaphyssrc1 = 0;
    9 f9 P2 U- M* P- F/ x
  69. dma_addr_t dmaphyssrc2 = 0;
    & j" x8 e+ H8 o# }) M: V
  70. dma_addr_t dmaphysdest1 = 0;
    # X* A" T7 p3 B7 F# Z( T3 z* N1 L
  71. dma_addr_t dmaphysdest2 = 0;, G' v& F- T6 ]& F/ ~: t

  72. - ]6 t4 J  A9 i0 x4 \  {
  73. char *dmabufsrc1 = NULL;
    ( P5 A! A# D9 {5 H) C
  74. char *dmabufsrc2 = NULL;% B; E' w3 l5 T
  75. char *dmabufdest1 = NULL;
    & N6 a- C& D0 h
  76. char *dmabufdest2 = NULL;
    1 {# E2 H; G4 [7 N
  77. * G: ^8 @" E) p7 e6 X5 c/ `
  78. static int acnt = 512;
    1 _0 ^7 A# i- i" m4 H2 B
  79. static int bcnt = 8;
    , q8 R- r0 C' ~- @
  80. static int ccnt = 8;8 J+ ]7 g. m& W. @
  81. * s( f0 Z. X1 k* P
  82. module_param(acnt, int, S_IRUGO);/ [6 N9 e" q0 ^5 }* ~9 f0 e3 k
  83. module_param(bcnt, int, S_IRUGO);
    ( a9 g) E, i1 H7 h" @0 v2 ?5 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 F5 o) }' c; C

- m, R& x( }0 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  K! V) B# @' U, l% {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& j- U/ J) s3 B8 @, M) p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* {# k* A* J6 d5 u. s
1 w9 Y5 i4 K( K# O/ {" d1 c
( Z. i8 z- L7 b! l9 i$ n% O5 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 23:38 , Processed in 0.039862 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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